- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 05:13 AM
Hello,
I have the following requirement.
I want to have a field on Service Portal's form, that is read only. It will contain a value but the end user can not change it.
Is this possible?Any ideas?
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 05:44 AM
Hi,
you can create onload catalog client script and
1) set the UI Type as Mobile/ Service Portal so that this script executes only for portal and not for native
2) Applies to Catalog Item - true
3) Catalog item - Select your catalog item
4) Type - onLoad
5) Applies on Catalog Item view - true
function onLoad(){
g_form.setReadOnly('city', true);
}
Regards
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
‎09-01-2020 05:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 06:46 AM
It seems really helpful but in my case, it does not work. Any ideas?? Do I need to make a script also?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 06:52 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 07:53 AM
While I love UI Policies, using Run Scripts is a bit complicated here as you'd still need something to key off of in the condition builder.
Create an onLoad Catalog Client Script that only runs in the Mobile/Service Portal UI Type, and put in g_form.setReadOnly('your_var_name',true); This should set the variable Read Only, only within those UI Types and not Desktop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2020 08:06 AM
Hi,
Seems like it is Single Line Variable you used.in Variables of catalog Item you can Set the Default
Value as 'XYZ' for City Variable.
You can use the UI policy for Catalog Item give the condition 'is not empty' and apply as Read Only.
here as per your scenario you want update the City variable by default name display before displaying on Service Portal.
Thanks,
Shekhar Deshingkar,