Skip to content

Commit 6172b6d

Browse files
authored
Merge branch 'ServiceNowDevProgram:main' into Prevent-Unnecessary-notifications-from-being-sent-out
2 parents 5bbdcc4 + b675d4b commit 6172b6d

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Use this mail script to extract the date from GlideDateTime objects and use it in your email notification.
2+
example: 2024:10:29 18:18:52 to 2024:10:29
3+
4+
Use case:
5+
Print just the date in email body from the GlideDateTime object.
6+
7+
Solution:
8+
Create a mail script as shown in script.js and then call this mail script in email body using ${mail_script: your mail script name}
9+
10+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
2+
/* Optional EmailOutbound */
3+
email, /* Optional GlideRecord */ email_action,
4+
/* Optional GlideRecord */
5+
event) {
6+
7+
8+
// Add your code here
9+
var date = new GlideDateTime(current.sys_created_on); //datetime object of created date of current record
10+
var con_date= date.getLocalDate(); // Gets the date from dateime object in user's time zone
11+
template.print(con_date); //prints the date in email body
12+
13+
14+
15+
16+
})(current, template, email, email_action, event);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
2+
/* Optional EmailOutbound */
3+
email, /* Optional GlideRecord */ email_action,
4+
/* Optional GlideRecord */
5+
event) {
6+
7+
8+
// Add your code here
9+
var grp = new GlideRecord('sys_user_grmember'); //Query to the group member table
10+
grp.addQuery("group", current.assignment_group); //add a filter to query based on the current record's assignment group
11+
grp.query();
12+
while (grp.next()) {
13+
email.addAddress('cc', grp.user.email, grp.user.name); //Passing email as name and 2nd and 3rd parameter
14+
}
15+
16+
17+
18+
19+
})(current, template, email, email_action, event);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
This mail script can be used to CC all members of a group in the current record context.
2+
3+
Use case:
4+
CC all members of the assignment group for the current record.
5+
6+
Solution:
7+
Create the mail script as mentioned in cc all group members.js file and then call the mail script in you email notification using ${mail_script: your mail script name} in the notification body

0 commit comments

Comments
 (0)