Use current.update() ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 05:15 AM
Hey experts!
I know that you should never ever use current.update() on a business rule as it does a really nasty recursion. But is that so for the rest of the stuff? I've seen on UI action current.update() . Is that okay or its a bad practice ?
Cheers,
Joro

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 05:22 AM
You must use current.update() in ui action to update the fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 05:22 AM
Hi Georgi,
current.update() in UI actions is fine since you want the record to be updated with some new values in columns.
For business rule it should be avoided since business rule directly work on table and are designed to trigger and update the columns accordingly.
if you use current.update() in business rule then it may cause loop.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 05:23 AM
Current.update() is perfectly safe to use in any business rule that is not set to run Before - that is where the recursion will occur. Recursion is not a concern in UI actions or really other places besides a business rule.
If you are wanting to update the current record with a business rule, that's totally fine - you just need to run a Before Business Rule and not use current.update().
Read more about business rules and the order of operations here: https://docs.servicenow.com/bundle/istanbul-servicenow-platform/page/script/business-rules/reference...