Else if not working in client script for state field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:01 AM
when state == null then no one reason field will be display.
could you please check below code:
else if(state == '')
{
g_form.setMandatory('u_in_progress_reason',false);
g_form.setDisplay('u_in_progress_reason', false);
g_form.setMandatory('u_new_reason',false);
g_form.setDisplay('u_new_reason',false);
g_form.setMandatory('u_cancelled_reason',false);
g_form.setDisplay('u_cancelled_reason', false);
g_form.setMandatory('u_on_hold_reason',false);
g_form.setDisplay('u_on_hold_reason', false);
g_form.setMandatory('u_closed_reason',false);
g_form.setDisplay('u_closed_reason', false);
g_form.setMandatory('u_resolved_reason',false);
g_form.setDisplay('u_resolved_reason',false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:08 AM - edited 11-21-2023 03:09 AM
Firstly, you can do this easily using a ui policy with conditions form the filters, that is the recommended way for managing field behavior
To check for null you can do something like
if(g_form.getValue('state))
{
//do somehting
}
else
{ //this is the null block
g_form.setMandatory('u_in_progress_reason',false);
g_form.setDisplay('u_in_progress_reason', false);
g_form.setMandatory('u_new_reason',false);
g_form.setDisplay('u_new_reason',false);
g_form.setMandatory('u_cancelled_reason',false);
g_form.setDisplay('u_cancelled_reason', false);
g_form.setMandatory('u_on_hold_reason',false);
g_form.setDisplay('u_on_hold_reason', false);
g_form.setMandatory('u_closed_reason',false);
g_form.setDisplay('u_closed_reason', false);
g_form.setMandatory('u_resolved_reason',false);
g_form.setDisplay('u_resolved_reason',false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:42 AM