Workflow HTTP Request - Identity Attribute Variable Insertion

I have created a workflow that uses the HTTP Request Action to create ServiceNow REQ’s. I have noticed that when trying to pass an identity attribute in the body of the HTTP Request, it is showing the variable name instead of the actual value:

{{$.trigger.identity.attributes.firstname}}

Here is the body of the request:

              "jsonRequestBody": {
                "items": [
                  {
                    "sysparm_id": "samplesysparmid545",
                    "variables": {
                      "description": " SailPoint Department Name Change",
                      "opened_by": "test1234567",
                      "req_description": "Service Request created by SailPoint ",
                      "requested_for": "test123456",
                      "short_description": "SailPoint Access Request Change in Department Name {{$.trigger.identity.attributes.firstname}}"
                    }
                  }
                ]
              }

When i change the variable name to: {{$.trigger.identity.name}}, that gets displayed properly in the ServiceNow REQ, but i need to be able to use different identity attribute values on the triggered identity.

There must be a different way you need to set identity attribute values when using a nested json object.

Hello @jacobg241,

Welcome back to the Developer Community :slight_smile:

What is the trigger used for this? Typically, all of the identity attributes are not available in the trigger. To get around this, you can use a “Get Identity” node after the trigger to fetch all of the identity attributes while passing in the $.trigger.identity.id.

Once that node is in place you can use $.getIdentity.attributes.firstname in the request body.

Check out the trigger documentation for sample JSON for what is provided by each trigger.

2 Likes

Hey Braden,

I have included a new Get Identity Action and that did the trick.

Thank you!

1 Like

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