updating company name doesn't update display name

brkelly
Kilo Expert

When updating company names, the display names of products do not update, the business rules appear to be set to run on update.

I am specifically looking at SW model, but I notice this with HW model as well.

The default scripts - below are set to run on insert, and update. I think these are the only business rules populating the Display name.   ??

I have updated the Company name - didn't update display name.

Then I made a change to a model, to force an update, and still the display name didn't update.

I even tried updating on 'Query' on both business rule scripts below, which had no visible effect.

The only way I was able to update the company (model manufacturer) was to change it to a different company and change it back.   This makes any change to a company name pretty annoying.

------Calculate Display name--------------------------------------------------------------

var values = [current.manufacturer.getDisplayValue(), current.name, current.version, current.edition];

var displayName = '';

if (values[1].toLowerCase().indexOf(values[0].toLowerCase()) != -1 && 'true'.equals(gs.getProperty('glide.cmdb_model.display_name.shorten')))

  values[0] = '';

for (var i = 0; i < values.length; i++){

  if (values[i] != undefined && values[i] != '')

  displayName += ' ' + values[i];

}

current.display_name = displayName.trim();

-------Update Asset Display name-------------------------------------------------------------

updateAssets(current);

function updateAssets(current) {

  var asset = new GlideRecord("alm_asset");

  asset.addQuery("model", current.sys_id);

  asset.query();

  while (asset.next()) {

  if (new AssetUtils().calculateDisplayName(asset))

  asset.update();

  }

}

------------------------------------------------------------------------------------------------------------

Any help would be greatly appreciated. I feel like I must be looking in the wrong place.

Brian

7 REPLIES 7

brkelly
Kilo Expert

Thank you So much Ben, I really appreciate your responses.   I am a bit frustrated that this functionality isn't in the system. Horribly it isn't in any of these systems and organizations complain when data gets stale.   This is a core component of Access Management.



I need to be able to manage the life-cycle of certain fields, specifically reference fields.   The most common use I can think of would be the User field, but also for companies, groups and maybe others.



Use case:


Asset table, Owner reference field.   This field needs to be maintained.   The user changes positions/leaves whatever trigger.   The user table notices the change to the user, executes a call to see what related tables have fields that have a life-cycle.   Fields with a life-cycle are notified of the changed record and kick off a process (service request/Workflow?) to ensure the field is correct.



Data certification, seems very clunky and manual.   Data Certification would be needed for critical fields but you wouldn't want to build this for every field that needed a life-cycle.



Couldn't the user table have a business rule on change that evaluates related records? (glide)


The related reference fields then would kick off a life-cycle if set to do so.


Clearly you wouldn't want this on most Sys_User fields, (I don't want to update incident records), but there are as many placed you would use this.



Can you see the value in something like that?   It is a real requirement for us to get this in place.


Community Alums
Not applicable

Brian,



I think this is a fantastic idea. As you state, have "things trigger" when certain pieces of information change on the user record. This is important for an individual when someone leaves the company and could launch a process to recapture all used hardware and software assigned to that individual. Even more important if that person is Assigned a lot of hardware in the data center.



This is not something that is built into the system by default, but should not be overly difficult to create. I built something like this for the retirement of an asset for the Asset Management training, but it could be taken to another level by initiating processes from the user record. We track changes and other processes related to CIs and other objects in the environment. We should with users, too. In fact, we might even have something in our HR Service Management, but I haven't looked closely enough. If not, it is a great opportunity.



I'm interested to explore this some more, but I won't have time for a couple weeks to do so.



Thanks for bearing with me as I threw out some potential ideas. Data Certification would be a good follow up validation for the automation you describe here, but I agree, that we can do more with the system.



Thanks,


Ben


brkelly
Kilo Expert

I am unsure of how to do this with as little overhead as possible.   It really seems like something ServiceNow would want to build this in.   I put an 'idea' in for this, but it has no votes.   For every user field on an asset, model, group, ci, there should be a system to manage them.



Each reference table like 'user' or 'company' would have a business rule that would run when something [active/status/title] changed on a record.



Business rule:


Search table 'dictionary' for fields type= 'Reference' & referenced table = 'user' & field 'Life-Cycle' isn't empty


(Add field to dictionary LIFE-CYCLE reference to workflows, show on dictionary when dictionary type= 'Reference')



For each dictionary reference with a matching reference that has a life-cycle execute glide search for records on matching table with reference, and trigger listed life-cycle with the passed variables user, field, table.  



The app could be presented as a list of workflows, requests, business rules and dictionary entries.


Business rules monitor records, evaluate dictionary entries, kick off Catalog Item requests and workflows.



It would give any referenced field on any table the ability to kick off a catalog request.