- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 12:03 AM
I created 4 fields as field1,field2,field3,field4 in incident form. If I select the In progress state means I want field1 should be visible and mandatory rest of field2,field3,field4 should not visible in incident form..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 12:14 AM
Hi Dhivya
Did you try anything so far and got stuck? it's easy and doesnt require any script to do with UI Policies.
try this
if(newValue=="in progress state backend value") // please replace work in progress choice backend value
{
g_form.setDisplay('field1',true);
g_form.setMandatory('field1',true)
g_form.setDisplay('field2',false);
g_form.setDisplay('field3',false);
g_form.setDisplay('field4',false);
}
else
{
//modify below statements accordingly if you want to show the fieldss if state is not inprogress.
g_form.setMandatory('field1',false);
g_form.setDisplay('field2',false);
g_form.setDisplay('field2',true);
g_form.setDisplay('field3',true);
g_form.setDisplay('field4',true);
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-07-2022 12:14 AM
Hi Dhivya
Did you try anything so far and got stuck? it's easy and doesnt require any script to do with UI Policies.
try this
if(newValue=="in progress state backend value") // please replace work in progress choice backend value
{
g_form.setDisplay('field1',true);
g_form.setMandatory('field1',true)
g_form.setDisplay('field2',false);
g_form.setDisplay('field3',false);
g_form.setDisplay('field4',false);
}
else
{
//modify below statements accordingly if you want to show the fieldss if state is not inprogress.
g_form.setMandatory('field1',false);
g_form.setDisplay('field2',false);
g_form.setDisplay('field2',true);
g_form.setDisplay('field3',true);
g_form.setDisplay('field4',true);
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP