- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 01:24 AM
Hey guys, have a need to empty a true/false field after update. Where should I empty it to get this to work correctly?
Scenario is that we need to have a "customer visible" true/false field defaulting to false, but the user can set it to true for a specific update -> this update is sent via a business rule to our integration platform and from there forwarded to the customer via REST. This true/false value can NOT stay true after the update, ie. the next update done to the ticket should default to false again unless the user sets it again to true.
Regards,
Christian
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 01:34 AM
I think to achieve the requirement of emptying (setting to false) a true/false field after an update, you can write after update business rule:
(function executeRule(current, previous /*null when async*/) {
// Check if the true/false field is currently true
if (current.true_false_field) {
// If true, set it to false
current.true_false_field = false;
gs.info("True/false field has been reset to false.");
}
})(current, previous);
Please Mark ✅Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2024 06:27 AM
Thanks guys, most of you recommend an after business rule, just need to set the order high enough to get it to run last. We have multiple outbound BR's for integrations, so I'm going to go with a separate BR instead of adding the "clear field" to the end of each rule. And make sure the update doesn't cause any loops.