- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2023 09:02 AM
Hi,
I have added a field called "u_justification_for_priority" (label: Justification for priority) on incident form. I want it to be mandatory and visible only if someone downgrades the priority from P1 or P2.
How do we achieve it?
I have tried Ui policy but UI policy does not seems to help as there is no option like priority changes to or there is no other option which can use. Please help.
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2023 07:24 AM
Hi Nirav,
Please try this.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if ((isLoading) && (g_form.getValue('u_justification_for_priority') == '')) {
g_form.setVisible('u_justification_for_priority', false);
return ;
}
//Type appropriate comment here, and begin script below
if((oldValue == 2 && newValue == 3)||(oldValue==2 && newValue==4))
{
g_form.setVisible('u_justification_for_priority', true);
g_form.setMandatory('u_justification_for_priority',true);
}
else if(g_form.getValue('u_justification_for_priority') == '')
{
g_form.setMandatory('u_justification_for_priority',false);
g_form.setVisible('u_justification_for_priority', false);
}
}
Thanks,
Pooja M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2023 08:53 AM
Below is what i used and it's working now. Thank for your help.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var val = g_form.getValue('priority');
var jfp = g_form.getValue('u_justification_for_priority');
//if (val==3 || val==4)
//g_form.addInfoMessage(oldValue);
//g_form.addInfoMessage(newValue);
if( (oldValue == 2 && newValue == 3) || (oldValue == 2 && newValue == 4) )
{
g_form.setDisplay('u_justification_for_priority', true);
g_form.setMandatory('u_justification_for_priority', true);
}
else if (jfp!=="")
{
g_form.setMandatory('u_justification_for_priority', true);
g_form.setDisplay('u_justification_for_priority', true);
}
else if (jfp=="")
{
g_form.setMandatory('u_justification_for_priority', false);
g_form.setDisplay('u_justification_for_priority', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2024 01:17 AM