- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 09:02 AM
I m working on a service catalog item. I have a list of variables which i need to make visible and mandatory on submit for people with certain roles. How to do that using UI policy..
In the UI policy, i selected, "Applies on Requested Items" and removed "Applies on Item Catalog view" checkbox.
Added the UI action as "Visible" and "Mandatory" true
But it doesnt help
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 10:23 AM
I have done the changes. it is wrkg fine now.
Note: kindly change the password. Someone might mis use it.
Harish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 09:07 AM
you should write onload client script
function onLoad() {
if(!g_form.isNewRecord() && g_user.hasRole('rolename'))
{
g_form.setDisplay('fieldname',false);
}
else{
g_form.setDisplay('fieldname',true);
}
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 09:11 AM
Hi,
Since you require these validations on requested item, make the applies flag set for requested item on an onLoad catalog client script and add this code
function onLoad() {
if(g_user.hasRole('rolename')){
g_form.setDisplay('fieldname',true);
g_form.setMandatory('fieldname',true);
}else{
g_form.setDisplay('fieldname',false);
g_form.setMandatory('fieldname',false);
}
}
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 09:14 AM
Hi Kailash,
Please write an onLoad Catalog Client Script and check only 'Applies on Requested Items' & 'Applies on Catalog Tasks'. Please write the script as of below:
if (g_user.hasRole('role_name')){
g_form.setVisible('variable_name', true);
g_form.setMandatory('variable_name', true);
}
else {
g_form.setMandatory('variable_name', false);
g_form.setVisible('variable_name', false);
}
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 09:17 AM
harishkumar alikuttyka amlanpal
I tried adding the below script for time being since i havent created role yet, But the variable appears in my catalog item view itself.. i dont want the requestor to see this variable in the form while they make request.
if(g_form.isNewRecord())
{
g_form.setDisplay('code_is_consistently_formatted',false);
}
else{
g_form.setDisplay('code_is_consistently_formatted',true);
}