Make some variables editable in catalog item Requested form(sc_req_request) for a group of users
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 05:22 AM
Hello Experts,
Now in my catalog item requested form the variables are read only, I want to make the variables editable for the particular group. Please suggest.
How to achieve this functionality.
Labels:
- Labels:
-
Service Catalog
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 05:37 AM
Hi
Client Script :- OnLoad on RITM
function onLoad() {
var ritm = g_form.getValue('request_item');
var ag = g_form.getValue('assignment_group');
var usr = g_user.userID;
var ga = new GlideAjax("userUtils"); //name of script include
ga.addParam("sysparm_name","getDetails"); //name of function
ga.addParam("sysparm_user", usr);
ga.getXMLAnswer(callBack); //name of call back function
function callBack(answer) {
if(answer == 'not editable'){
g_form.setVariablesReadOnly(true);
}
}
}
Script Include:- Checkbox check: Client Callable
var userUtils = Class.create();
userUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getDetails: function(){
var answer = 'editable';
var usr = this.getParameter("sysparm_user");
if(!gs.getUser(usr).isMemberOf('sys_id of group')){
answer = 'not editable';
}
return answer;
},
type: 'userUtils'
});
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Gunjan Kiratkar
Consultant - ServiceNow, Cloudaction
Rising Star 2022
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2022 11:25 PM
Hi gunjan,
var ritm = g_form.getValue('request_item'); - What we have to pass in (request_item)
Is it should be the name of catalog item?