how to make field read only on the other form without using ui policy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 03:55 AM - edited 05-07-2025 04:00 AM
here in the above table whenevr state is updated to missing we have configuration item field which is referenced to cmdb_ci table in this table some fields like assigned_to etc.. these fields should be made as read only
i tried ui policy actions dot walking on ci table but its not working could anyone provide me solution for this
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 04:59 AM - edited 05-07-2025 05:00 AM
Hello @Teja3 ,
Please configure the Computer CI form and add the "Asset.State" field.
Then create the UI Policy on the cmdb_ci_computer table, with the condition Asset.State = Missing, making the Assigned to read only.
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 05:12 AM
@Teja3- You will have to create this UI Policy from cmdb_ci_computer table and dot walk from Asset field which is already mapped to alm_asset related record.
See snip below.
Result -
Let me know if it worked!
Regards,
Vikas K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 05:21 AM
so on cmdb_ci record you want some fields to be read-only if the Hardware record is with State as Missing?
you can use display business rule on cmdb_ci_computer table and get the state of asset and store in g_scratchpad variable
Display BR:
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
if (current.asset.state.toString() == '8')
g_scratchpad.makeReadOnly = 'true';
else
g_scratchpad.makeReadOnly = 'false';
})(current, previous);
Then use onload client script on cmdb_ci_computer table and use that scratchpad variable
function onLoad() {
if (g_scratchpad.makeReadOnly == 'true') {
g_form.setReadOnly('assigned_to', true);
// add other field also
}
}
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
05-08-2025 04:09 AM
Thanks for your solution.
Actually not only on cmdb_Ci_computer table in the alm_hardware table where we have current ci field which is reference to the other table in that we need to set read only for some fields