Display Business Rule is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:12 AM - edited 08-23-2023 12:27 AM
Hello All,
We have a requirement in HAM task. There is a choice field 'A' in 'sys_user' table. So if the requested for's 'A' field is 'Yes' then in the HAM task there is a choice field which will show an extra choice option.
I have created a Display Business rule and client script to show the extra choice option, but it is not working. It is always showing the scratchpad variable as false even if 'A' field for Requested for is 'Yes'
Display business rule:
Running on HAM task table:
//Type appropriate comment here, and begin script below
var taskName = g_form.getValue('task_name');
var b = g_scratchpad.isValue;
alert(b);
if(taskName == 'e' && b == 'true'){
g_form.addOption('evaluation_status', 'r', 'R', 4);
}
else {
g_form.removeOption('evaluation_status', 'r', 'R', 4);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:23 AM
Hello @User205031 ,
In you display BR you use add query instead of add encoded query
a.addQuery('task_name=e'); --> replace this to this --> a.addEncodedQuery('task_name=e');
Hope this helps
Mark the answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:35 AM
Hi Mohith,
I have used addEncodedQuery but flag is returning false even if 'A' field has 'Yes' value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:46 AM
@User205031 make sure you are using correct back end name for field A while accessing while dot walking ,Also use this if statement just in case if the value of A field is starting with lowercase A .
if(a.requested_for.A == 'Yes' ||a.requested_for.A=="yes" ){
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:56 AM
Hi Mohith,
I have done the same and checked still flag is returning false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2023 12:59 AM
@User205031 can you please put some logs inside if and check if its going inside if statement or not ? Also please double check the back end name of requested for field if its correct or not?