- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 08:28 AM
Hello Community,
I'm using an event to trigger an email notification. I'm calling this event from within a workflow Run Script activity. I have pulled values in the workflow and written them to the workflow scratchpad. In the Run Script activity, I have created variables containing the scratchpad values. The 2 values are sys_ids for users. When I pass these values into the event, I need to then use them in a mail_script and I currently cannot do that. Is this even possible?
I read this and it looks like this would work, except it doesn't...
Solved! Go to Solution.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 11:15 AM
Your second option is the correct syntax.
Just to be clear, does the parameter contain just the user's sys_id or does it contain 'User sys_id'? What happens when you add the following logging in?
var userID = event.parm1; //this should be just a sys_id
gs.log('---->User ID from event.parm1: ' + userID);
var gr2 = new GlideRecord('sysapproval_approver');
gr2.addQuery('approver', userID);
gr2.addQuery('state', 'requested');
gr2.query();
gs.log('---->Number of rows returned: ' + gr2.getRowCount());
while(gr2.next()){
gs.log('---->Approval for: ' + gr2.sysapproval.getDisplayValue());
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 09:32 AM
Could you log the user and manager variables in your run script activity and then log the event parameters in your mail script to see if they're being populated correctly?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 10:14 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 11:00 AM
Ok, so we know that the values are being passed correctly into the mail script in that case. I would add more logging to see if any gliderecords are being returned to see where the breakdown in your mail script is.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 11:03 AM
It seems to be at the same point of using the ${event.parm1} in the addQuery line of the GlideRecord. If I change that to current.sys_id or something else, it works.
I've tried...
- ${event.parm1}
- event.parm1
- 'event.parm1'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2014 11:15 AM
Your second option is the correct syntax.
Just to be clear, does the parameter contain just the user's sys_id or does it contain 'User sys_id'? What happens when you add the following logging in?
var userID = event.parm1; //this should be just a sys_id
gs.log('---->User ID from event.parm1: ' + userID);
var gr2 = new GlideRecord('sysapproval_approver');
gr2.addQuery('approver', userID);
gr2.addQuery('state', 'requested');
gr2.query();
gs.log('---->Number of rows returned: ' + gr2.getRowCount());
while(gr2.next()){
gs.log('---->Approval for: ' + gr2.sysapproval.getDisplayValue());
}