In SERVICENOW, as same as incident, is it possible to see VIP tag in front of requested for field in RITM. HOW TO DO THIS
Assistant
User
Is it possible to reject the ticket if approval manager not approve it within 5 days and trigeer mail for 5 days to approve the request
Assistant
User
I need to send different mails for all 5 days. Content in day 1 mail is different and in day 2 in different.. and on final day approval reject mail has been trigeerd
Assistant
User
For any incident, whenever we open, we see VIP tag if the user is VIP or VVIP. we want same to be implemented for all type of catalog item requests in servicenow
Assistant
Yes, it is possible to add a VIP tag in front of the "Requested For" field in a Requested Item (RITM) record in ServiceNow. Here’s a high-level overview of how you can achieve this:
Create a Business Rule:
First, you need to create a business rule that will check whether the person in the "Requested For" field is a VIP.
Navigate to System Definition > Business Rules.
Click on New to create a new Business Rule.
Fill in the details:
Name: Add VIP Tag to Requested For
Table: sc_req_item (This is the table for RITM)
Active: Checked
When to run: Before
Insert: Checked
Update: Checked
In the Advanced tab, write the script to check if the "Requested For" person is a VIP.
javascript
(function executeRule(current, previous /*null when async*/) {
var requestedFor = current.requested_for.getRefRecord();
if (requestedFor.vip == true) {
current.u_vip_tag = true; // assuming you have a custom field in RITM to store VIP status
} else {
current.u_vip_tag = false;
}
})(current, previous);
Create a Field to Display the VIP Tag:
If you don't have a custom field to store the VIP status in your RITM table, you need to create one.
Navigate to System Definition > Tables.
Search for the sc_req_item table.
Open the table and under the Columns section, click New to create a new field.
Configure the field:
Column Label: VIP Tag
Column Name: u_vip_tag
Type: Boolean or True/False
Save the column.
Add a UI Policy to Display the VIP Tag:
You can use a UI Policy to display the VIP status on the form.
Navigate to System UI > UI Policies.
Click New.
Fill in the details:
Table: sc_req_item (Requested Item)
Short Description: Display VIP Tag
Conditions: [VIP Tag] is true
**Run Scripts>: Checked
Reverse if false: Checked
Under the UI Policy Actions related list, click New.
Field name: The field where you want to show VIP indication (like adding an image, or modifying label)
Visible: True
Save the UI policy.
(Optional) Add Visual Indicator:
You can add a visual indicator like an icon or changing the field label color to make the VIP status more noticeable.
Navigate to System UI > Field Styles.
Click New.
Fill in the details:
Table: sc_req_item
Field: requested_for
Style: Enter the CSS style for your indicator. For example:
After setting up these configurations, the "Requested For" field in your RITM should display an indication if the person is a VIP, similar to how it is done in the Incident record. Make sure to test this thoroughly to verify that it works as expected in different scenarios.
Yes, it is possible to implement the requirement to automatically reject a ticket if the approval manager does not approve it within 5 days and to trigger reminder emails for 5 days in ServiceNow. Here’s a step-by-step guide to implement this process:
Step 1: Create a Scheduled Script Execution
For sending reminder emails every day for 5 days and rejecting the ticket after 5 days, you can use a Scheduled Script Execution (Scheduled Job).
Navigate to: System Definition > Scheduled Script Executions.
Click New to create a new Scheduled Script Execution.
Fill in the details:
Name: Send Reminder Emails and Auto-Reject Tickets
Run: Daily
Active: Checked
In the Script field, write the script to handle reminder emails and ticket rejection:
javascript
(function() {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('approval', 'requested'); // Change 'approval' field to the appropriate field in your use case
gr.addQuery('sys_created_on', '<=', gs.daysAgo(5));
gr.query();
while (gr.next()) {
var ageInDays = gs.dateDiff(gr.sys_created_on.getDisplayValue(), gs.nowDateTime(), true) / (1000 * 60 * 60 * 24); // Difference in days
if (ageInDays <= 5) {
// Send reminder email
gs.eventQueue('request.approval.reminder', gr, gs.getUserID(), gs.getUserName());
}
if (ageInDays > 5) {
// Reject the request
gr.setValue('approval', 'rejected');
gr.update();
gs.eventQueue('request.auto.rejected', gr, gs.getUserID(), gs.getUserName());
}
}
})();
Step 2: Configure Email Notifications
Configure the email notifications to handle the events request.approval.reminder and request.auto.rejected.
Navigate to: System Notification > Email > Notifications.
Click New to create a new notification.
For Reminder Emails
Configure the first notification for the request.approval.reminder event:
Name: Reminder: Approve Request
Table: Requested Item (sc_req_item)
When to send: Event is fired
Event name: request.approval.reminder
Who will receive: Approval Manager (you can configure it to send to the right approvers)
What it will contain: Write the email content reminding the approver to approve the request.
For Auto-Rejection Notification
Configure the second notification for the request.auto.rejected event:
Name: Request Auto-Rejected
Table: Requested Item (sc_req_item)
When to send: Event is fired
Event name: request.auto.rejected
Who will receive: The requestor or whoever needs to be informed
What it will contain: Write the email content informing about the auto-rejection.
Step 3: Test the Process
Create a test Requested Item.
Monitor the Scheduled Script Execution to ensure that reminders are sent daily for 5 days.
Verify that the item is auto-rejected if not approved within 5 days and the appropriate email notifications are sent.
Notes
Make sure your Scheduled Script Execution is active and running at an appropriate time interval (like once daily).
Ensure proper logging and testing to verify the script is working as expected without any unintended consequences.
If there are more complex requirements, consider using Flow Designer or Orchestration for more advanced workflow management.
To send different emails for each of the 5 days with distinct content and trigger an approval rejection email on the final day in ServiceNow, you need to create separate notifications and handle the different conditions in your Scheduled Script Execution script. Here’s how you can achieve this:
Step 1: Create Email Notifications for Each Day
Navigate to: System Notification > Email > Notifications.
Click New to create a new notification for Day 1.
Configure the notification:
Name: Day 1: Approval Reminder
Table: Requested Item (sc_req_item)
When to send: Event is fired
Event name: day1.approval.reminder
Who will receive: Approval Manager, request approver, or any specific role.
What it will contain: Write the content specific for Day 1.
Repeat this process to create notifications for Day 2, Day 3, Day 4, and Day 5, changing the Event name and email content accordingly.
Create an additional notification for the final rejection email:
Name: Request Auto-Rejected
Table: Requested Item (sc_req_item)
When to send: Event is fired
Event name: request.auto.rejected
Who will receive: The requestor or the required recipient.
What it will contain: Write the content informing about the auto-rejection.
Step 2: Modify the Scheduled Script Execution
Now, modify the script to trigger different events based on the number of days elapsed.
javascript
(function() {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('approval', 'requested'); // Adjust this query for your use case
gr.query();
while (gr.next()) {
var ageInDays = gs.dateDiff(gr.sys_created_on.getDisplayValue(), gs.nowDateTime(), true) / (1000 * 60 * 60 * 24); // Difference in days
if (ageInDays <= 5) {
switch (Math.floor(ageInDays)) {
case 1:
gs.eventQueue('day1.approval.reminder', gr, gs.getUserID(), gs.getUserName());
break;
case 2:
gs.eventQueue('day2.approval.reminder', gr, gs.getUserID(), gs.getUserName());
break;
case 3:
gs.eventQueue('day3.approval.reminder', gr, gs.getUserID(), gs.getUserName());
break;
case 4:
gs.eventQueue('day4.approval.reminder', gr, gs.getUserID(), gs.getUserName());
break;
case 5:
gs.eventQueue('day5.approval.reminder', gr, gs.getUserID(), gs.getUserName());
break;
}
}
if (ageInDays > 5) {
// Reject the request
gr.setValue('approval', 'rejected');
gr.update();
gs.eventQueue('request.auto.rejected', gr, gs.getUserID(), gs.getUserName());
}
}
})();
Step 3: Test the Complete Process
Create a test Requested Item: Ensure it is in the requested state that your script is querying for.
Monitor the Scheduled Script Execution:
Validate if tasks are running daily.
Check if distinct reminders are sent for each day.
Confirm that the request is auto-rejected on the 6th day if not approved.
Check Email Notifications:
Verify that each day-specific email is sent correctly.
Ensure the final rejection email is also sent appropriately.
Notes
Timing of Script Execution: Ensure that the scheduled job runs at an appropriate time daily. You can set this in the Scheduled Script Execution configuration.
Field Update Impact: If there are any other workflows or business rules based on the approval field, ensure this script execution does not cause unintentional triggers.
Advanced Logic: For more complex scenarios or future enhancements, consider using Flow Designer which offers more granular control over workflows and notifications.
Logging: Add appropriate logging within the script to facilitate troubleshooting and ensure the script is working as expected.
With these steps, you should be able to send different reminder emails for each day leading up to an automatic rejection and notification on the final day.
To replicate the VIP (or VVIP) tag display for catalog item requests in ServiceNow, similar to how it works for incidents, you need to implement a method that identifies the VIP/VVIP status of the user and displays a visual indicator accordingly. Here’s a step-by-step guide to achieve this:
Step 1: Identify or Create a VIP/VVIP Field
Ensure that the user table (sys_user) has a field indicating whether a user is VIP or VVIP. Usually, this could be a boolean field (e.g., vip).
Step 2: Add a Field in the Catalog Item Request Form
Navigate to: System Definition > Tables.
Find and select the sc_req_item table (this table stores Requested Item (RITM) records).
Under the Columns section, click New to create a new field:
Column Label: VIP Status
Column Name: u_vip_status
Type: String or Choice
Define choices if you want to set distinct values such as VIP, VVIP, etc.
Step 3: Use Business Rules or Client Scripts
Implement the logic using a Business Rule to set the VIP status whenever a catalog item request is created or updated.
Business Rule to Set VIP Status
Navigate to: System Definition > Business Rules.
Click New to create a new Business Rule.
Fill in the details:
Name: Set VIP Status on Catalog Item Request
Table: sc_req_item
Active: Checked
When to run: Before
Insert: Checked
Update: Checked
In the Advanced tab, write the following script to check the VIP status of the requested_for user:
javascript
(function executeRule(current, previous /*null when async*/) {
var user = new GlideRecord('sys_user');
user.get(current.requested_for);
if (user.vip) {
current.u_vip_status = 'VIP'; // Or any value you have decided, like 'VVIP'
} else {
current.u_vip_status = '';
}
})(current, previous);
Step 4: Display the VIP Tag on the Form
Now, configure Form Layout and UI Policies to display the VIP tag on the form.
Configure Form Layout
Navigate to: Any Requested Item.
Right-click on the header and select Configure > Form Layout.
Add your u_vip_status field to the form.
Save the form layout.
Configure UI Policies to Enhance the Display
Navigate to: System UI > UI Policies.
Click New to create a new UI Policy.
Fill in the details:
Table: sc_req_item
Short Description: Display VIP Tag
Active: Checked
Conditions: u_vip_status is VIP (or VVIP).
Under the UI Policy Actions:
Create actions to make the VIP tag visible or modify how it is displayed (e.g., change colors, show icons).
Example for changing the background color of the requested_for field:
Field name: request_for
Visible: True
Read Only: True
Mandatory: False
Advanced tab (if any scripting needed for more complex UI changes):
Create a new catalog item request and set the requested_for field to a VIP/VVIP user.
Open the request and ensure that the VIP/VVIP tag is displayed as expected.
Test with non-VIP users to ensure the tag is not displayed.
Notes
Consistency: Ensure that the field names and conditions are consistent across the configurations.
Performance: Test the performance impact if any, especially if operating on large datasets.
Permissions: Ensure the fields and scripts do not expose sensitive data or violate any security policies.
Implementing these steps should enable the VIP/VVIP tag display for all types of catalog item requests in ServiceNow, similar to how it appears in the Incident form.