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:22 AM
Hello @rmaroti
You can use this -
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 ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:47 AM
I have try it but not working still.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:42 AM
HI @rmaroti ,
I trust you are doing great.
Please find the updated code
function setFieldProperties(fieldName, isMandatory, isDisplayed) {
g_form.setMandatory(fieldName, isMandatory);
g_form.setDisplay(fieldName, isDisplayed);
}
if (state === null || state === '') {
var fields = [
'u_in_progress_reason',
'u_new_reason',
'u_cancelled_reason',
'u_on_hold_reason',
'u_closed_reason',
'u_resolved_reason'
];
fields.forEach(function(field) {
setFieldProperties(field, false, false);
});
}
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2023 03:46 AM
Thanks for help but I'm in learning phase, so i need to achieve this is only through client script even some other case also last else if or else is not working i want to know why this happened so please help me in that.