The CreatorCon Call for Content is officially open! Get started here.

Set reference field value from flow designer action

Renu9
Tera Contributor

Hi All,

I am having a sample change requests field (list type) in table A. When the record on table A gets closed, I am triggering a change task to create. I need to populate change request (reference field) value with the values from the sample change requests in table A. As its  a list type, I need to display any one of the sample change request from the list.

Please find the screenshot below. I am getting the sys id of the change request but its not getting set to the change request field on change task. Kindly suggest any changes

find_real_file.png

16 REPLIES 16

Mohit Kaushik
Mega Sage
Mega Sage

Hi Renu,

You can achieve it without scripting also. From the data pill you can just select the change request record.

But to make it work with scripting please write the code as below:

var chngreq = fd_data.trigger.current.change_requests.sys_id; // make sure the backend name of the field which is referring to change request table is correct. (check if it its change_request or change_requests.
return chngreq;

 

Please mark this as correct and helpful if it resolved the query or lead you in right direction.

Thanks,
Mohit Kaushik
Community Rising Star 2022

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

Hi @Mohit Kaushik ,

 

I am unable to select the Sample change requests field from the datapill ,.It is disabled.

And with the script also I dint work.

Are you passing the field name correctly?

What is trigger record for flow? and does that flow have a field named change_requests?

Please confirm these three things.

 

Thanks,

Mohit Kaushik

Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)

You don't even require to use sys_id in the code, it can end at here as well.

var chngreq = fd_data.trigger.current.change_request; // make sure the backend name of the field which is referring to change request table is correct. (check if it its change_request or change_requests.
return chngreq;
Thanks,
Mohit Kaushik
ServiceNow MVP (2023-2025)