Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

jonsan09
Giga Sage

If you're working in HAM, you may have run into this issue. Hardware asset records with a $0.00 cost even though the Hardware Model cost has been populated (Usually after the creation of the asset records.) This happens due to Hardware Asset cost being populated at the time of the record creation and pulling from the Hardware Model. SN doesn’t have an OOB solution to fill those asset costs when the model cost finally gets populated. This solution should help you, if you ever find yourself in a situation where you need to retroactively update these empty cost values.

“Update Asset Costs” Subflow

I like to keep the bulk of the heavy lifting and actual record updating in a subflow. It makes it modular, you can call it from a scheduled job or even trigger it manually from a UI Action (hint at a future article?) if you just need to fix one specific model on the fly.

1. The Setup
I use two inputs: the Hardware Model (Reference) and a True/False toggle called Override Existing Asset Costs. Usually, you only want to fill in the blanks, but it’s nice to have the option to force a full update if you need existing costs on the asset records.

2. The Safety Check
First, the flow grabs the cost from the Model and drops it into a variable. Add an If condition to check if that cost is $0 or empty. If it is empty, the subflow stops immediately. You don't want to accidentally push a $0 value and overwrite any existing “good” cost values.

3. The Bulk Update
Performance tip, don't use a loop to update assets one by one. Use the Update Multiple Records action on the alm_hardware table instead.

  • If Override is False: Filter by: Model is [Input Model] AND Cost is empty OR Cost is 0.
  • If Override is True: Just filter by the Model.
  • The Action: Map your Model cost variable directly to the Asset Cost field.

chrome_E2wUJLOCMx.png

 

“Populate Asset Costs” Scheduled Flow

You can then pair the previous subflow with a scheduled flow if you want to run this on a set schedule.

1. Set your Schedule
Set your date, time and frequency

2. Finding the Targets
Use a Look Up Records action on the Hardware Model (cmdb_hardware_product_model) table. You only want to grab models that actually have a price now:

  • Model Category is Computer or Mobile Device.
  • Cost is not empty AND Cost is > 0.

3. Iterate through the Models
Use a For Each loop to go through those models and call your Subflow for each one. Keep the Override flag set to False for your standard weekly run, to make sure that you are not overwriting existing cost values.

chrome_KxDY09FhL6.png

 

As always, build and test in your Subprod instances before activating it in Production.

Version history
Last update:
2 hours ago
Updated by:
Contributors