- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2024 05:40 AM
I have a requirement to hide categories and subcategories on incident form when users having particular email id who logged in. I have tried the below Script include and on load Client script, please correct it its wrong and a solution would be helpful.
Thanks in Advance
Shruthi
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2024 05:53 AM
why not use field level READ ACL for this?
you are not calling the correct function from GlideAjax, your syntax is wrong
Use this
var HideCategory = Class.create();
HideCategory.prototype = Object.extendsObject(AbstractAjaxProcessor, {
UserID: function() {
var email = gs.getUser().getEmail();
email = email.toString();
if (email.toLowerCase().indexOf('@email.com.au') > -1)
return true;
else
return false;
},
type: 'HideCategory'
});
onLoad
function onLoad(){
var gaa = new GlideAjax('HideCategory');
gaa.addParam('sysparm_name', 'UserID');
gaa.getXMLAnswer(function(answer){
if(answer.toString() == 'true)
g_form.removeOption('category', 'incident');
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2024 05:53 AM
why not use field level READ ACL for this?
you are not calling the correct function from GlideAjax, your syntax is wrong
Use this
var HideCategory = Class.create();
HideCategory.prototype = Object.extendsObject(AbstractAjaxProcessor, {
UserID: function() {
var email = gs.getUser().getEmail();
email = email.toString();
if (email.toLowerCase().indexOf('@email.com.au') > -1)
return true;
else
return false;
},
type: 'HideCategory'
});
onLoad
function onLoad(){
var gaa = new GlideAjax('HideCategory');
gaa.addParam('sysparm_name', 'UserID');
gaa.getXMLAnswer(function(answer){
if(answer.toString() == 'true)
g_form.removeOption('category', 'incident');
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader