@servicenow/sdk - v4.9.0
    Preparing search index...
    • ApprovalRules configuration to use in Fluent Flows Ask for Approval action.

      This function converts a structured approval rules object into the string format expected by ServiceNow Flow Designer. The rules define who can approve or reject a flow and under what conditions.

      Rule Structure:

      • Multiple rule sets are connected with OR logic (any ruleset can satisfy)
      • Rules within a rule set are connected with AND logic (all must be satisfied)
      • Each rule contains conditions that specify users/groups and approval requirements
      • Conditions within a rule are connected with OR logic (any condition can satisfy)

      Rule Types:

      • Any: Any user or any group member can approve or reject
      • All: All users and all group members need to approve or reject
      • Res: All responded and anyone approves or rejects
      • Count: Specific number of approvals required to approve or reject
      • Percent: Percentage of approvals required to approve or reject

      Parameters

      Returns string

      A string representation of the approval rules for Flow Designer

      //Any user or group member from a list can approve or reject
      const simpleRules = wfa.approvalRules({
      conditionType: 'OR',
      ruleSets: [{
      action: 'Approves',
      conditionType: 'AND',
      rules: [{
      rule_type: 'Any',
      users: ['user_sys_id_1', 'user_sys_id_2'],
      groups: [],
      manual: false
      },
      {
      rule_type: 'Any',
      users: ['user_sys_id_3'],
      groups: ['group_sys_id1'],
      manual: false
      }]
      },
      {
      action: 'Rejects',
      conditionType: 'AND',
      rules: [{
      rule_type: 'Any',
      users: ['user_sys_id_4', 'user_sys_id_5'],
      groups: ['group_sys_id_2'],
      manual: false
      }]
      }]
      })