Make form fields readonly and also editable on service portal form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-29-2023 11:01 AM
Hi
I have requirement in service portal there is incident detail form.
In that form i have to make all fields readable and and only one field editable it will applicable to all user.
for example watchlist field should be editable in incident form and all other fields should be readable only. And watchlist person and caller should able to edit .
can some one help me with this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-29-2023 11:53 AM
Hi Avdhoot,
You can start here: https://docs.servicenow.com/search?q=UI%20policies
A 'UI Policies' can be used to do that. Check those in your instance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-29-2023 12:51 PM
A UI Policy alone will not help you here.
I'd do the following:
1.) Create new Form View (e.g. "sp_reduced"): Configure -> Form Layout -> View Name -> New... -> "sp_reduced"
2.) Create a UI Policy which makes all fields readonly (note: Set "Global = false" and "View = sp_reduced")
3.) Create a view rule (Advanced = True, Type = Browser) which only runs on the serviceportal and will force the view to "sp_reduced"
(function overrideView(view, is_list) {
if (gs.action.getGlideURI().toString().startsWith('api/now/sp')) {
// force view on portal
answer = 'sp_reduced';
} else {
answer = null;
}
})(view, is_list);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā06-29-2023 01:03 PM
You want to use a UI policy if the read only is dependent on other values, however if this isnt the case you can go into the variable and set it as "read only".
Please mark as helpful or if its resolved the issue CORRECT!