How can I hide the State choice on RITM forms?

sattar3
Tera Contributor

Hello Everybody,

 

I need to hide the “Closed Skipped” state choice on the RITM form.

  • Will hiding it at the form level affect historical records that already have this state?
  • I tried a UI Policy with g_form.removeOption('state', 7);. It hides the option, but when I open historical records, the form shows Pending while the list view still shows Closed Skipped.
    Any recommendations on the right approach?

For more details please refer the attached screenshot.

 

Thanks,

Sattar

2 ACCEPTED SOLUTIONS

Kieran Anson
Kilo Patron

Hi,

Add a condition to your UI policy so it only runs if the state is not already Closed Skipped, that way you're only removing the option on records in another state

View solution in original post

Like this:

 

For this example, we will ensure that a user does not enter a high impact into a cell to force them to open up the form view to do this:

 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) { var saveAndClose = true; if (newValue == 1) { alert('High Impact cannot be set on a list view.'); saveAndClose = false; } callback(saveAndClose); }

 

 

This example uses the newValue parameter to check the value the impact has been set to. If it has high or 1 as the value of the field, which we need to use in scripts rather than labels, then the user is alerted through a message. By setting the saveAndClose variable to false, we can also stop the field from being updated. This is because the callback is using this variable, and therefore also sets the callback to false.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

11 REPLIES 11

Don’t hide it. Create a Client Script oncell edit, and if the user selects Closed – Skipped, show an error message.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @Dr Atul G- LNG , can you provide the exact script here so that i can try it?

 

Thanks,

Sattar

Like this:

 

For this example, we will ensure that a user does not enter a high impact into a cell to force them to open up the form view to do this:

 

function onCellEdit(sysIDs, table, oldValues, newValue, callback) { var saveAndClose = true; if (newValue == 1) { alert('High Impact cannot be set on a list view.'); saveAndClose = false; } callback(saveAndClose); }

 

 

This example uses the newValue parameter to check the value the impact has been set to. If it has high or 1 as the value of the field, which we need to use in scripts rather than labels, then the user is alerted through a message. By setting the saveAndClose variable to false, we can also stop the field from being updated. This is because the callback is using this variable, and therefore also sets the callback to false.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

@Dr Atul G- LNG i tried that script it worked, thanks for your reply as well.

 

Thanks,

Sattar

Glad it works. Please accept the answer 🙂

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************