Need to make a Variable Readonly and Mandatory both
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi Team,
I have a requirement in a Catalog Item where I need to make a variable both Mandatory and Read-only, even though it is not predefined as such.
Is it possible to make a variable Mandatory and Read-only at the same time?
If yes, what would be the best practice to achieve this (UI Policy or Client Script)?
Any guidance would be appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @JyotiranjanC566,
That isn’t possible. You can make the field read-only after it has been populated, but it cannot remain mandatory at the same time.
To achieve this behavior, you’ll need to uncheck the Mandatory option on the variable and instead use a Client Script or UI Policy to dynamically control when the field is mandatory and when it becomes read-only.
You can also refer to a similar discussion in the ServiceNow Community thread here:
Solved: Re: How to set variables field both as mandatory a… - ServiceNow Community
If my response helped, please mark it as the accepted solution so others can benefit as well.
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.
