Check box true when based on conditions met

lokesh211
Tera Contributor

Hi 

 

I want to check box true which is read only based on conditions like

Planned Implementation Start Date' is greater than 'Actual Implementation Start Date' & 'Planned Implementation End Date' is less than the 'Actual Implementation End Date '.

 

I tried Business rule for this function but it's not working. 

This is the code that i used:

 

var plannedStartDate = current.getValue("start_date");
var actualStartDate = current.getValue("start_date");
var plannedEndDate = current.getValue("end_date");
var actualEndDate = current.getValue("end_date");
 
if (plannedStartDate > actualStartDate && plannedEndDate < actualEndDate) {
current.setValue("field_to_set", true);
}
else {
current.setValue("field_to_set", false);
}
})(current, previous);
 
 
Please help me in correct this code or provide any suggestions instead of BR.
Thanks in advance for providing me solution.
 
5 REPLIES 5

JP - Kyndryl
Kilo Sage

Hi Lokesh,

For the planned fields, names are rather start_date and end_date.

For the actual fields, names are rather work_date and work_end.

 

Regards,
JP

Hi @JP - Kyndryl ,

Yes, For idea i provided like that.

Thanks.

Divya Rajasekar
Tera Contributor

 

var plannedStartDate = current.getValue("start_date");//current.getDisplayValue("field");
var actualStartDate = current.getValue("start_date");//current.getDisplayValue("field");
var plannedEndDate = current.getValue("end_date");//current.getDisplayValue("field");
var actualEndDate = current.getValue("end_date");//current.getDisplayValue("field");
 
if (plannedStartDate > actualStartDate && plannedEndDate < actualEndDate) {
current.setValue("field_to_set", true);
}
else {
current.setValue("field_to_set", false);
}
})(current, previous);
 
Replace getvalue with getDisplayValue and check
 

Hi @Divya Rajasekar ,

 

Thanks for your reply. I replaced getValue with getDisplayValue but it is not working. 
Can you please help me in this.