- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi,
I have a question regarding updating a field that has the "Calculated" option enabled in a custom table.
■ Background:
I want to update the value of this calculated field using a data patch or script.
My goal is to temporarily disable the calculation logic, set the value manually, and then re-enable the calculation.
■ Questions:
1. Is there a way to temporarily disable the Calculation flag during script execution?
2. Can I use `GlideRecord.setWorkflow(false)` or similar methods to skip calculation scripts during updates?
3. Are there recommended best practices for this kind of override/update of calculated fields?
Any guidance would be appreciated. Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
you cannot disable it temporarily. the calculation logic is at dictionary level.
setWorkflow() won't help as it's for avoiding business rule and not field level calculation
Workaround
1) Disable that calculated checkbox for your field
2) run your script
3) enable that calculated checkbox again
Going forward if same situation arises, then add the logic to calculate that field in before business rule and don't make that field as calculated
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
you cannot disable it temporarily. the calculation logic is at dictionary level.
setWorkflow() won't help as it's for avoiding business rule and not field level calculation
Workaround
1) Disable that calculated checkbox for your field
2) run your script
3) enable that calculated checkbox again
Going forward if same situation arises, then add the logic to calculate that field in before business rule and don't make that field as calculated
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader