- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 02:07 PM
Hello SN experts,
I have a very simple request to restrict the 'Urgency' and 'State' fields on the incident form when in Self Service ('ess') view. I have a dictionary override on those fields and also wrote an onLoad client script (unchecking the 'Global' checkbox and on view field = ess) to accomplish this but it is not working. The fields are editable regardless of view. Can someone please tell me what I am doing wrong or if there is a better way to accomplish this. I've also tried to restrict those fields via UI Policy but that had no impact to the fields either.
My Script:
function onLoad() {
//By Default the 'urgency' and 'state' fields can be edited
g_form.setReadOnly('urgency', false);
g_form.setReadOnly('state',false);
//Check current view
var currentView = getView();
//If user is using 'ess' [Self Service] view then make 'urgency' and 'state' fields readonly
if(currentView == 'ess'){
g_form.setReadOnly('urgency',true);
g_form.setReadOnly('state',true);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 03:50 PM
This problem happens because there is another UI Policy running on this table and it is making the fields editable again.
There are two alternatives to deal with this:
1- Check which UI Policy is conflicting and change its conditions.
2- Change the order of your Police UI to a high value like 999999, forcing it to be the last to run and consequently leaving the read-only field.
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 03:12 PM
Hi @Still Learning
I believe the best solution is to create a Police UI for this.
Just set the Global field to false and the view field will appear
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 03:36 PM
Hello @Vanderlei
Thank you so much for your reply. I've actually tried to get this to work via UI Policy but for some reason it does not work. Please see the screenshot of my UI Policy below and the result of it on the incident form. Should I script out the readonly fields? Or any other suggestions? Please advise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 03:50 PM
This problem happens because there is another UI Policy running on this table and it is making the fields editable again.
There are two alternatives to deal with this:
1- Check which UI Policy is conflicting and change its conditions.
2- Change the order of your Police UI to a high value like 999999, forcing it to be the last to run and consequently leaving the read-only field.
If my answer helped you, please mark my answer as helpful.
Vanderlei Catione Junior | LinkedIn
Senior ServicePortal Developer / TechLead at The Cloud People
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2023 04:10 PM
Thank you so much!! Changing the order to an increased value is what was needed to get it to work. Your solution worked. Thank you so very much!!