Unable to Add Access inside a loop

Hi ,
I am trying to Add Access inside a loop. Same steps I am following without loop it is working fine.
What I wanted to do is I am getting multiple access items , I am passing it inside a loop and till Get Access it is working fine, as soon as I am adding Manage Access and passing the access item it is getting failed.

Any suggestions would be helpful.

FYR this is the input getting passed into loop:

{
  "context": null,
  "context.$": "",
  "input": "ACE Sales Group",
  "start": "Define Variable",
  "steps": {
    "Define Variable": {
      "attributes": {
        "id": "sp:define-variable",
        "variables": [
          {
            "description": "psg2",
            "name": "psg2",
            "transforms": [],
            "variableA.$": "$.loop.loopInput"
          }
        ]
      },
      "displayName": "",
      "nextStep": "Get Access",
      "type": "Mutation"
    },
    "End Step - Success 1": {
      "displayName": "",
      "type": "success"
    },
    "Get Access": {
      "actionId": "sp:access:get",
      "attributes": {
        "accessprofiles": false,
        "entitlements": true,
        "getAccessBy": "searchQuery",
        "query": "name.exact:\"{{$.defineVariable.psg2}}\"",
        "roles": false
      },
      "displayName": "",
      "nextStep": "Manage Access",
      "type": "action",
      "versionNumber": 1
    },
    "Manage Access": {
      "actionId": "sp:access:manage",
      "attributes": {
        "addIdentities.$": "$.getIdentity.id",
        "comments": "Salesforce Access",
        "requestType": "GRANT_ACCESS",
        "requestedItems.$": "$.getAccess.accessItems"
      },
      "displayName": "",
      "nextStep": "End Step - Success 1",
      "type": "action",
      "versionNumber": 1
    }
  },
  "suppliedInlineExpression": {
    "steps": "{\"Define Variable\":{\"attributes\":{\"id\":\"sp:define-variable\",\"variables\":[{\"description\":\"psg2\",\"name\":\"psg2\",\"transforms\":[],\"variableA.$\":\"$.loop.loopInput\"}]},\"displayName\":\"\",\"nextStep\":\"Get Access\",\"type\":\"Mutation\"},\"End Step - Success 1\":{\"displayName\":\"\",\"type\":\"success\"},\"Get Access\":{\"actionId\":\"sp:access:get\",\"attributes\":{\"accessprofiles\":false,\"entitlements\":true,\"getAccessBy\":\"searchQuery\",\"query\":\"name.exact:\\\"{{$.defineVariable.psg2}}\\\"\",\"roles\":false},\"displayName\":\"\",\"nextStep\":\"Manage Access\",\"type\":\"action\",\"versionNumber\":1},\"Manage Access\":{\"actionId\":\"sp:access:manage\",\"attributes\":{\"addIdentities.$\":\"$.getIdentity.id\",\"comments\":\"Salesforce Access\",\"requestType\":\"GRANT_ACCESS\",\"requestedItems.$\":\"$.getAccess.accessItems\"},\"displayName\":\"\",\"nextStep\":\"End Step - Success 1\",\"type\":\"action\",\"versionNumber\":1}}"
  }
}

Thanks

Hi Sikha,

Can you share your workflow json, masking the necessary.

It will be useful to help your case

Thanks,

Can you be sure you’re sending a JSONARRAY or List to the Loop?

Best

Hi @Sgupta1 ,

What is the input provided to the loop? Mostly, the case would the loop input variable used in manage access is not proper.

Please share these details. you can also do a quick verification by adding a send email step in the loop and providing the exact loop variable used in Manage Access step. You can then observe how the value actually translated inside the step.

Regards,
Uday Kilambi

We are passing input in the form of JSONARRAY.
“input”: [
“ABC”,
“DEF”
]

Hi @uday_kilambiCTS , I tried adding Send Email post get Access step, it seems it is fetching the correct value.

There might be parsing issue with Manage access. Replace Manage access with HTTP operation, This worked for me.
Reference : IDN Workflow remove access request

Hi All
We are able to use Add Access and pass it to Manage Access within the loop.
The execution is getting completed but for one entitlement it is getting failed and for one it is getting passed and entitlement getting assigned.

We are getting the below error:

{“error”:“task failed: activity error (type: sp:access:manage, scheduledEventID: 23, startedEventID: 24, identity: 1@sp-workflow-worker-stg-us-east-1-7b6d4548f4-vg9rl@): request failed: 400 - 400 Bad Request: (type: HTTP Response Returned a Client Error, retryable: false): request failed: 400 - 400 Bad Request (type: HTTP Response Returned a Client Error, retryable: false): request failed: 400 - 400 Bad Request: (type: HTTP Response Returned a Client Error, retryable: false): request failed: 400 - 400 Bad Request (type: fundamental, retryable: true)”,“workflowId”:"4e2608e0-a00f-4d1b-8f07-4f237af9ad3d-