The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Hardware Asset Workspace

kalpeshjath
Tera Contributor

Hi All,

Requirement : 

I want only specific attributes to be editable for certain user group on alm_hardware table. The attributes which i want to be editable are 'install_status', 'substatus', 'assigned_to', 'asset_function', 'work_notes'. Apart from this attributes rest all attributes should be greyed out and not editable. The users are updating the details of assets from Hardware Asset Workspace - Asset Estate - Hardware Assets. 

 

Please can someone help me on the same and let me know if this can be done. As I tried a lot but not able to figure out how can i do it. 

13 REPLIES 13

@kalpeshjath 

Did you get a chance to check the script (client script + display business rule) I shared above?

It should work fine as you mentioned you cannot go with the ACL approach

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

 

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

Hi Ankur,

I am checking it but its not working. I just have one thing to confirm. In the client script you mentioned where it is mentioned about the group name to whom it is applicable. Also the Group name what we have contains INF-IO-DS-FS- after FS- there are different locations. 

Hi Ankur,

 

I checked it and its not working. 

NehaSNOW
Tera Guru

Hi @kalpeshjath ,

 

1) Create the Display Business Rule on the alm_hardware table: -

NehaSNOW_0-1746132352285.png

 

2) On the Advanced tab, paste the below script: -

(function executeRule(current, previous /*null when async*/) {

    // if the User doesn't belong to the certain group, let's say, "Asset Mgr". then make the fields Read-Only.

    if(!(gs.getUser().isMemberOf('Asset Mgr')))
    {
        g_scratchpad.makefieldreadonly = 1;  
    }

})(current, previous);
 
3) Then Create the onLoad Client Script on the alm_hardware table like below: -
 
NehaSNOW_1-1746132603871.png

 

4) On the Script section, paste the below Script: -

function onLoad() {
   if(g_scratchpad.makefieldreadonly ==1)
   {
    g_form.setReadOnly('install_status', true);
    g_form.setReadOnly('substatus', true);
    g_form.setReadOnly('assigned_to', true);
    g_form.setReadOnly('asset_function', true);
    g_form.setReadOnly('work_notes', true);
   }
}
 
Kindle Note: - In the Step 2) replace 'Asset Mgr' group with your Group to whom you want to show the fields Editable. I used 'Asset Mgr' just for example.

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

Regards,
Neha Pateria