
- 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-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-15-2018 11:18 PM
Hi,
Thanks for the information. Will the same work if I want it in the variables??....
Like I want some variables to be editable for ITIL users in Catalog task form..
Thanks,
Angshuman

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2018 11:23 PM
Yes, you can also use UI policy to achieve the same.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2018 03:48 AM
Hi,
I have tried using UI policy both using Run Script and normal UI Policy action, its not working and I am not sure if dot walking is allowed in UI Policy as I used "g_form.setReadonly('variables.variable_name',false)" .
I have also tried the following client script in Catalog Task table :-
function onLoad(){
if (g_user.hasRole('itil')){
g_form.setReadonly('fieldname',false);
}
}
it still didn't work..... 😞
In the RITM form for the same catalog item all the variables are editable for Admin but Read-Only for ITIL users. But, in Catalog Task form it is required editable for both Admin and ITIL users. It is already editable for Admin but for the ITIL users its the same as in RITM Form.
Thanks,
Angshuman