- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 12:46 AM
In my requirement, flow designer were created for the catalog item. Now, the Assigned to field is populated with the name of the person that provided the approval.
I tried with the script for assigned to field. But, not working as expected.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 04:09 AM - edited 09-15-2023 04:09 AM
Hi @Deepika43,
Can you please use the below script:
I hope this will solve your problem. Please mark it as Accepted and Helpful.
GoodWill,
Anshul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 03:32 AM
@Ankur Bawiskar
Okay, Let me try your solution as well.
Thanks and Regards
Anshul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 01:55 AM
var app = new GlideRecord('sysapproval_approver');
app.addQuery('sysapproval',current.sys_id);
app.addQuery('state',"approved");
app.query();
if (app.next()){
task.assigned_to = app.approver;
}
tried this too
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 02:23 AM
where in flow have you written the script?
share screenshots.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 02:30 AM
this is catalog task creation so here I added assigned to field with script expanded.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 03:14 AM
do this
var sysId = fd_data.trigger.current.sys_id;
// pick the latest approver
var gr = new GlideRecord("sysapproval_approver");
gr.orderByDesc("sys_updated_on");
gr.addQuery("state","approved");
gr.addQuery("sysapproval", sysId);
gr.setLimit(1);
gr.query();
return gr.approver;
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader