
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 10:44 AM
Is there a way RITM number to use in a script during the workflow? I know its available in the workflow as I can use it in a mail script during the workflow.
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 07:23 PM
Hi Brian,
The field name that you are referring to is incorrect. The label is Approval for but field name is 'sysapproval'
try using the below code instead, it will work.
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('sysapproval', current.sys_id);
gr.addQuery('state', 'approved');
gr.query();
If this resolves the issue, then please mark it answered and close the thread.
Thanks,
Avneet

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 10:58 AM
I'm not sure what you're looking for specifically, but the RITM number should be available to any script within its corresponding workflow simply by calling 'current.number'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 01:01 PM
We are tying to query the sysapproval_approver table go the the approver. We are trying this but are still getting 300 records back but we should only have one. There could be 2 approvers for the RITM but only one has to approve.
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('approval_for', current.number);
gr.addQuery('state', 'approved');
gr.query();
while(gr.next()) {
var approver = gr.approver;
workflow.scratchpad.approved_by = approver;
gs.log('Approved by : ' + approver);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 01:04 PM
Since you're dealing with sys_id values, I think you want 'current.sys_id' instead of 'current.number'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 04:31 PM
That is still pulling 300 + records