I need a workflow to reject pending access request

Hello, Can this be done automatically after a determinate number of days that the request is Pending?

For example, I make a Request and it is in Pending status, awaiting my manager approval, but after 3 days if manager does not respond means i need to cancel that request

please help me if you have workflow please send logic

@sidharth_tarlapally can you help

Hi @nikhi098

Scheduled Trigger β†’ Get All Pending Access Requests {{baseUrl}}/access-request-approvals/pending β†’ compare difference between created and today β†’ If greater than 3 days β†’ cancel the request {{baseUrl}}/access-requests/cancel

Thanks,
Sid

1 Like

Hi @nikhi098,

As Sidharth mentioned, you can create a workflow and compare the timestamps. For more details, you can refer to the documentation on comparing timestamps here: https://documentation.sailpoint.com/saas/help/workflows/workflow-operators.html#compare-timestamps

Hi sidharth i created accordingly can you check these when i am doing testing cancel access req i am getting error below i am pasting my workflow’
revoke a123.json (4.0 KB)

{
  "version": 1,
  "self": {
    "type": "WORKFLOW",
    "name": "Vishal -  Expire Pending Access Request Workflow"
  },
  "object": {
    "name": "Vishal -  Expire Pending Access Request Workflow",
    "description": "This Vishal -  Expire Pending Access Request Workflow is used to expire the Access request which is pending on the user queue for more than 37 days .",
    "modifiedBy": {
      "type": "IDENTITY",
      "name": "vishal.kejriwal"
    },
    "definition": {
      "start": "Define Variable",
      "steps": {
        "Define Variable": {
          "actionId": "sp:define-variable",
          "attributes": {
            "id": "sp:define-variable",
            "variables": [
              {
                "description": "",
                "name": "daysToExpire",
                "transforms": [
                  {
                    "id": "sp:transform:subtractTime:time",
                    "input": {
                      "length": 37,
                      "unit": "days"
                    }
                  }
                ],
                "variableA.$": "$.now()"
              },
              {
                "description": "",
                "name": "baseUrl",
                "transforms": [],
                "variableA": "devrel-ga-9748.api.identitynow-demo.com"
              },
              {
                "description": "",
                "name": "clientId",
                "transforms": [],
                "variableA": "XXXXXXXXXXXXXXXX"
              }
            ]
          },
          "displayName": "Set environment parameters",
          "nextStep": "HTTP Request",
          "type": "Mutation"
        },
        "Define Variable 1": {
          "actionId": "sp:define-variable",
          "attributes": {
            "id": "sp:define-variable",
            "variables": [
              {
                "description": "",
                "name": "Error",
                "transforms": [],
                "variableA.$": "$.hTTPRequest.error.workflowErrorMessage"
              }
            ]
          },
          "displayName": "Logging Result",
          "nextStep": "End Step β€” Success",
          "type": "Mutation"
        },
        "End Step β€” Success": {
          "actionId": "sp:operator-success",
          "type": "success"
        },
        "HTTP Request": {
          "actionId": "sp:http",
          "attributes": {
            "authenticationType": "OAuth",
            "method": "get",
            "oAuthClientId.$": "$.defineVariable.clientId",
            "oAuthClientSecret": null,
            "oAuthCredentialLocation": "oAuthInHeader",
            "oAuthScope": null,
            "oAuthTokenUrl": "https://{{$.defineVariable.baseUrl}}/oauth/token",
            "url": "https://{{$.defineVariable.baseUrl}}/v2024/access-request-approvals/pending?sorters=created"
          },
          "catch": [
            {
              "next": "Define Variable 1"
            }
          ],
          "displayName": "Get Pending Access Requests",
          "nextStep": "Loop",
          "type": "action",
          "versionNumber": 2
        },
        "Loop": {
          "actionId": "sp:loop:iterator",
          "attributes": {
            "context.$": "$.defineVariable",
            "input.$": "$.hTTPRequest.body",
            "start": "Compare Timestamps",
            "steps": {
              "Compare Timestamps": {
                "actionId": "sp:compare-timestamps",
                "choiceList": [
                  {
                    "comparator": "TimestampLessThanEquals",
                    "nextStep": "Deny Access Request",
                    "variableA.$": "$.loop.loopInput.created",
                    "variableB.$": "$.loop.context.daysToExpire"
                  }
                ],
                "defaultStep": "Define Variable 2",
                "displayName": "",
                "type": "choice"
              },
              "Define Variable 2": {
                "actionId": "sp:define-variable",
                "attributes": {
                  "id": "sp:define-variable",
                  "variables": [
                    {
                      "description": "",
                      "name": "message",
                      "transforms": [],
                      "variableA": "No Expiry"
                    }
                  ]
                },
                "displayName": "Logging Result",
                "nextStep": "End Step - Success",
                "type": "Mutation"
              },
              "Define Variable 3": {
                "actionId": "sp:define-variable",
                "attributes": {
                  "id": "sp:define-variable",
                  "variables": [
                    {
                      "description": "",
                      "name": "error",
                      "transforms": [],
                      "variableA.$": "$.denyAccessRequest.error.workflowErrorMessage"
                    }
                  ]
                },
                "displayName": "Logging Result",
                "nextStep": "End Step - Success",
                "type": "Mutation"
              },
              "Deny Access Request": {
                "actionId": "sp:reject-request",
                "attributes": {
                  "approvalId.$": "$.loop.loopInput.id",
                  "comment": "Triggered by : Vishal - Expire Pending Access Request Workflow\nComments : Approver didn't take any action so request is auto rejected by system."
                },
                "catch": [
                  {
                    "next": "Define Variable 3"
                  }
                ],
                "displayName": "",
                "nextStep": "End Step - Success",
                "type": "action",
                "versionNumber": 1
              },
              "End Step - Success": {
                "actionId": "sp:operator-success",
                "displayName": "",
                "type": "success"
              }
            }
          },
          "description": null,
          "nextStep": "End Step β€” Success",
          "type": "action",
          "versionNumber": 1
        }
      }
    },
    "enabled": false,
    "creator": {
      "type": "IDENTITY",
      "name": "vishal.kejriwal"
    },
    "owner": {
      "type": "IDENTITY",
      "name": "vishal.kejriwal"
    },
    "trigger": {
      "type": "SCHEDULED",
      "attributes": {
        "cronString": "0 4 * * *",
        "dailyTimes": [
          "1969-12-31T10:00:00Z"
        ],
        "frequency": "daily",
        "id": "idn:cron-schedule",
        "timeZone": "America/Chicago"
      }
    }
  }
}
1 Like

HI @vishal_kejriwal1 can you check dm?

HI @nikhi098
auto cancel req.json (5.6 KB)

just add client id and secret and your company name these will full fill your req

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.