Restricting fields on incident form based on view

Still Learning
Kilo Sage

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);
	}
}

 

1 ACCEPTED SOLUTION

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



View solution in original post

5 REPLIES 5

Hi, 

 

I applied the solution I want to make urgency filed non mandatory but it's not working.