Simple Business Rule to check if a True/False is selected or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 11:28 AM
I am trying to create a simple BR to check if a checkbox box field is selected or not. BR is running After Insert & Update. Below is my code, which is not running at all [I want to achieve this requirement using Business Rule only] :-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 10:19 PM
Hello @ShivangiC ,
Try replacing if(current.u_agree == true) with if(current.u_agree) or if(current.u_agree == 'true') ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 10:32 PM
Hello @Priyanka0402 ,
That I will replace but why even after Saving the record, the info message gs.addInfoMessage('BR for CheckBox is running'); is not displaying. It means my Business Rule is not running. And I am unable to find the reason behind it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 10:41 PM
Hi @ShivangiC Try below code and try to add logs to debug
(function executeRule(current, previous /*null when async*/) {
gs.info('BR for CheckBox is running');
if (current.u_agree) {
gs.log("Inside If");
gs.info('Checkbox is selected');
} else {
gs.log("Inside Else");
gs.info('Checkbox is NOT selected');
}
gs.log("Outside if else");
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 10:51 PM
Hello @Sid_Takali,
I tried your code but in Logs I am getting error message. Screenshot attached below. I had already tried gs.log(), same message I was also getting. But Iam not understanding what actually it means.