- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 07:46 AM
I have the below RITM workflow script that does a query on the u_semi_annual_audit_applications table and when the RITM application field matches up with table application, I want to get the table approver, which is a sys_user field and copy it to the RITM semi_annual_audit_approver field which is also a sys_user fields. Below is my script, but it's not working. Any help would be appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 07:52 AM
@chrish5 Could you please update the script as follows and see if it works.
var gr = new GlideRecord('u_semi_annual_audit_applications');
gr.addQuery('u_application',current.variables.application+'');
gr.query();
if (gr.next()){
current.variables.semi_annual_audit_approver = gr.u_approver+'';
}
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 07:52 AM
@chrish5 Could you please update the script as follows and see if it works.
var gr = new GlideRecord('u_semi_annual_audit_applications');
gr.addQuery('u_application',current.variables.application+'');
gr.query();
if (gr.next()){
current.variables.semi_annual_audit_approver = gr.u_approver+'';
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 07:59 AM
@Sandeep Rajput's code should work. Your problem is the use of the "==" comparison operator instead of the "=" assignment operator. Your code should be throwing an error in the logs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 07:59 AM
I could be wrong, but I don't think you wanna use the "==" operator when assigning a value...you may be successful just changing the line to "current.variables.semi_annual_audit_approver = gr.u_approver;".
If not, maybe try using some intermediate variables and alerts to debug...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-22-2024 09:47 AM
Remember to mark any posts as helpful as well. Whereas Sandeep's answer worked for you, it does nothing to teach people anything. It's always helpful to understand the solution. I hate "do this" answers.