Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Asset Display name with Model display name

Heisenberg
Tera Contributor

Hi,

Need to write a Business rule where asset Display name should update with model display name for all the assets. Even when we create new assets.

Below is the background script I have created, should I use insert and update After business rule on product model table, please advice

var gr = new GlideRecord('alm_asset');
gr.addEncodedQuery('asset_tag=WL1111200677');
gr.query();
if(gr.next()){
gr.display_name = gr.asset_tag+ '-' +gr.model.display_name;
gr.update();
}

Please advice.

 

 

12 REPLIES 12

Hi Rider,

There is no business rule which setworkflow as false, I tried creating an asset by enabling watch on Display name, please find the screenshot there is a ACL running apart from that I didnt find anything still display name shows only model display name.

find_real_file.png

cyked
Mega Guru

with ('asset_tag=WL1111200677'); are you not utilizing a unique AT for each asset in your environment?

Heisenberg
Tera Contributor

Hi,

Yes I am utilizing Unique asset tag for each asset but whenever a new asset is created it doesnt update the display name as per the out of the box business rule, I have to run the fix script whenever the new asset is added, so I am wondering should I run a separate business rule or am I missing something