- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 10:06 PM
Hi All,
How can I hide a variable only in Service Portal? The variable must be visible in native self service catalog.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 10:18 PM
Hey Geeky,
You can use a UI policy or Client script to hide the variable, and make sure the Run scripts in UI type field is set to Mobile/Service Portal. In that case it will only run on service portal and not in the standard catalog view.
It's the most simple way to achieve the solution you want. If my answer helps then please mark it Correct and Helpful.
Thanks and Regards:
Utpal Dutta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 10:12 PM
Hi,
you can have onload catalog client script for this and check whether it is SP page
function onLoad(){
var url = top.location.href;
if(url.indexOf('/sp') > -1){
// this is sp page and hide the variable
g_form.setDisplay('variableName', false);
}
}
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 10:18 PM
Hey Geeky,
You can use a UI policy or Client script to hide the variable, and make sure the Run scripts in UI type field is set to Mobile/Service Portal. In that case it will only run on service portal and not in the standard catalog view.
It's the most simple way to achieve the solution you want. If my answer helps then please mark it Correct and Helpful.
Thanks and Regards:
Utpal Dutta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 10:37 PM
Hi,
You can write a Client script on the catalog item to hide the variables in Service Portal. You will find a choice list field called "UI Type" where you have to choose Mobile/Service Portal option.
You can also use Catalog UI Policy:
You can also refer the below link for better understanding:
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Regards,
Subhojit Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2020 07:13 AM
Hi,
Any update on this?
Can you mark answer as ✅ correct, 👍 helpful if you were able to achieve the requirement. This enables other members to learn from this thread.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader