Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2023 10:02 PM
HI @SParker12 ,
I trust you are doing great.
- Create a new Business Rule in ServiceNow that triggers when a user is mentioned in the Incident form.
- In the Business Rule script, write code to retrieve the mentioned user and their email address.
- Use the retrieved information to construct an email notification.
- Send the email notification to the mentioned user.
Here's an example of how you can implement this solution:
Step 1: Create a Business Rule
- Navigate to "Business Rules" in ServiceNow.
- Click on "New" to create a new Business Rule.
- Provide a name and description for the Business Rule.
- Set the "When to run" field to "After" and choose the appropriate condition for when a user is mentioned in the Incident form.
- Save the Business Rule.
Step 2: Retrieve User Information
- In the Business Rule script, use GlideRecord to query the Incident table and retrieve the mentioned user's information.
- Here's an example code snippet:
(function executeRule(current, previous) {
var mentionedUserId = current.mentioned_user; // Assuming the mentioned user is stored in a field called 'mentioned_user'
var userGR = new GlideRecord('sys_user');
if (userGR.get(mentionedUserId)) {
var mentionedUserName = userGR.name;
var mentionedUserEmail = userGR.email;
// Use the retrieved user information to construct the email notification
// (code for email construction not provided here)
// Send the email notification to the mentioned user
// (code for sending email not provided here)
}
})(current, previous);
Step 3: Construct Email Notification
- Use the retrieved user information (mentionedUserName and mentionedUserEmail) to construct an email notification.
- This involves creating an HTML or plain text email template with the desired content, including the mentioned user's name, incident details, etc.
- Use ServiceNow's email API or a similar method to send the email. The code for sending emails will depend on your specific email integration setup.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi