Restrict location field value change when assigned to changes in hardware asset table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 05:21 AM
Hello everyone,
I have a requirement where I have to restrict the on-change client script "Set Loc/CC/Dep/Com from assigned to" in the alm_asset table from changing the location and other fields when the substate is set as leaver.
I set the substate value via a transform map and if it is set as Leaver then whenever the assigned to is changed the location value should not be changed.
Any suggestions is appreciated.
-Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 05:30 AM
why not make that location field as read only when form loads and in that onLoad client script check substate=leaver
function onLoad() {
if (g_form.getValue('substate') == 'Leaver')
g_form.setReadOnly('location', true);
}
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
01-05-2025 05:28 AM
Hope you are doing good.
Did my reply answer your question?
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
01-05-2025 08:46 PM
Hi @Ankur Bawiskar,
Thanks for the response.
The location field is changed in the background by client script, so even after making it read-only it is getting amended.
I am trying alternate option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2025 08:48 PM
which client script is doing that?
I didn't get your business requirement
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader