Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Notification when problem task assigned to my group

JulietD
Mega Guru

Hi,

if a Problem Task is assigned to my group, I would like the system to send all group members an email notification.

 

I created a notification below,

 

Reported by: ${sys_created_by}

Number: ${number}

Assignment group: ${assignment_group}

Assigned to: ${assigned_to}

Priority: ${priority}

Short Description

Created Date(Don't include time): ${mail_script:date_without_time}

 

Not able to find a field for short description and created date without time. Can anyone help to solve this?

Preview mail:

JulietD_0-1716836939793.png

Thank you

 

 

 

 

1 ACCEPTED SOLUTION

James Chun
Kilo Patron

Hi @JulietD,

 

There is a field called short_description on the Problem Task record which you can use.

And, you can use the following email script to get the created date without time.

 

Name: date_without_time

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

		var gdt = new GlideDateTime(current.getValue('sys_created_on'));
		var date  = gdt.getDate();
		template.print(date);

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

 

Email notification:

Reported by: ${sys_created_by}

Number: ${number}

Assignment group: ${assignment_group}

Assigned to: ${assigned_to}

Priority: ${priority}

Short Description: ${short_description}

Created Date(Don't include time): ${mail_script:date_without_time}

 

Outcome:

JamesChun_0-1716843855093.png

 

Cheers

 

 

View solution in original post

5 REPLIES 5

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @JulietD 

 

AGLearnNGrow_0-1716837649681.png

AGLearnNGrow_1-1716837666976.png

 

 

I tested in my PDI and i can see this.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Its_Azar
Tera Guru
Tera Guru

Hi there @JulietD 

 

By adding ${short_description} to your email template, you'll include the short description of the problem task. As for the created date without time, you may need to use a script include or a BR to extract this information and make it available as a variable in your email template. Once available, you can reference it using ${mail_script:date_without_time}.

 

If this helps kindly accept the answer thanks much.

☑️ If this helped, please mark it as Helpful or Accept Solution so others can find the answer too.

Kind Regards,

Mohamed Azarudeen Z

Developer @ KPMG

James Chun
Kilo Patron

Hi @JulietD,

 

There is a field called short_description on the Problem Task record which you can use.

And, you can use the following email script to get the created date without time.

 

Name: date_without_time

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

		var gdt = new GlideDateTime(current.getValue('sys_created_on'));
		var date  = gdt.getDate();
		template.print(date);

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

 

Email notification:

Reported by: ${sys_created_by}

Number: ${number}

Assignment group: ${assignment_group}

Assigned to: ${assigned_to}

Priority: ${priority}

Short Description: ${short_description}

Created Date(Don't include time): ${mail_script:date_without_time}

 

Outcome:

JamesChun_0-1716843855093.png

 

Cheers

 

 

Thank you soo much