How can I write a Email script to use a system property in email notification content?

Pritam_Pawar225
Tera Contributor

I have one system property "change_request.autoclose.time" which states that Number of days (integer) after which Reviewed change request are automatically closed. Zero (0) disable this feature. How the  Email script will be to use this in my email body content 

1 ACCEPTED SOLUTION

Kiranmai_KVL
Kilo Sage

Hello Pritam,

 

1) Call the email script from the Message HTML in your notification using the below syntax : 

E.G : ${mail_script:change_request_details}

 

Kiranmai_KVL_0-1687328207803.png

 

2) Now go to left navigation -> Type email script & open 'Notification email script' & either create new script if it's not available or open existing script.

In the email script, you can get & check the system property value using the below syntax 

EG : var days = parseInt(gs.getProperty("glide.ui.autoclose.time"));

 

You can refer to OOB email scripts such as 'incident_resolved_incident' or 'incident_body ' & see how its implemented.

Kiranmai_KVL_1-1687328475723.png

 

Let me know if that helps or if you have any further questions.

 

 

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@Pritam_Pawar225 

why this system property needs to be used in email body or email script?

what's the use case?

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

Pritam_Pawar225
Tera Contributor

the system property is for auto-closing the change_request in 7 days value of that system property is 7, type is integer

I have created one notification that whenever the state of change_request changes to review the notification is sent to rerquested by of change_request 

@Pritam_Pawar225 

okay that's fine.

but what's the use of that system property in email script?

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