Issue setting an Action output of type Object

Community Alums
Not applicable

Greetings, 

 

In order to make an API call I need to create an Object of Objects to pass into the API call. Ex, it would look something like this where I am creating an accessProfiles object that consists of 2 access profiles.

 

"accessProfiles": [
{
"id": "ff808081751e6e129f1518161919ecca",
"type": "ACCESS_PROFILE",
"name": "Access Profile 2567"
},
{
"id": "ff808081751e6e129f1518161919eccb",
"type": "ACCESS_PROFILE",
"name": "Access Profile 2568"
}
]

 

The input to my action is nothing more than 1 or more of these access profiles which in exist in our instance in a custom table. 

 

Then I have the following script step that is creating this array of access profile objects. I am then attempting to stuff this array into an output object. 

 

ChrisDoernbrac_1-1732733039126.png

 

I added a couple of logging statements to view the array and to also view the final object. Those look as expected. 

 

Profiles Object: {"accessProfiles":[{"id":"2c9180857b37101c017b3b824d29135b","name":"SN.01 Test AD Group - auto provisioning (NA Domain)","type":"ACCESS_PROFILE"},{"id":"c027b0bd20dc4606a4d2b5eef388f36a","name":"OneSource (Admin & API Admin) - Identity and Access Administrator Role Sandbox","type":"ACCESS_PROFILE"}]}

 

Outputs Object: {"accessProfiles":[{"id":"2c9180857b37101c017b3b824d29135b","name":"SN.01 Test AD Group - auto provisioning (NA Domain)","type":"ACCESS_PROFILE"},{"id":"c027b0bd20dc4606a4d2b5eef388f36a","name":"OneSource (Admin & API Admin) - Identity and Access Administrator Role Sandbox","type":"ACCESS_PROFILE"}]}

 

The problem is that when I look at the flow result the output variable, access_object, is empty. 

 

ChrisDoernbrac_2-1732733142002.png

 

What I am doing wrong when trying to assign this Object of objects to the output?

4 REPLIES 4

Nick Parsons
Mega Sage

This would happen if you didn't define your child output items correctly. Make sure you use the "Add child item" button to define your output structure, the "name" column is the important thing and is what should match with your output object:

NickParsons_0-1732755364935.png

 

Peter26
Tera Expert

Is there any way to just pass the object itself without having to elaborate its inner structure in this way? I have several Custom Action use cases where the structure of an object-type Output Variable is unknown until runtime, so hard-coding the structure like this won't work. I can work around this by converting the object to a string, but that adds a lot of extra unnecessary, duplicative processing and steps.

Medi C
Giga Sage

Probably the output are not mapped in the Output section highlighted below:

MediC_0-1741383908826.png

 


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

Hi Medi,

 

The Script Step Output Values are mapped to Action Output Values via data pills. It seems the problem is more fundamental -- Custom Action Input and Output Variables are always converted to string type values, no matter how they're originally set, as per this article (also, see image from the article below):

https://www.servicenow.com/docs/bundle/yokohama-build-workflows/page/administer/flow-designer/refere...

 

Peter26_0-1741387212649.png