- 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-17-2023 01:56 PM
Tai,
That is very helpful! Thank you.
Unfortunately, we are on Utah Patch 7 and the Flow Designer script editor's fd_data dot walking is broken. I was told by support, "...this issue (PRB1696950) and unfortunately there are no workarounds at this time. The good news is that it is fixed in our next patch for Utah (patch 😎 and Vancouver (patch 3) available after 10/26."
I will upgrade and try your solution soon after that.
Terry
- 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-20-2023 02:21 PM
Tai,
Your solution is exactly what I needed.
Thank you so much!
Terry