Set reference field value from flow designer action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2022 05:56 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2022 06:05 AM
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
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2022 06:21 AM
Hi
I am unable to select the Sample change requests field from the datapill ,.It is disabled.
And with the script also I dint work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2022 06:25 AM
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
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-16-2022 06:47 AM
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;
Mohit Kaushik
ServiceNow MVP (2023-2025)