Help
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Jim Coyne
Kilo Patron

You may find yourself in a situation where the data in AD is not 100% correct (it never is) and making the corrections in AD could take a while.  For instance, you may find half of your AD records have the "company" attribute set to "ACME Corporation" and the other half set to "ACME Corp".

 

Instead of waiting for the data to be updated, one solution to work around this issue is to create a new field on the Company table to hold a second name found in AD that we want to match on:

 

 find_real_file.png

 

You will probably want to check the "Unique" field on the Dictionary Entry for the new field you create to ensure each new entry is unique.  That should create a new index for you as well, speeding up searches on the field.

 

We leverage this new field by changing the Field Map for the Company field to use a script instead of the source field.  The following script will match the AD info with either the "Name" or the new custom "Name used in Active Directory" field:

 

answer = (function() {
    var sourceData = source.getValue("u_company");
    var gr = new GlideRecord("core_company");
    gr.addEncodedQuery("name=" + sourceData + "^ORu_ad_name=" + sourceData);
    gr.query();
    if (gr.next()) {
        return gr.getValue("sys_id");
    }
    return -1;
})();

 

It's a simple way to move on with the user imports without having to wait for all the data cleanup.  And it keeps working after any data cleanup operation (i.e. someone puts the "wrong" data in again later on).  The same solution can be used for any reference field, such as the Location and Department fields.

2 Comments