User Location Field from LDAP?

jesusemelendezm
Mega Guru

Hi SN developers,

How are you mapping or calculating this field from LDAP location related fields?

Thanks for your input.

Jesus

1 ACCEPTED SOLUTION

Thank you Shashank for giving reference of the blog for LDAP.



Jesus Melendez, User attributes object stores Location information across different AD attributes like st (for state), c (for country), physicaldeliveryofficename (for City) and streetaddress for (Street).



I have created a transform map so that, based on these attributes, map will automatically create a parent child relationship across different attributes.



e.g. Country would be the parent for state and state would be the parent for city and so on.



Moreover, when you open up the user record, on the location field, you will have it displayed as the combination of (streetaddress + city + state). I have also taken care of any of these 3 missing entries. For that I had to create 2^3 = 8 combinations of if and else statements.


View solution in original post

6 REPLIES 6

randrews
Tera Guru

we had the AD group load those fields from their ldap feed into fim.. and we synch with fim we feed from there.. you can do the same in AD assuming your admin group has a feed from hr into ad... you just need the source field names to map


There is not a location attribute/field in AD but you do have location related fields in AD -address, city, postal code, etc. How are you making up the "Location" information for each user in ServiceNow??


Hi Jesus,



The way I have handled this type of situations on which you have related information to a reference field such as Location is by handling the transformation within the script field of the transform map.



As an example, you could you something like:



var locationSysID = ldapUtils.addLocation(source.u_field1, source.u_field2);


if (JSUtil.notNil(locationSysID)) target.location = locationSysID;



where:



a) addLocation is your own custom method created in a Script Include. In this case created within the ldapUtils script include. This custom method should handle the situation to create or to update the Location.


b) addLocation receives as parameter all the other fields you mentioned you have available in LDAP. Based on one of these you should be able to correlate or compute that what is or it's going to be the actual location name.


c) the addLocation function returns the sysid of the location created or updated, the one is later assigned to the user's location.



I hope this is helpful!



Saludos y bendiciones!




Thanks,


Berny


bernyalvarado
Mega Sage

Hi Jesus, would you mind if we can close this thread by marking the responses as helpful/correct?



Thanks,


Berny