- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2022 12:06 PM
Hi
I need to create a Business Rule where the State field is equal to "10", the same State field will change to "Open"
my Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if(current.state == '10'){
current.setValue('state', Open); // use valid choice value
}
if(current.state == '9'){
current.setValue('state', Close); // use valid choice value
}
})(current, previous);
Tks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-28-2022 11:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-13-2022 12:09 PM
do it this way instead.
current.state = 3
replacing three with the number corresponding to the closed state (which could actually be 3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 06:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 07:23 AM
It looks to me like you are trying to set the State to the Label of the choice instead of the Value.
right click on the State field and push configure dictionary. From there click the Choices tab at the bottom.
There you can see the mappings between the choices and the values associated with them. You need to be testing and assigning current.state based on the values, not the labels.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2022 07:53 AM
Hello, how are you?
I have these fields defined, but for some failure, sometimes the ones called instead of coming with the name bring the number 9 or 111, as an outline I need to change to another value.
Remembering that 9 and 111 are already defined.
Thank you for your help