- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-19-2018 10:27 PM
I have observed that sync in state between Asset and CI's (hardware state sync) might not work as intended.
If I update an Asset record manually then all fields inkl state are synced as designed, but if the Asset is updated from a script (GlideRecord) all fields EXCEPT state gets synced ?
Anyone else who have observed this behaviour ?
To reproduce:
1. Go to an hardware asset (alm_hardware) with an attached CI.
Change the state (install_status) in the Asset and see that hardware_status and substatus changes as it should on the CI.
Assigned to on asset can be set as well - and also gets synced.
Now if you do the same, just with a script:
I have tested this from a simple fix script - but i know that workflow scripts suffers from the same
var asset = new GlideRecord('alm_hardware');
asset.get('<insert asset sys_id>');
asset.install_status = 1;
asset.company = gs.getUser().getCompanyID();
asset.assigned_to = gs.getUserID();
asset.update();
This sync's Company, Assigned to and State is set on the Asset but the State is NOT sync'ed to the CI.
Anyone who have an idea on how to solve this ?
Regards
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2018 03:52 AM
Hi, if i understood it correctly the state 1--->inuse it dont have any sub state to update.
sample: try this one
var asset = new GlideRecord('alm_hardware');
asset.get('00a96c0d3790200044e0bfc8bcbe5dc3');
asset.install_status = 7;//retired state
asset.substatus = 'donated';//gave the dependent sub state
asset.company = gs.getUser().getCompanyID();
asset.assigned_to = gs.getUserID();
asset.update();
https://docs.servicenow.com/bundle/london-it-service-management/page/product/asset-management/concept/c_ManagingAssets.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2018 03:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2018 03:36 AM
Hi Raju,
My dev instance is OOB for CI and Asset - also on London
As i say, other fields on the CI gets updated but not hardware_status and substatus on the CI.
Can you try the script a couple of time while flipping back the state manually on the Asset ?
I also have an Istanbul instance which have the exact same behaviour as my DEV instance.
Manually updated works perfectly but through script - all except State is sync'ed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2018 03:52 AM
Hi, if i understood it correctly the state 1--->inuse it dont have any sub state to update.
sample: try this one
var asset = new GlideRecord('alm_hardware');
asset.get('00a96c0d3790200044e0bfc8bcbe5dc3');
asset.install_status = 7;//retired state
asset.substatus = 'donated';//gave the dependent sub state
asset.company = gs.getUser().getCompanyID();
asset.assigned_to = gs.getUserID();
asset.update();
https://docs.servicenow.com/bundle/london-it-service-management/page/product/asset-management/concept/c_ManagingAssets.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-20-2018 04:14 AM
BINGO!
When using the form to update the State on Asset (substatus is not present on the form) ServiceNow itself changes the substatus field (when "in use" substatus is cleared).
This doesnt happen when setting the State through a script so that needs to be set manually as well.
Pretty inconsistent but it works.
Thanks