- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2025 01:59 AM
Trying to design a catalog form where if the it checks the logged in user - and if that user’s “Is Manager” property = true, then one of the attachment variable that required for manager approval is hidden.
From what I’ve found online this needs to be done as client script instead of catalog UI policy - is that correct? I’m having trouble scripting this one and would be grateful for any ideas. Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2025 07:03 AM
Hi @Dee123 ,
you can create a catalog client script please follow below steps -
- Name: Hide Manager Attachment
- Catalog Item: Select your item
- UI Type: All or Desktop
- Type: onLoad
function onLoad() {
// Get the logged-in user's sys_id
var userSysId = g_user.userID;
// Call a GlideAjax script to check if the user is a manager
var ga = new GlideAjax('CheckIfManager');
ga.addParam('sysparm_name', 'isUserManager');
ga.addParam('sysparm_user_id', userSysId);
ga.getXMLAnswer(function(response) {
var isManager = response;
if (isManager == 'true') {
// Hide the attachment variable (replace 'attachment_variable_name' with actual name)
g_form.setDisplay('attachment_variable_name', false);
}
});
}Please mark it as complete if this resolved your query and close the thread .
Thanks,
Rithika.ch
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2025 07:26 AM
it's an easy requirement with onLoad catalog client script + GlideAjax
what did you start with and where are you stuck?
GlideAjax Example Cheat Sheet (UPDATED)
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
09-25-2025 07:44 PM
@ChallaR I used exactly the same script you provided - only changed the variable name for 'attachment_variable_name' 🙂 It appears the error was due to 'CheckIfManager' being called when it did not exist in my instance.
I was able to find a purely client-side solution that does not involve a script include 🙂 Thanks again for your time, will close this thread now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2025 05:27 AM
@Dee123 Happy to help , your welcome 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2025 07:26 AM
it's an easy requirement with onLoad catalog client script + GlideAjax
what did you start with and where are you stuck?
GlideAjax Example Cheat Sheet (UPDATED)
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
09-25-2025 07:45 PM
Hi @Ankur Bawiskar - I was able to find a purely client-side solution that does not involve a GlideAjax script 🙂 Thanks again for your time, will close this thread now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2025 08:05 PM
Thank you for marking my response as helpful.
As per new community feature you can mark multiple responses as correct.
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
