- 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 12:56 AM
Hello @Deepika43,
Kindly share your script.
Thanks and Regards,
Anshul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 01:26 AM
// Get the name of the approver
var approverName = gs.getUserName();
// Get the current task (you may need to customize this based on your workflow)
var currentTask = current;
// Set the Assigned To field to the approver's name
currentTask.assigned_to = approverName;
// Update the task
currentTask.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 02:39 AM
Hi @Deepika43,
Use the below script in the Custom Action in Flow Designer:
var approverRef = new GlideRecord("sysapproval_approver");
approverRef.addQuery("state", "approved");
approverRef.addQuery("document_id", inputs.ritmSysID);
approverRef.query();
if (approverRef.next()) {
outputs.approveduser = approverRef.approver;
}
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:23 AM
Custom action is not necessary here.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader