Add service catalog variable to email notification...

Tom L Logan
Mega Expert

I need to pull a service catalog variable on "sc_req_item" table to email notification.  I am reading that the variable first needs to be defined on email script before adding to the email notification which makes sense but I am not sure how to write the mail script.  Can someone help me with this?  The variable name is "Item_Requested".  Thanks. 

1 ACCEPTED SOLUTION

Thanks for all the responses back to my post.  The request changed from adding just one variable to the notification to adding all variables on the catalog item to the notification.  I used the mail script below to achieve that objective.

 

for (var key in current.variables) {        


         var v = current.variables[key];        


         template.print('\n' + v.getGlideObject().getQuestion().getLabel() + ": " + v.getDisplayValue() + " <br />");  
}  

View solution in original post

8 REPLIES 8

Salah2
Tera Contributor

Hi Nishant, 

I am having the same problem, where you able figure out the solution?  Thanks.  

harika26
Tera Contributor

Hi Mekonnen,

I have the same requirement, can you please let me know how did you develop this so that it will be helpful to me.

Thanks.

Hi Nishant,

I have the same requirement, can you please let me know how did you develop this so that it will be helpful to me.

Thanks.

I am using this email script and it is mostly working. Issue is it isn't populating all of my variables. There are a few variables within a variable set and none of those are showing in my email notification and then there are a few more variables attached directly to the catalog item that aren't showing. I did notice that only ten are showing in my email so maybe this use of key limits at ten. Anyone know if that's true or why I wouldn't see every variable? Thanks.