- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 04:29 AM
Hi Team,
I am writing a business rules by selecting filters and action what it has to do, when things match to the condition set. But to no avail
for some reason its not working.
Could you please suggest a script that I can write to get this in place.
Below are the screenshots for your reference.
to elaborate my requirement further.
If my perfection logic is 1
If my SI Validation Result is greater or equal to expected target. I need to set the Legend field as 'Greater than or Equal to Expected Target'
if my SI Validation Result is in between expected and minimum target (greater or equal to minimum target but lesser than expected target). I need to set the Legend field as 'Between Expected & Minimum Target'
if my SI Validation Result is less than minimum target. I need to set the Legend field as 'Less than Minimum Target'
and if my SI Validation Result is blank or no value. I need to set the Legend field as 'No Reportable Data'
if my perfection logic is 2
If my SI Validation Result is lesser or equal to expected target. I need to set the Legend field as 'Greater than or Equal to Expected Target'
if my SI Validation Result is in between expected and minimum target (lesser or equal to minimum target but greater than expected target). I need to set the Legend field as 'Between Expected & Minimum Target'
if my SI Validation Result is greater than minimum target. I need to set the Legend field as 'Less than Minimum Target'
and if my SI Validation Result is blank or no value. I need to set the Legend field as 'No Reportable Data'.
Thank You for your support in advance.
Regards,
Narmi
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2016 05:19 AM
It could be that it is returning a string. Try
if(current.s_wf == ' 1')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 05:24 AM
Hi Narmi,
Thank you for the clarification of requirements/logic and screenshot. Based on what you described, you are going to need to check the advanced button and do some scripting. You have multiple conditions and the scriptless option of the business rule requires several (and nested also.)
Without specific field names and values, it's difficult for me to draft a script for you, but use the field names in the script and the values of your choice list (not necessarily the same as the labels.)
For example:
if (current.u_perfection_logic == 1) {
if (current.u_si_validation_result >= current.u_expected_target) {
current.legend = 'Greater than or Equal to Expected Target';
}
// More comparisons and value setting here.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-08-2016 08:21 PM
Hi Chuck,
Thank You for the quick reply.
Your code works perfectly fine. But a small concern is, it should give me 'No Value' or --None-- when my Workflow state (s_wf) is 1 otherwise it has to work as per the logic. Which it is not happening. I get 'No Reportable Data' even if I have the workflow state (s_wf) as 1. any I am missing here.
Below is my code.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
if (current.per_log == 1)
{
if(current.si_vr >= current.exp_sl)
{
current.legends = 'Greater than or Equal to Expected Target';
}
if(current.si_vr < current.exp_sl && current.si_vr >= current.min_sl)
{
current.legends = 'Between Expected & Minimum Target';
}
if(current.si_vr < current.min_sl)
{
current.legends = 'Less than Minimum Target';
}
if(current.s_wf == 1)
{
current.legends = '--None--';
}
if (current.si_vr == '')
{
current.legends = 'No Reportable Data';
}
}
if(current.per_log == 2)
{
if(current.si_vr <= current.exp_sl)
{
current.legends = 'Greater than or Equal to Expected Target';
}
if(current.si_vr > current.exp_sl && current.si_vr <= current.min_sl)
{
current.legends = 'Between Expected & Minimum Target';
}
if(current.si_vr > current.min_sl)
{
current.legends = 'Less than Minimum Target';
}
if(current.s_wf == 1)
{
current.legends = '--None--';
}
if (current.si_vr == '')
{
current.legends = 'No Reportable Data';
}
}
})(current, previous);
Regards,
Narmi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-09-2016 05:19 AM
It could be that it is returning a string. Try
if(current.s_wf == ' 1')

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2016 06:10 AM
Hi Narmi,
Did that resolve your issue?