- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 12:54 PM
I've been trying to figure out what's wrong with this notification script but I'm out of ideas.
The notification is firing from the sc_req_item table. I can get the fullname to appear by itself by removing line 9 and 13 but once I add the lines, I get the error "undefined' for both entries in the notification.
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.sys_id);
gr.query();
var fullName;
var user_id;
while(gr.next()) {
fullName = gr.variables.ob_fullname;
user_id = gr.variables.ob_username;
}
template.print(fullName);
template.print(user_id);
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:46 PM
sorry i missed that looks good..
try adding
template.print('ticket number is ' );
template.print(gr.number);
and see if you get the request number on the field..
also are these variables on the REQUEST or on the requested item.. unless you have modified the variables they should be on requested item.. and then you can skip the query and just do
act
template.print(current.variables.ob_fullname);
template.print(current.variables.ob_username);
actually you shouldn't need a script for this at all... if the variables are on the requested item you can use curent.variables in the notification.... if they are on request you can use current.request.varible_name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:07 PM
1) what table is your notification script running on?
2) can i assum ob_fullname and ob_username are text fields on the catalog item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:12 PM
1) I believe it's running on the same table but there's no table option for email scripts.
2) They are both string fields that are filled.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:16 PM
sorry i phrased my q badly.. what table is the notification that runs the script running off of ... is it requested items or approvals.. or something else?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2016 01:26 PM
It's running on the requested item table per the original post.