- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 07:37 AM
Hi All,
How to achieve this ?
Popup an alert and make work notes mandatory when reassignment count is greater than 3 on the incident form.
I have tried with ui policy but it is not properly working.
Please assist.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 10:46 PM
Hi @Dr Atul G- LNG ,
It is working as expected now. I have created an after update business rule with the below conditions.
1) Reassignment Count greater than 3
2) Reassignment Count Changes
3) Assignment Group Changes
4) !current.work_notes.changes()
And added a message in actions tab.
Thanks & Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 10:46 PM
Hi @Dr Atul G- LNG ,
It is working as expected now. I have created an after update business rule with the below conditions.
1) Reassignment Count greater than 3
2) Reassignment Count Changes
3) Assignment Group Changes
4) !current.work_notes.changes()
And added a message in actions tab.
Thanks & Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 02:08 AM
@Anurag Tripathi Guru need your guidance.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 02:22 AM
To achieve this, you can use a Client Script in ServiceNow. Here are the steps:
1. Navigate to System Definition > Client Scripts in ServiceNow.
2. Click on New to create a new client script.
3. Fill in the necessary fields:
- Name: Give a name to your client script.
- Table: Select the table where you want to apply the script. In this case, it's the Incident table.
- Type: Select onChange.
- Field name: Select the field that you want to monitor for changes. In this case, it's the Assignment group or Assigned to field.
4. In the Script field, write your JavaScript code. Here is a sample code:
javascript
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reassignment_count = g_form.getValue('reassignment_count');
if (reassignment_count > 3) {
g_form.addInfoMessage('Reassignment count is greater than 3');
g_form.setMandatory('work_notes', true);
} else {
g_form.setMandatory('work_notes', false);
}
}
5. Click on Submit to save the client script.
This script will check the reassignment count every time the assignment group or assigned to field is changed. If the reassignment count is greater than 3, it will display an info message and make the work notes field mandatory. If the reassignment count is 3 or less, it will make the work notes field optional.
Please note that this is a client-side script and it will only run in the browser. If you want to enforce this rule on the server side, you will need to use a Business Rule.
nowKB.com