- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
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/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
You can use a Business Rule to update the field automatically when a record is created or updated.
Steps:
Go to System Definition → Business Rules.
Create a new Business Rule on the required table.
Set When to Before and choose Insert and/or Update depending on when you want it to run.
Add a Condition if the update should only happen under certain circumstances.
In the Script, set the field value.
Example:
(function executeRule(current, previous) {
// Automatically set var to 'new value'
current.var = 'new value';
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
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/dratulgrover [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
You can use a Business Rule to update the field automatically when a record is created or updated.
Steps:
Go to System Definition → Business Rules.
Create a new Business Rule on the required table.
Set When to Before and choose Insert and/or Update depending on when you want it to run.
Add a Condition if the update should only happen under certain circumstances.
In the Script, set the field value.
Example:
(function executeRule(current, previous) {
// Automatically set var to 'new value'
current.var = 'new value';
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hello @surajsengar ,
Configure Before Insert/Update BR on the target table.
(function executeRule(current, previous /*null when async*/) {
if (condition) {
current.active = true;
}
})(current, previous);
Note : Using a Before BR is considered best practice because it avoids additional database updates and improves performance.
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
43m ago
Hello @surajsengar ,
Use before update/insert business rule , add required condition then use below code snippet
(function executeRule(current, previous) {
current.your_variableName = RequiredValue;
})(current, previous);When you use before update/insert business rule, at that time above logic will set required value and it will inserted/updated automatically.
If this helps you then mark it as helpful and accept as solution.
Regards,
Aditya

