- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2024 10:37 AM
I am working on a project on my PDI in which I had to create an application that allows users to borrow vehicles from my company. I have to create a business rule on Vehicle Servicing tickets that stops users from closing the tickets when the Vehicle Status is "In Service"; and display a message "You are unable to close this ticket because the Vehicle Status is In Service."
I am not sure how to set the condition to stop users from closing the Vehicle Servicing ticket when the vehicle status is "in Service". I believe there are ways to do this other than a business rule, but I am required to use a business rule. Thank you for your help, please answer plainly.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2024 10:52 AM
You can create a UI policy and in policy action, mention the alert and abort action or Business rule also work,
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
03-28-2024 11:31 AM
@DeIvory Gordon Apart from the business rule, you may choose to create an onSubmit client script and check if the Vehicle status is In-Service, you can show an alert message or an error message if the check returns true. The script should return false to stop the form submission in this case.
Here is an example.
function onSubmit() {
if(g_form.getValue('vehicle_state') ==8&&g_form.getValue('state')==3 ){ //assuming 8 here represents In-Service state and 3 represents closed state
g_form.addErrorMessage('Vehicle is in serice ticket can\'t be closed.');
return false;
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2024 10:52 AM
You can create a UI policy and in policy action, mention the alert and abort action or Business rule also work,
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
03-28-2024 11:31 AM
@DeIvory Gordon Apart from the business rule, you may choose to create an onSubmit client script and check if the Vehicle status is In-Service, you can show an alert message or an error message if the check returns true. The script should return false to stop the form submission in this case.
Here is an example.
function onSubmit() {
if(g_form.getValue('vehicle_state') ==8&&g_form.getValue('state')==3 ){ //assuming 8 here represents In-Service state and 3 represents closed state
g_form.addErrorMessage('Vehicle is in serice ticket can\'t be closed.');
return false;
}
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2024 07:46 PM
Hey @DeIvory Gordon I'm stuck on this same Business rule in Sprint 3 currently. Would you be able to help me brainstorm through my script?