Field defaults are not set after approving smart action, but are set as expected when no approval is required

Feature(s) impacted

Smart actions, approval process

Observed behavior

In our smart action, there are several fields that are not required but have default values set in the database. When completing the smart action normally, this works as expected, i.e. we just have to fill out the smart action’s required fields, and then after completing the smart action, the non-required fields that we left blank are properly set to their expected default values.

However, if that same smart action requires an approval, the default values for those non-required fields do not get set after the action is approved.

Expected behavior

We would expect that the record get created the same way whether it required an approval or not.
We expect leaving non-required fields blank to get set to their assigned default value when an action needs approval.

Failure Logs

None

For example, in this screenshot of approval details, the fields accountOwner, ach, aha, and availBalance should default to false but you can see their value is blank.

Also as you can see, the first institution was created with approval required on the smart action, and the second institution was created without approval required on the smart action.
The fields voa, voi, ach, and rssd are not required to be filled out in the smart action and have defaults set in the db.

Context

  • Project name: Woodpecker
  • Team name: Developers (but happens in all teams)
  • Environment name: Testing_v2 (but happens in all envs)
  • Agent type & version: “forest-express”: “^9.4.4”,
    "meta": {
        "liana": "forest-express-sequelize",
        "liana_version": "8.5.4",
        "stack": {
          "database_type": "mysql",
          "engine": "nodejs",
          "engine_version": "16.15.1",
          "orm_version": "6.19.0"
        }
      }
  • Recent changes made on your end if any: None relating to these fields or action

Hi @rachelburnett,

  • Recent changes made on your end if any: None relating to these fields or action

Was this working before ? :thinking:

Could you please share your smart action definitions (with all the fields and defaultValue) please :pray: ?

It looks like this was not working before, we have just noticed it as we’re moving towards all smart actions requiring the approval process. (But again, the smart action without approval works as expected).

from institutions.forest.js

function init() {
    Liana.collection("Institution", {
      searchFields: ["id", "name"],
      actions: [
        {
          name: "Create Institution",
          type: "global",
          fields: [
            {
              field: "id",
              type: "Number",
              isRequired: true,
            },
            {
              field: "name",
              type: "String",
              isRequired: true,
            },
            {
              field: "rssd",
              type: "Number",
              isRequired: false,
            },
            {
              field: "rank",
              type: "Number",
              isRequired: false,
            },
            {
              field: "depositShare",
              type: "Number",
              isRequired: false,
            },
            {
              field: "voa",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "voi",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "stateAgg",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "ach",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "transAgg",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "aha",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "availBalance",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "accountOwner",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "loanPaymentDetails",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "studentLoanData",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "accountTypeDescription",
              type: "String",
              isRequired: false,
            },
            {
              field: "phone",
              type: "String",
              isRequired: false,
            },
            {
              field: "urlHomeApp",
              type: "String",
              isRequired: false,
            },
            {
              field: "urlLogonApp",
              type: "String",
              isRequired: false,
            },
            {
              field: "oauthEnabled",
              type: "Boolean",
              isRequired: true,
            },
            {
              field: "urlForgotPassword",
              type: "String",
              isRequired: false,
            },
            {
              field: "urlOnlineRegistration",
              type: "String",
              isRequired: false,
            },
            {
              field: "class",
              type: "String",
              isRequired: false,
            },
            {
              field: "specialText",
              type: "String",
              isRequired: false,
            },
            {
              field: "specialInstructions",
              type: "Json",
              isRequired: false,
            },
            {
              field: "specialInstructionsTitle",
              type: "String",
              isRequired: false,
            },
            {
              field: "address",
              type: "Json",
              isRequired: false,
            },
            {
              field: "currency",
              type: "Enum",
              enums: ["USD", "AUD", "CAD", "BRL"],
              isRequired: true,
            },
            {
              field: "email",
              type: "String",
              isRequired: false,
            },
            {
              field: "active",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "status",
              type: "Enum",
              enums: [
                "online",
                "offline",
                "maintenance",
                "testing",
                "investigating",
              ],
              isRequired: true,
            },
            {
              field: "topInstitution",
              type: "Boolean",
              isRequired: true,
            },
            {
              field: "newInstitutionId",
              type: "Number",
              isRequired: false,
            },
            {
              field: "autoMode",
              type: "Boolean",
              isRequired: true,
            },
            {
              field: "accuity_data_id",
              type: "Number",
              isRequired: false,
            },
            {
              field: "showAccountSelectionOAuth",
              type: "Boolean",
              isRequired: false,
            },
            {
              field: "timeZone",
              type: "Enum",
              enums: Object.values(validTimeZones),
              isRequired: false,
            },
            {
              field: "displayName",
              type: "String",
              isRequired: false,
            },
            {
              field: "script data",
              reference: "ScriptData.id",
              isRequired: false,
            },
            {
              field: "account support",
              reference: "AccountSupport.id",
              isRequired: false,
            },
            {
              field: "branding",
              reference: "branding.id",
              isRequired: false,
            },
            {
              field: "country code",
              reference: "CountryCodeReference.institutionId",
              isRequired: true,
            },
          ],
        },
      ],
    });
  }

