- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 07:33 PM
I have a task please help me out to do it.
Task : when the order type changes to product then the priority field value has to set for high
For doing this task which is better to use either client script or business rules or ui policies and ui action?Why?
Then how to do this? Give me complete step of actions.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 05:49 AM
Hi @1__SathvikT
You can use the look up table as well, or via client script. reason, we want to make changes before going in DB.
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-23-2024 01:58 AM
Hi @1__SathvikT
For modifying field values based on changes to other fields on the server-side, using a Business Rule is the most appropriate approach.
Steps to Create a Business Rule:
1. Navigate to System Definition: Go to System Definition & Business Rules in the navigator/search bar.
2. New Business Rule: Click on the New button to create a new Business Rule.
3. Fill in Basic Information:
- Name:
- Table: Select the table
- Advanced: Check this box,
4. When to Run:
- In the When to run tab, configure the rule to run After an insert or update. This is because you want to check the value after it has been changed or set.
- Conditions: Set the condition to run your Business Rule. For example:
- Field: Order Type
- Operator: changes to
- Value: product
- This means your script will execute when the order type is set or changes to “product”.
if (current.order_type == 'product') {
current.priority = '1';
}
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
- Keep Learning
Thanks & Regards
Deepak Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 04:43 AM
@1__SathvikT Ideally this should be handled at the client side via the UI Policy. It is the best and most performant way. Client script slows the form rendering and browser a bit and business rules on the other side makes an instance execute some extra steps when ever a record is created/updated/deleted which is again should be done when absolutely necessary. In your case, neither of two (client script and business rule) is needed.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2024 05:49 AM
Hi @1__SathvikT
You can use the look up table as well, or via client script. reason, we want to make changes before going in DB.
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-23-2024 01:58 AM
Hi @1__SathvikT
For modifying field values based on changes to other fields on the server-side, using a Business Rule is the most appropriate approach.
Steps to Create a Business Rule:
1. Navigate to System Definition: Go to System Definition & Business Rules in the navigator/search bar.
2. New Business Rule: Click on the New button to create a new Business Rule.
3. Fill in Basic Information:
- Name:
- Table: Select the table
- Advanced: Check this box,
4. When to Run:
- In the When to run tab, configure the rule to run After an insert or update. This is because you want to check the value after it has been changed or set.
- Conditions: Set the condition to run your Business Rule. For example:
- Field: Order Type
- Operator: changes to
- Value: product
- This means your script will execute when the order type is set or changes to “product”.
if (current.order_type == 'product') {
current.priority = '1';
}
Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help us a lot.
- Keep Learning
Thanks & Regards
Deepak Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 04:43 AM
@1__SathvikT Ideally this should be handled at the client side via the UI Policy. It is the best and most performant way. Client script slows the form rendering and browser a bit and business rules on the other side makes an instance execute some extra steps when ever a record is created/updated/deleted which is again should be done when absolutely necessary. In your case, neither of two (client script and business rule) is needed.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 09:25 AM
Hi @1__SathvikT ,
you can go ahead with client script or business rule,
If you choose client script - create onchange client script and filed give as order type
in script
var order = g_form.getValue('order_type'); //write the backend name of order type
if(order == "product"){ //write the backend name of product
g_form.setValue('priority','1'); //give the backend name and value
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang