How to Show catalog item variables on email notifications

Chaitanya Redd1
Tera Guru

Hello Team,

I need help how to show variables which added on catalog form through email notification. As shown below all that variables has to show on email notification. I have tried by creating Script Include.

find_real_file.png

Thanks,

JRY

1 ACCEPTED SOLUTION

Hi,

I have updated code as below and it worked for me

can you update these 2 lines

var value = current.variables.software_selection.toString(); // give proper variable name here

var parser = JSON.parse(value);

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

19 REPLIES 19

Yes, notification is on sc_req_item table only. Don't know why it's not working you can see below notification 

find_real_file.png

 

Thanks,

JRY

Hi,

please verify mail script name is correct?

please update code as below;

1) I have used toString()

2) remove JSON.stringify()

(function runMailScript(current, template, email, email_action, event) {

          // Add your code here

var value = current.variables.software_selection.toString(); // give proper variable name here

var parser = JSON.parse(value);

for(var i=0;i<parser.length;i++){

template.print('Software name is: ' + parser[i].software); // give proper variable name here

template.print('Option is: ' + parser[i].add_remove); // give proper variable name here

}

})(current, template, email, email_action, event);

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

I have checked each and every and again tried your new script but no luck it's still not showing the values on notification.

Thanks,

JRY

Hi,

I have updated code as below and it worked for me

can you update these 2 lines

var value = current.variables.software_selection.toString(); // give proper variable name here

var parser = JSON.parse(value);

If my answer solved your issue, please mark my answer as Correct & 👍Helpful based on the Impact.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

Thanks for help, but still I can't see.

find_real_file.png

Thanks,

JRY