- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 02:34 AM
We are developing functionality to convert incident to request. The functionality is built using script includes.
When an incident gets converted to request, we set category to 'Converted Ticket'. This is used to trigger email notifications about ticket conversion to caller and assignment group.
The concern we are facing is we want to clear value 'Converted Ticket' once email is sent.
How can this be achieved?
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 07:00 PM
We created a client script of type On Load and order 1000
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 04:38 AM
You can achieve this by using a Business Rule or a Scripted Email Notification. Here are the steps for both methods:
Method 1: Using a Business Rule
1. Create a new Business Rule on the Request table.
2. Set the 'When to run' condition to 'After'.
3. Set the 'Insert' and 'Update' checkboxes.
4. In the 'Advanced' tab, write a script to check if the category is 'Converted Ticket'.
5. If it is, send an email notification and then clear the category field.
6. The script could look something like this:
javascript
if (current.category == 'Converted Ticket') {
gs.eventQueue('custom.event.request.converted', current, current.caller_id, current.assignment_group);
current.category = '';
current.update();
}
Method 2: Using a Scripted Email Notification
1. Create a new Email Notification.
2. Set the 'When to send' condition to when the category is 'Converted Ticket'.
3. In the 'Advanced' tab, write a script to clear the category field after the email is sent.
4. The script could look something like this:
javascript
(function runMailScript(current, template, email, email_action, event) {
if (current.category == 'Converted Ticket') {
current.category = '';
current.update();
}
})(current, template, email, email_action, event);
Remember to test these scripts in a sub-production environment first to ensure they work as expected.
nowKB.com
For a good and optimistic result, and solving ServiceNow-related issues please visit this website.https://nowkb.com/home
Kindly mark correct and helpful if applicable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 05:01 AM
Hi @Supriya39
How you trigger email notification post ticket conversion ? Is it via Flow or through event ?
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2024 07:00 PM
We created a client script of type On Load and order 1000