- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2023 02:32 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2023 07:50 PM
Hi @terryreints ,
The sys_id is the record that you put into the step Ask for approval.
Because your case is to update the RITM's comment. So the script should be located also in this step.
We need to replace the part after fd_data from the script to the record sys_id that we get approvals.
Ex: if you're requesting for approval from a Catalog task (37), it will be something like "fd_data._37__create_record.record.sys_id.toString()"
/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**Order number is offset by +1 in Error Handling Section.
**Available options display upon pressing "." after fd_data
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
var recordID = fd_data.<the_step_to_get_record_sys_id>.sys_id.toString(); //Replace your record id in the flow
var grApprover = new GlideRecord('sysapproval_approver');
grApprover.addQuery('document_id', recordID);
grApprover.addQuery('state', 'approved').addOrCondition('state', 'rejected');
grApprover.query();
if(grApprover.next()){
return grApprover.getValue('approver');
}
You can also refer to the below docs for more detail about scripting in flow designer.
Inline scripts
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2023 07:40 PM - edited ‎10-17-2023 07:42 PM
Hi @terryreints
The issue is just related to auto completion/suggestions scripts. If you write the correct syntax it should work anyway.
Let's try the below approach as well. We don't need to wait.
1. Create new Flow Action. Define the Input and Add the Script step
2. Define the Input Variables and put the function into the Script box.
Also remember to define the output for the function
3. Lastly, define Action Output and drop the Approver output from the function into it.
You can also create your own flow action with configuration only by using Look Up Record step instead of Script step.
Let me know if it works for you
Cheers,
Tai Vu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2023 09:32 PM
HI @terryreints ,
You can find all the records in "sysapproval_approver" table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-12-2023 09:40 PM - edited ‎10-12-2023 09:43 PM
Hi @terryreints
You can use the action Look Up to the table "Approvals [sysapproval_approver]" after the Ask for approval action.
Or you can try the below script on where you need the information of the Approver.
var recordID = fd_data.trigger.current.sys_id.toString(); //Replace your record id in the flow
var grApprover = new GlideRecord('sysapproval_approver');
grApprover.addQuery('document_id', recordID);
grApprover.addQuery('state', 'approved').addOrCondition('state', 'rejected');
grApprover.query();
if(grApprover.next()){
return grApprover.getValue('approver');
}
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2023 08:40 AM
Tai,
What should I use for the sys_id? Is it the sc_task record?
I'm not sure how to script this to get the sys_id. Could you provide a script for that?
My goal is to update the RITM's comment stream in action #44 below to show who processed the approval.
Thank you,
Terry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-15-2023 07:50 PM
Hi @terryreints ,
The sys_id is the record that you put into the step Ask for approval.
Because your case is to update the RITM's comment. So the script should be located also in this step.
We need to replace the part after fd_data from the script to the record sys_id that we get approvals.
Ex: if you're requesting for approval from a Catalog task (37), it will be something like "fd_data._37__create_record.record.sys_id.toString()"
/*
**Access Flow/Action data using the fd_data object. Script must return a value.
**Order number is offset by +1 in Error Handling Section.
**Available options display upon pressing "." after fd_data
**example: var shortDesc = fd_data.trigger.current.short_description;
**return shortDesc;
*/
var recordID = fd_data.<the_step_to_get_record_sys_id>.sys_id.toString(); //Replace your record id in the flow
var grApprover = new GlideRecord('sysapproval_approver');
grApprover.addQuery('document_id', recordID);
grApprover.addQuery('state', 'approved').addOrCondition('state', 'rejected');
grApprover.query();
if(grApprover.next()){
return grApprover.getValue('approver');
}
You can also refer to the below docs for more detail about scripting in flow designer.
Inline scripts
Cheers,
Tai Vu