Asset Display name with Model display name
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2020 08:53 PM
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.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2020 09:12 PM
Hi Heisenberg,
You don't need to write an additional business rule to do that. But for update you can use the script from previous comment.
There is a Out of the Box Business Rule which executes whenever there is a New Asset is created/updated to set the DISPLAY NAME OF ASSET with "ASSET TAG - MODEL".
Please see the below link to see if that above Business rule is Active/ Inactive
YOUR_INSTANCE_NAME/sys_script.do?sys_id=5814a034eb3321005ecfa9bcf106feb9&sysparm_record_target=sys_script&sysparm_record_row=1&sysparm_record_rows=1&sysparm_record_list=collection%3Dalm_hardware%5EORcollectionINalm_hardware%2Calm_asset%5EnameCONTAINSdisplay%5EORDERBYname
Thanks!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-10-2020 08:18 PM
Hi Heisenberg,
Were you able to find the Business Rule for Setting Asset Display Name?
If you still need to write the business rule to populate Display name. let me know.
Thanks!!
Please mark as correct and helpful, so this can be useful to others!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2020 06:32 AM
Hi,
Why doesnt out of the box business rule Calculate Display Name for alm_asset doesnt work, whenever I create a new asset it only gives the model display name in the Display name field of the asset instead of updating asset tag+ '-' +model.display_name. every time I end up running fix script.
Need understand what does calculate display name business rule does.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-12-2020 07:17 AM
Strange.
I believe OOB Business rule is Active
Can you check if there are any Before Insert Business Rule with Script contains current.setWorkflow(false);
Let me know!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-13-2020 06:33 AM
Hi Heisenberg,
Were you able to find any Before/After Insert Business rule with script contains setWorkfflow(false);
You can use FIELD WATCHER on DISPLAY FIELD NAME in your Asset Record.
Follow these steps to find the route cause:
1. Pick any Asset record, in the display name field > right click and select Watch display_name and change the Asset Tag.
2. Follow this docs site for how FIELD WATCHER works in servicenow.
3. see what all Business rules are executed on that field.
https://YOUR_INSTANCE_NAME.service-now.com/nav_to.do?uri=sys_script.do?sys_id=5814a034eb3321005ecfa9bcf106feb9
Let me know if you have any questions!!