- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 05:00 AM
Hai To All,
I have created one onload client script and ui policy as follws
1.onload client script:create a onload client script for read only impact and urgency fields based on the role
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 05:16 AM
Hi @siva44,
You need to change the OR to AND in the if statement. it is either not 6 or not 3 so it is always returning true.
function onLoad() {
//Type appropriate comment here, and begin script below
var st = g_form.getValue('state');
if (g_user.hasRoleExactly('priority manager') && (st != 6 && st != 3)) {
setTimeout(function() {g_form.setReadonly('urgency', false);}, 0);
setTimeout(function() {g_form.setReadonly('impact', false);}, 0);
// g_form.setReadonly('urgency', false);
// g_form.setReadonly('impact', false);
} else {
setTimeout(function() { g_form.setReadonly('urgency', true); }, 0);
setTimeout(function() { g_form.setReadonly('impact', true); }, 0);
// g_form.setReadonly('urgency', true);
// g_form.setReadonly('impact', true);
}
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 05:16 AM
Hi @siva44,
You need to change the OR to AND in the if statement. it is either not 6 or not 3 so it is always returning true.
function onLoad() {
//Type appropriate comment here, and begin script below
var st = g_form.getValue('state');
if (g_user.hasRoleExactly('priority manager') && (st != 6 && st != 3)) {
setTimeout(function() {g_form.setReadonly('urgency', false);}, 0);
setTimeout(function() {g_form.setReadonly('impact', false);}, 0);
// g_form.setReadonly('urgency', false);
// g_form.setReadonly('impact', false);
} else {
setTimeout(function() { g_form.setReadonly('urgency', true); }, 0);
setTimeout(function() { g_form.setReadonly('impact', true); }, 0);
// g_form.setReadonly('urgency', true);
// g_form.setReadonly('impact', true);
}
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 06:01 AM
Tq so much peter now it is working fine