- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:30 AM
Hi Everyone,
I wanted to add one email address to Watch list by scripting so it should reflect in the Incident.
I want to retrieve the mail address via sys id of that email group.
Can anyone help me with script include so that the mail address should be visible in watch list in Incident record.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:48 AM
Hi @Keerthan S ,
Watchlist simply stores email addresses or user references in comma seperated values. You can directly set the watch_list field using setValue() with the email ID of that group as mentioned below.
var grIncident = new GlideRecord('incident');
if (grIncident.get('sample_incident_sysid')) {
grIncident.setValue('watch_list','group_email_address@gmail.com');
grIncident.update();
}
for fetching the email address of the group, you can GlideRecord on the sys_user_group table and get the email field.
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Regards,
Pranav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:47 AM
Hello @Keerthan S ,
Can you share the script include that you using? it will be easier to resolve the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 09:45 AM
wanted to create a new function for the addition of email address (ex:
group_email_address@gmail.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:48 AM
Hi @Keerthan S ,
Watchlist simply stores email addresses or user references in comma seperated values. You can directly set the watch_list field using setValue() with the email ID of that group as mentioned below.
var grIncident = new GlideRecord('incident');
if (grIncident.get('sample_incident_sysid')) {
grIncident.setValue('watch_list','group_email_address@gmail.com');
grIncident.update();
}
for fetching the email address of the group, you can GlideRecord on the sys_user_group table and get the email field.
Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Regards,
Pranav