And from our institution model

const Institution = sequelize.define('Institution', {
    'id': {
      primaryKey: true,
      allowNull: false,
      type: DataTypes.INTEGER,
      unique: true
    },
    'name': {
      type: DataTypes.STRING
    },
    'rssd': {
      type: DataTypes.INTEGER,
      allowNull: true,
      defaultValue: -1
    },
    'rank': {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    'depositShare': {
      type: DataTypes.FLOAT,
      allowNull: true
    },
    'voa': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'voi': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'stateAgg': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'ach': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'transAgg': {
      type: DataTypes.BOOLEAN,
      defaultValue: true
    },
    'aha': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'availBalance': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'accountOwner': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'loanPaymentDetails': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'studentLoanData': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'accountTypeDescription': {
      type: DataTypes.STRING
    },
    'phone': {
      type: DataTypes.STRING
    },
    'urlHomeApp': {
      type: DataTypes.STRING(1150)
    },
    'urlLogonApp': {
      type: DataTypes.STRING(1150)
    },
    'oauthEnabled': {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
      allowNull: false
    },
    'urlForgotPassword': {
      type: DataTypes.STRING(1150)
    },
    'urlOnlineRegistration': {
      type: DataTypes.STRING(1150)
    },
    'class': {
      type: DataTypes.STRING
    },
    'specialText': {
      type: DataTypes.STRING
    },
    'timeZone': {
      type: DataTypes.ENUM(Object.values(validTimeZones)),
      allowNull: true
    },
    'specialInstructions': {
      type: DataTypes.JSON,
      validate: {
        isValidSpecialInstruction(value) {
          const result = specialInstructionSchema.validate(value);
          if (result.error) {
            throw new Error('Special Instructions is not formatted correctly');
          }
        }
      }
    },
    'specialInstructionsTitle': {
      type: DataTypes.STRING,
      allowNull: true,
    },
    'address': {
      type: DataTypes.JSON,
      validate: {
        isValidAddress(value) {
          const result = addressSchema.validate(value);
          if (result.error) {
            throw new Error('Address is not formatted correctly');
          }
        }
      }
    },
    'currency': {
      type: DataTypes.STRING,
      defaultValue: 'USD',
      allowNull: false
    },
    'email': {
      type: DataTypes.STRING
    },
    'active': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'status': {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 'online',
      validate: {
        isIn: [['online', 'offline', 'maintenance', 'testing', 'investigating']],
      }
    },
    'overallStatusTemp': {
      type: DataTypes.STRING,
      allowNull: false,
      defaultValue: 'online',
      validate: {
        isIn: [['online', 'offline', 'maintenance', 'testing', 'investigating']],
      }
    },
    'transAgg_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'voa_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'voi_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'stateAgg_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'accountOwner_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'ach_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'aha_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'availBalance_status': {
      type: DataTypes.ENUM(...STATUS_OPTIONS),
      allowNull: true,
    },
    'topInstitution': {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
      allowNull: false
    },
    'checkImage': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'newInstitutionId': {
      type: DataTypes.INTEGER,
      allowNull: true
    },
    'requiresFinicityCallout': {
      type: DataTypes.BOOLEAN,
      defaultValue: false,
      allowNull: false
    },
    'autoMode': {
      type: DataTypes.BOOLEAN,
      defaultValue: true,
      allowNull: false
    },
    'accuityData': {
      type: DataTypes.STRING,
      allowNull: true,
    },
    'showAccountSelectionOAuth': {
      type: DataTypes.BOOLEAN,
      defaultValue: false
    },
    'statusCode': {
      type: DataTypes.STRING,
      defaultValue: false,
      allowNull: true
    }, 
    'externalId':{
      type: DataTypes.STRING,
      defaultValue: null,
      allowNull:true
    },
    'displayName': {
      type: DataTypes.STRING,
      allowNull: true
    }
  },
  {
    tableName: 'institutions',
    timestamps: true,
    createdAt: 'createdAt',
    updatedAt: 'updatedAt'
  }
  );

Oh okey the defaultValue are inside your model not your smart action :thinking:.
I see where is the difference, when doing a smart action without approval, only the field that are filled are sent while in the approval, everything is sent.

I will create a bug ticket: ClickUp

I see, thank you very much!

Do you have an estimate for when the fix will be released?

@vince Any update on when this will be fixed?

Hello @rachelburnett,
A fix has been released, could you please tell me if everything is working as expected on your side?
Thanks!

Hi @anon34731316, yes this is now working as expected. Thank you!

1 Like