{
  "created": "2026-11-06T23:28:38.15438682Z",
  "modified": "2026-11-07T18:53:32.903060687Z",
  "modifiedBy": {
    "type": "IDENTITY",
    "id": "{admin-id}",
    "name": "{admin-name}"
  },
  "definition": {
    "start": "Define Variable",
    "steps": {
      "Define Comparison": {
        "actionId": "sp:compare-multi-type",
        "choiceList": [
          {
            "comparator": "NumericGreaterThan",
            "nextStep": "Serial Loop",
            "variableA.$": "$.hTTPRequest.body.length()",
            "variableB": 0
          }
        ],
        "defaultStep": "End Step - Success",
        "displayName": "Check If Entitlements Returned",
        "type": "choice"
      },
      "Define Comparison 9": {
        "actionId": "sp:compare-multi-type",
        "choiceList": [
          {
            "comparator": "NumericEquals",
            "nextStep": "HTTP Request 8",
            "variableA.$": "$.hTTPRequest.body.length()",
            "variableB": 250
          }
        ],
        "defaultStep": "End Step - Success 15",
        "displayName": "Check If Full Page Returned",
        "type": "choice"
      },
      "Define Variable": {
        "actionId": "sp:define-variable",
        "attributes": {
          "id": "sp:define-variable",
          "variables": [
            {
              "description": "Next page offset",
              "name": "newOffset",
              "transforms": [
                {
                  "id": "sp:transform:add:number",
                  "input": {
                    "precision": 4,
                    "roundingMode": "roundHalfUp",
                    "variableB": 250
                  }
                }
              ],
              "variableA.$": "$.trigger.currentOffset"
            }
          ]
        },
        "displayName": "Calculate Next Offset",
        "nextStep": "HTTP Request",
        "type": "Mutation"
      },
      "End Step - Success": {
        "actionId": "sp:operator-success",
        "displayName": "Empty Page - Done",
        "type": "success"
      },
      "End Step - Success 14": {
        "actionId": "sp:operator-success",
        "displayName": "Next Page Dispatched",
        "type": "success"
      },
      "End Step - Success 15": {
        "actionId": "sp:operator-success",
        "displayName": "Final Page Complete",
        "type": "success"
      },
      "HTTP Request": {
        "actionId": "sp:http",
        "attributes": {
          "method": "get",
          "param_authenticationRef": "oauth",
          "param_oauth": {
            "mapping": {
              "auth_client_id": "clientId",
              "auth_client_secret": "clientSecret",
              "auth_credential_location": "credentialLocation",
              "auth_token_url": "tokenURL"
            },
            "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
            "paramType": "1.4",
            "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
          },
          "param_oauth_scopes": {
            "mapping": {
              "auth_scopes": "scopes"
            },
            "paramID": "",
            "paramType": "3.1"
          },
          "requestContentType": "json",
          "url": "https://<TENANT>.api.identitynow.com/entitlements/v1",
          "urlParams": {
            "filters": "source.id eq \"{{$.trigger.sourceId}}\"",
            "limit": "250",
            "offset": "{{$.trigger.currentOffset}}",
            "sorters": "id"
          }
        },
        "displayName": "Get Entitlements Page",
        "nextStep": "Define Comparison",
        "type": "action",
        "versionNumber": 3
      },
      "HTTP Request 8": {
        "actionId": "sp:http",
        "attributes": {
          "jsonRequestBody": {
            "accountAttribute": "{{$.trigger.accountAttribute}}",
            "currentOffset": "{{$.defineVariable.newOffset}}",
            "destinationAttribute": "{{$.trigger.destinationAttribute}}",
            "entitlementAttribute": "{{$.trigger.entitlementAttribute}}",
            "limit": 250,
            "sourceId": "{{$.trigger.sourceId}}",
            "sourceName": "{{$.trigger.sourceName}}"
          },
          "method": "post",
          "param_authenticationRef": "oauth",
          "param_oauth": {
            "mapping": {
              "auth_client_id": "clientId",
              "auth_client_secret": "clientSecret",
              "auth_credential_location": "credentialLocation",
              "auth_token_url": "tokenURL"
            },
            "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
            "paramType": "1.4",
            "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
          },
          "param_oauth_scopes": {
            "mapping": {
              "auth_scopes": "scopes"
            },
            "paramID": "",
            "paramType": "3.1"
          },
          "requestContentType": "json",
          "url": "https://<TENANT>.api.identitynow.com/workflows/v1/execute/external/<PAGINATION_WORKER_WORKFLOW_ID>"
        },
        "displayName": "Recall Worker For Next Page",
        "nextStep": "End Step - Success 14",
        "type": "action",
        "versionNumber": 3
      },
      "Serial Loop": {
        "actionId": "sp:serial:iterator",
        "attributes": {
          "input.$": "$.hTTPRequest.body",
          "loopType": "forLoop",
          "start": "Define Variable 1",
          "steps": {
            "Define Comparison 1": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "OR": [
                    {
                      "comparator": "StringEquals",
                      "variableA.$": "$.defineVariable1.extractedValue",
                      "variableB.$": "$.defineVariable1.rawAttributesJson"
                    },
                    {
                      "comparator": "StringEquals",
                      "variableA.$": "$.defineVariable1.extractedValue",
                      "variableB": ""
                    }
                  ],
                  "nextStep": "End Step - Success 1"
                }
              ],
              "defaultStep": "Define Comparison 2",
              "displayName": "Check If Attribute Is Empty Or Missing",
              "type": "choice"
            },
            "Define Comparison 10": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "BooleanEquals",
                  "nextStep": "HTTP Request 3",
                  "variableA.$": "$.loop.loopInput.requestable",
                  "variableB": true
                }
              ],
              "defaultStep": "End Step - Success 8",
              "displayName": "Check If Currently Requestable",
              "type": "choice"
            },
            "Define Comparison 11": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "OR": [
                    {
                      "comparator": "StringEquals",
                      "variableA.$": "$.trigger.destinationAttribute",
                      "variableB": "Owner"
                    },
                    {
                      "comparator": "StringEquals",
                      "variableA.$": "$.trigger.destinationAttribute",
                      "variableB": "AdditionalOwners"
                    }
                  ],
                  "nextStep": "HTTP Request 5"
                }
              ],
              "defaultStep": "End Step - Success 10",
              "displayName": "Is Destination Owner Or AdditionalOwners?",
              "type": "choice"
            },
            "Define Comparison 12": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "NumericGreaterThan",
                  "nextStep": "Define Comparison 13",
                  "variableA.$": "$.hTTPRequest5.body.length()",
                  "variableB": 0
                }
              ],
              "defaultStep": "End Step - Success 11",
              "displayName": "Check If Owner Identity Found",
              "type": "choice"
            },
            "Define Comparison 13": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "StringEquals",
                  "nextStep": "HTTP Request 6",
                  "variableA.$": "$.trigger.destinationAttribute",
                  "variableB": "Owner"
                }
              ],
              "defaultStep": "HTTP Request 7",
              "displayName": "Is Destination Primary Owner?",
              "type": "choice"
            },
            "Define Comparison 2": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "StringEquals",
                  "nextStep": "Define Comparison 3",
                  "variableA.$": "$.trigger.destinationAttribute",
                  "variableB": "Description"
                }
              ],
              "defaultStep": "Define Comparison 4",
              "displayName": "Is Destination Description?",
              "type": "choice"
            },
            "Define Comparison 3": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "NOT": {
                    "comparator": "StringEquals",
                    "variableA.$": "$.loop.loopInput.description",
                    "variableB.$": "$.defineVariable1.extractedValue"
                  },
                  "nextStep": "HTTP Request 1"
                }
              ],
              "defaultStep": "End Step - Success 3",
              "displayName": "Check If Description Changed",
              "type": "choice"
            },
            "Define Comparison 4": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "StringEquals",
                  "nextStep": "Define Comparison 5",
                  "variableA.$": "$.trigger.destinationAttribute",
                  "variableB": "Requestable"
                }
              ],
              "defaultStep": "Define Comparison 7",
              "displayName": "Is Destination Requestable?",
              "type": "choice"
            },
            "Define Comparison 5": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "StringEquals",
                  "nextStep": "Define Comparison 6",
                  "variableA.$": "$.defineVariable1.extractedValue",
                  "variableB": "true"
                }
              ],
              "defaultStep": "Define Comparison 8",
              "displayName": "Is Target Requestable True?",
              "type": "choice"
            },
            "Define Comparison 6": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "BooleanEquals",
                  "nextStep": "HTTP Request 2",
                  "variableA.$": "$.loop.loopInput.requestable",
                  "variableB": false
                }
              ],
              "defaultStep": "End Step - Success 5",
              "displayName": "Check If Not Already Requestable",
              "type": "choice"
            },
            "Define Comparison 7": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "StringEquals",
                  "nextStep": "HTTP Request 4",
                  "variableA.$": "$.trigger.destinationAttribute",
                  "variableB": "Tags"
                }
              ],
              "defaultStep": "Define Comparison 11",
              "displayName": "Is Destination Tags?",
              "type": "choice"
            },
            "Define Comparison 8": {
              "actionId": "sp:compare-multi-type",
              "choiceList": [
                {
                  "comparator": "StringEquals",
                  "nextStep": "Define Comparison 10",
                  "variableA.$": "$.defineVariable1.extractedValue",
                  "variableB": "false"
                }
              ],
              "defaultStep": "End Step - Success 6",
              "displayName": "Is Target Requestable False?",
              "type": "choice"
            },
            "Define Variable 1": {
              "actionId": "sp:define-variable",
              "attributes": {
                "id": "sp:define-variable",
                "variables": [
                  {
                    "description": "Raw serialized attributes map",
                    "name": "rawAttributesJson",
                    "transforms": [],
                    "variableA": "{{$.loop.loopInput.attributes.JSON()}}"
                  },
                  {
                    "description": "Dynamically extracted attribute value",
                    "name": "extractedValue",
                    "transforms": [
                      {
                        "id": "sp:transform:replace:string",
                        "input": {
                          "pattern": "^.*\"{{$.trigger.entitlementAttribute}}\"\\s*:\\s*\"([^\"]*)\".*$",
                          "replacement": "$1"
                        }
                      }
                    ],
                    "variableA": "{{$.loop.loopInput.attributes.JSON()}}"
                  }
                ]
              },
              "displayName": "Extract Target Entitlement Attribute",
              "nextStep": "Define Comparison 1",
              "type": "Mutation"
            },
            "End Step - Success 1": {
              "actionId": "sp:operator-success",
              "displayName": "Attribute Empty - Skip",
              "type": "success"
            },
            "End Step - Success 10": {
              "actionId": "sp:operator-success",
              "displayName": "Unknown Destination",
              "type": "success"
            },
            "End Step - Success 11": {
              "actionId": "sp:operator-success",
              "displayName": "Owner Identity Not Found",
              "type": "success"
            },
            "End Step - Success 12": {
              "actionId": "sp:operator-success",
              "displayName": "Primary Owner Updated",
              "type": "success"
            },
            "End Step - Success 13": {
              "actionId": "sp:operator-success",
              "displayName": "Additional Owners Updated",
              "type": "success"
            },
            "End Step - Success 2": {
              "actionId": "sp:operator-success",
              "displayName": "Description Updated",
              "type": "success"
            },
            "End Step - Success 3": {
              "actionId": "sp:operator-success",
              "displayName": "Description Unchanged",
              "type": "success"
            },
            "End Step - Success 4": {
              "actionId": "sp:operator-success",
              "displayName": "Requestable Set True",
              "type": "success"
            },
            "End Step - Success 5": {
              "actionId": "sp:operator-success",
              "displayName": "Already Requestable",
              "type": "success"
            },
            "End Step - Success 6": {
              "actionId": "sp:operator-success",
              "displayName": "Invalid Requestable Flag",
              "type": "success"
            },
            "End Step - Success 7": {
              "actionId": "sp:operator-success",
              "displayName": "Requestable Set False",
              "type": "success"
            },
            "End Step - Success 8": {
              "actionId": "sp:operator-success",
              "displayName": "Already Not Requestable",
              "type": "success"
            },
            "End Step - Success 9": {
              "actionId": "sp:operator-success",
              "displayName": "Tag Updated",
              "type": "success"
            },
            "HTTP Request 1": {
              "actionId": "sp:http",
              "attributes": {
                "jsonPatchRequestBody": [
                  {
                    "op": "replace",
                    "path": "/description",
                    "value": "{{$.defineVariable1.extractedValue}}"
                  },
                  {
                    "op": "replace",
                    "path": "/manuallyUpdatedFields",
                    "value": {
                      "DESCRIPTION": true,
                      "DISPLAY_NAME": false
                    }
                  }
                ],
                "method": "patch",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json-patch+json",
                "url": "https://<TENANT>.api.identitynow.com/entitlements/v1/{{$.loop.loopInput.id}}"
              },
              "displayName": "Patch Entitlement Description",
              "nextStep": "End Step - Success 2",
              "type": "action",
              "versionNumber": 3
            },
            "HTTP Request 2": {
              "actionId": "sp:http",
              "attributes": {
                "jsonPatchRequestBody": [
                  {
                    "op": "replace",
                    "path": "/requestable",
                    "value": true
                  }
                ],
                "method": "patch",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json-patch+json",
                "url": "https://<TENANT>.api.identitynow.com/entitlements/v1/{{$.loop.loopInput.id}}"
              },
              "displayName": "Patch Requestable To True",
              "nextStep": "End Step - Success 4",
              "type": "action",
              "versionNumber": 3
            },
            "HTTP Request 3": {
              "actionId": "sp:http",
              "attributes": {
                "jsonPatchRequestBody": [
                  {
                    "op": "replace",
                    "path": "/requestable",
                    "value": false
                  }
                ],
                "method": "patch",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json-patch+json",
                "url": "https://<TENANT>.api.identitynow.com/entitlements/v1/{{$.loop.loopInput.id}}"
              },
              "displayName": "Patch Requestable To False",
              "nextStep": "End Step - Success 7",
              "type": "action",
              "versionNumber": 3
            },
            "HTTP Request 4": {
              "actionId": "sp:http",
              "attributes": {
                "jsonRequestBody": {
                  "objectRef": {
                    "id": "{{$.loop.loopInput.id}}",
                    "name": "{{$.loop.loopInput.name}}",
                    "type": "ENTITLEMENT"
                  },
                  "tags": [
                    "{{$.defineVariable1.extractedValue}}"
                  ]
                },
                "method": "put",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json",
                "url": "https://<TENANT>.api.identitynow.com/tagged-objects/v1/ENTITLEMENT/{{$.loop.loopInput.id}}"
              },
              "displayName": "Put Tag On Entitlement",
              "nextStep": "End Step - Success 9",
              "type": "action",
              "versionNumber": 3
            },
            "HTTP Request 5": {
              "actionId": "sp:http",
              "attributes": {
                "jsonRequestBody": {
                  "indices": [
                    "identities"
                  ],
                  "query": {
                    "query": "attributes.{{$.trigger.accountAttribute}}:{{$.defineVariable1.extractedValue}}"
                  }
                },
                "method": "post",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json",
                "url": "https://<TENANT>.api.identitynow.com/search/v1",
                "urlParams": {
                  "limit": "1"
                }
              },
              "displayName": "Search Identity For Owner Mapping",
              "nextStep": "Define Comparison 12",
              "type": "action",
              "versionNumber": 3
            },
            "HTTP Request 6": {
              "actionId": "sp:http",
              "attributes": {
                "jsonPatchRequestBody": [
                  {
                    "op": "replace",
                    "path": "/owner",
                    "value": {
                      "id": "{{$.hTTPRequest5.body[0].id}}",
                      "name": "{{$.hTTPRequest5.body[0].name}}",
                      "type": "IDENTITY"
                    }
                  }
                ],
                "method": "patch",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json-patch+json",
                "url": "https://<TENANT>.api.identitynow.com/entitlements/v1/{{$.loop.loopInput.id}}"
              },
              "displayName": "Patch Entitlement Primary Owner",
              "nextStep": "End Step - Success 12",
              "type": "action",
              "versionNumber": 3
            },
            "HTTP Request 7": {
              "actionId": "sp:http",
              "attributes": {
                "jsonPatchRequestBody": [
                  {
                    "op": "replace",
                    "path": "/additionalOwners",
                    "value": [
                      {
                        "id": "{{$.hTTPRequest5.body[0].id}}",
                        "name": "{{$.hTTPRequest5.body[0].name}}",
                        "type": "IDENTITY"
                      }
                    ]
                  }
                ],
                "method": "patch",
                "param_authenticationRef": "oauth",
                "param_oauth": {
                  "mapping": {
                    "auth_client_id": "clientId",
                    "auth_client_secret": "clientSecret",
                    "auth_credential_location": "credentialLocation",
                    "auth_token_url": "tokenURL"
                  },
                  "paramID": "<YOUR_PARAMETER_STORAGE_ID>",
                  "paramType": "1.4",
                  "refID": "217ad438-35bb-469f-91df-c3f08154f87d"
                },
                "param_oauth_scopes": {
                  "mapping": {
                    "auth_scopes": "scopes"
                  },
                  "paramID": "",
                  "paramType": "3.1"
                },
                "requestContentType": "json-patch+json",
                "url": "https://<TENANT>.api.identitynow.com/entitlements/v1/{{$.loop.loopInput.id}}"
              },
              "displayName": "Patch Entitlement Additional Owners",
              "nextStep": "End Step - Success 13",
              "type": "action",
              "versionNumber": 3
            }
          }
        },
        "displayName": "Loop Over Entitlements Page",
        "nextStep": "Define Comparison 9",
        "type": "action",
        "versionNumber": 1
      }
    }
  },
  "owner": {
    "type": "IDENTITY",
    "id": "{admin-id}",
    "name": "{admin-name}"
  },
  "trigger": {
    "type": "EXTERNAL",
    "attributes": {
      "clientId": "<YOUR_TRIGGER_CLIENT_ID>",
      "description": "Triggered per mapping rule or recursively per page of entitlements",
      "id": "idn:external-http",
      "integrationId": null,
      "name": "entitlement-metadata-worker",
      "url": "/workflows/v1/execute/external/<PAGINATION_WORKER_WORKFLOW_ID>"
    }
  },
  "creator": {
    "type": "IDENTITY",
    "id": "{admin-id}",
    "name": "{admin-name}"
  },
  "id": "<PAGINATION_WORKER_WORKFLOW_ID>",
  "name": "Entitlement Metadata Sync - Pagination Worker",
  "description": "Paginated worker workflow that extracts entitlement attributes and updates governance metadata (Description, Owner, AdditionalOwners, Requestable, Tags) across pages of entitlements.",
  "executionCount": 0,
  "failureCount": 0,
  "enabled": true
}
