VikMach
Mega Sage

@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.

Vikas1_0-1746619833772.png

 

Vikas1_1-1746619904007.png



Result -

Vikas1_2-1746619931228.png



Let me know if it worked!

Regards,
Vikas K



Ankur Bawiskar
Tera Patron

@Teja3 

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.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

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

Teja3_0-1746702483311.png

 

@Teja3 

Thank you for marking my response as helpful.

I believe I answered your original question where you want to make fields on CI table readonly based on Assets->State (Missing)

If you want to make fields readonly on Hardware table itself then it's simply UI policy on hardware table

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Teja3 

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.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader