In the Risk Register I wants to add new field and it might be read only when user create new Risk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2025 05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2025 05:49 AM
Hello @Nayanja
Try below:
function onLoad() {
if (g_form.isNewRecord()) {
// Only set read-only if no other logic is already applied
if (!g_form.isReadOnly('u_threat_actor')) {
g_form.setReadOnly('u_threat_actor', false);
}
} else {
// check existing configurations before setting read-only
if (!g_form.isReadOnly('u_threat_actor')) {
g_form.setReadOnly('u_threat_actor', true);
}
}
}
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2025 05:52 AM
if the field is readonly because of ACL then you cannot override it
what's happening now when you are using that script?
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
04-07-2025 08:28 PM
@Ankur Bawiskar when I was opening a risk register form that "Treat actor" field shown as read-only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2025 08:48 PM
is there any field level write ACL or UI policy which is making it readonly?
what debugging did you do?
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