I am trying to make specifc fields to be only visible to certain roles on the RITM and Tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 01:48 PM
Hello all,
I have developed a catalog item (form) that ALL the fields should be visible to ALL users.
However, once the form is submitted, due to the sensitive nature of some of the fields, I'll like to make those fields ONLY visible to users with specific roles on the RITM and SCTask.
I have used the Read roles on the Variables, which didn't work - it hid those fields everywhere, including from catalog view for those without the roles.
What's my option?
Thank you
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 02:21 PM
Hi @Hola Ola ,
You can create Catalog ui policy and mark the checkbox only for catalog task and requested item. See the screenshot.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 10:43 PM
write a client script on sc_task and sc_ritm
Create Client script
if(g_form.getValue('cat_item') =='your item sys_id'){
var ga=new GlideAjax('script include name');
ga.addParam('sysparm_name','funcName');
ga.getXmlAnswer(function(answer){
if(answer=='true'){
g_form.setDisplay('variable_name',true);
}else{
g_form.setDisplay('variable_name',false);
}
})
}
Script include
funcName:function(){
if(gs.hasRole('role_name')){
return true;
}else{
return false;
}
}
____________________________________________________________________________________________________________
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2024 07:17 AM
Hello @Suraj Sharma
Thank you for your response. I have tried your suggestion but I may be doing something wrong. Here is what I have, which is not working;
Client Script:
function onLoad() {
//Type appropriate comment here, and begin script below
if(g_form.getValue('Language Access Services') =='b66db415c3dfc6101f74900f05013150'){
var ga=new GlideAjax('languageservicesformonsubmission');
ga.addParam('sysparm_name','funcName');
ga.getXmlAnswer(function(answer){
if(answer=='true'){
g_form.setDisplay('inpatient_unit_inpatient',true);
g_form.setDisplay('inpatient_unit_screening',true);
g_form.setDisplay('more_information',true);
g_form.setDisplay('patients_mrn',true);
g_form.setDisplay('patients_mrn_admission',true);
g_form.setDisplay('patients_mrn_surgeries',true);
g_form.setDisplay('patients_mrn_virtual',true);
g_form.setDisplay('patients_name',true);
g_form.setDisplay('patients_name_admission',true);
g_form.setDisplay('patients_name_surgeries',true);
g_form.setDisplay('patients_name_virtual',true);
g_form.setDisplay('patient_phone_number_conference_call',true);
g_form.setDisplay('preop_bay_number_surgeries',true);
g_form.setDisplay('room_number_inpatient',true);
g_form.setDisplay('room_number_outpatient',true);
}else{
g_form.setDisplay('inpatient_unit_inpatient',false);
g_form.setDisplay('inpatient_unit_screening',false);
g_form.setDisplay('more_information',false);
g_form.setDisplay('patients_mrn',false);
g_form.setDisplay('patients_mrn_admission',false);
g_form.setDisplay('patients_mrn_surgeries',false);
g_form.setDisplay('patients_mrn_virtual',false);
g_form.setDisplay('patients_name',false);
g_form.setDisplay('patients_name_admission',false);
g_form.setDisplay('patients_name_surgeries',false);
g_form.setDisplay('patients_name_virtual',false);
g_form.setDisplay('patient_phone_number_conference_call',false);
g_form.setDisplay('preop_bay_number_surgeries',false);
g_form.setDisplay('room_number_inpatient',false);
g_form.setDisplay('room_number_outpatient',false);
}
})
}
}
Script Include:
funcName:function(){
if(gs.hasRole('language_services_options_view')){
return true;
}else{
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2024 01:44 PM
See your script include is not right
please mark my answer helpfull
for more - ss043532@gmail.com