- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 09:29 AM
Hello,
I need to set a value in a field (decimal) depending on the selection of a choice list field. I suppose this can be done with a business rule but can't make it to work.
The choice list field is 'size' and the choices in the list have the following values: small, medium, large, xlarge and xxlarge
The field to set the value is 'score_size'
The logic is:
Condition:
If 'size' changes
Action:
If size = small then score_size = 2
If size = mediumthen score_size = 4
If size = large then score_size = 6
If size = xlarge then score_size = 9
If size = xxlargethen score_size = 10
I created a condition stating
Need some help with the code and is this gonna be a before or after rule?
Thank you
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 05:56 AM
I managed to do it with an before business rule with the following code:
(function executeRule(current, previous /*null when async*/) {
current.score_size = current.size;
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2017 05:56 AM
I managed to do it with an before business rule with the following code:
(function executeRule(current, previous /*null when async*/) {
current.score_size = current.size;
})(current, previous);
