CI insert, asset state not set correctly

Mike Hashemi
Kilo Sage

When we create a computer CI, the value of install_status is 1 (Installed). As expected, a hardware asset record is created (model category, computer), but the value of state is 2 (On order). It is my understanding that, because of the "Asset CI Install Status Mappings" records, the CI's "Installed" should make the asset "In use". I did verify that there is a two-way mapping of state/install_status for assets/CIs where the state value is "In use" and the install_status value is "Installed". Additionally, I can see that the AssetAndCISynchronizer script include has been updated to reflect the changes recommended in https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0717902.

 

When I modify the CI's install_status (e.g. Installed to In stock), the asset's state switches correctly. Then, changing the CI back to Installed, the asset is set as "In use".

 

As far as I can tell, there are no business rules (other than the customized "Update Asset fields on change") or flows setting the asset to 'On order'. Finally, as far as I can tell, the Create Asset on insert BR and AssetandCI script include are OOB.

 

Why, on insert, are the CIs' install_status not correctly setting the assets'?

1 ACCEPTED SOLUTION

Mike Hashemi
Kilo Sage

Turns out it was the default value on the field. I thought it should take the value from the CI on creation, but apparently now.

View solution in original post

3 REPLIES 3

Mark Manders
Mega Patron

My PDI is taking ages to wake up, so I can't verify it (yet), but logically thinking, creating the CI isn't done the moment it is handed over to a user. That's done later. So to me, only thinking in real world logic, without validating code in ServiceNow, when you create a CI (computer), it creates the asset, but it only should be set to 'in use' when it's assigned to a user (having it on a shelf in a stockroom, where the computer starts at a company, shouldn't put it in use). 
Is there any logic 'on insert' of an asset that maybe sets the status to 'on order' ?

I'll set of the alarm for my PDI again, to see it it will wake up and update you if I find a cause in the OOB code.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Mike Hashemi
Kilo Sage

Turns out it was the default value on the field. I thought it should take the value from the CI on creation, but apparently now.

SK Chand Basha
Giga Sage

Hi @Mike Hashemi 

In the Asset CI mapping table you can see the proper mapping between the both tables.