
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2020 11:10 PM
Dear All,
Below is the screenshot of the OOTB BR - mark_closed on incident table. Can someone explain the need of invoking a function which is contained in the BR itself?
Can this function setClosureFields() be accessed from some other tools? Is that why it is made to contain in a function?
NOTE - I am learning ServiceNow development, please excuse stupidity in my examples and questions if any and help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2020 11:29 PM
Hello Anish,
The code/script in a business rule script inside a function provide the function to limit the visibility, or scope, of objects. When code is not enclosed in a function, variables and other objects are available to all other server-side scripts. This availability can lead to unexpected consequences that are difficult to troubleshoot.
Refer this link for more details- Business Rules Best Practices
Hope this will help you.
Regards,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2020 11:28 PM
Hello,
This Business rule runs in action when the incident state chances to close or cancelled
it changes the other fields ==> active to false it populates==> closed by and closed at fields if they are empty and it alse calculates business duration==> by taking opened at and closed at field values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2020 11:29 PM
Hello Anish,
The code/script in a business rule script inside a function provide the function to limit the visibility, or scope, of objects. When code is not enclosed in a function, variables and other objects are available to all other server-side scripts. This availability can lead to unexpected consequences that are difficult to troubleshoot.
Refer this link for more details- Business Rules Best Practices
Hope this will help you.
Regards,
Sagar Pagar