
- 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 05:35 PM
Like Mark was saying, if you change the line
gr.addQuery('approval_for', current.number)
to
gr.addQuery('approval_for', current.sys_id)
then it should work.
From what I have seen, if you put in a query that doesn't quite work, GlideRecord will bring back a lot more records than you want.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 05:41 PM
As in my previous replay chaining it to current.sys_id still returned 300+ records.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 05:45 PM
Is that by chance tied to the looping workflow you were asking about on the other thread? Maybe something is wrong there.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 05:47 PM
no this is a completely different workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 09:18 PM
Try this...
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('document_id', current.sys_id);
gr.addQuery('state', 'approved');
gr.query();
while(gr.next()) {
var approver = gr.approver;
workflow.scratchpad.approved_by = approver;
gs.log('Approved by : ' + approver);
}