Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Flow designer custom action script include to return approver record

ClareM
Tera Expert

Hi,

I have created a custom action which calls a script include to retrieve an approver sys_id.

I can see from the logs that the sys_id is being returned however the approver record doesn't appear to be found.

I understand from looking at a post from @petercawdron  that an approval record can be returned from a sys_id and then used in an Ask for Approval step.

I'm not sure if my outputs are not configured correctly or if I have missed something.

ClareM_0-1697117020930.png

ClareM_1-1697117145046.png

ClareM_2-1697117209013.png

Any help appreciated, thank you!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@ClareM 

output variable is of type Reference and can hold only 1 value

I believe you are storing multiple approvers in it.

So you should use Type-> Array of objects instead of reference

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@ClareM 

output variable is of type Reference and can hold only 1 value

I believe you are storing multiple approvers in it.

So you should use Type-> Array of objects instead of reference

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Actually, the approver is a single sys_id and it didn't seem possible to use the array.object with the Ask for Approval. So should I change the variable type in my script include from array to string, and should the output variable and action output both be of type reference.sys_user? Thanks