
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2018 11:06 PM
Hi All,
Is it possible to to make variables editable on catalog task form based on user roles by using Client Script??...
The requirement is some variables should be editable for ITIL users
Can someone help me with this?
Thanks and Regards,
Angshuman
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2018 11:13 PM
Yes, It is possible. You can write a client script like if user has role set field to writable else readable.
var rqdrole = g_user.hasRole('RoleName');
if (rqdrole){
g_form.setReadonly('fieldname',false);
}
Hope this helps.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 05:56 AM
Did you try it with the UI policy??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 09:32 PM
Hey,
Yup I tried with UI Policy, it didn't work. But, with Client script it worked, so I had to modify some part of your code....
But thanks a lot for the help...!! 🙂
Thanks,
Angshuman

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 09:35 PM
Could you please let me know what did you modify to make it work?
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 09:52 PM
Hi Bhawana,
This is the code which I used,
function onLoad() {
if (!g_user.hasRole('admin')) {
if (item =='CATALOG_ITEM_NAME' && item =='CATALOG_ITEM_NAME') {
g_form.setVariablesReadOnly(true);
g_form.setReadOnly('FIELD_NAME', false);
}
}
}
I hope this might help you..!!
Thanks,
Angshuman

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 10:01 PM
Thanks much for the information! 🙂