In IDM how do you set a default value using other attributes

For example, I want an attribute cn to consist of the first and last name of the user when I create the user and update when I edit the user. Is there a way to set that so it automatically updates the cn value when the user first or last name is created or updated?

Hi @rob.kimball

Are you talking about modifying the attributes in one system or managed object (system X) and using the value of the attributes from system X to generate the value of an attribute in system Y? Or are you looking to have this all happen within a single system (e.g. modify first name in system X and that results in an update to the cn in system X)?
The former would be straightforward and would just be handled with a sync mapping. The latter could presumably be done by specifying the target and source to be the same, but I can’t say I’ve ever done something like that and it’s possible IDM would reject that. You’d also have the possible challenge of reconciling discrepancies between other potential sources for that same system (e.g. a managed user object that is mapped to this system).

I’m asking about when I create the IDM user. no targets involved. If I create a user and want to auto populate an attribute, for example a display name field. How do I auto populate it with say “FirstName LastName” so that I do not have to type it manually when I create the user?

Ok, so you are referring to a managed/user object? If so, there are two places I could see this touching:

  1. From a UI standpoint (assuming you are using the OOB UI), there isn’t really a way to accomplish this although you could certainly write some JS code yourself to handle this but there are implications to this when you upgrade.
  2. From an update standpoint (i.e. when you submit the updated user) you could absolutely handle this via a script trigger (see: Script triggers defined in the managed object configuration :: IDM 7.4.0) which you could use onCreate and onUpdate
1 Like

ahhh. yeah, I think OnCreate or PostCreate and OnUpdate or PostUpdate is what I’m looking for if it allows me to do something simple like object.displayname = object.sn + " " + object.givenName or some such.

1 Like

can I call attributes in oncreate scripts like this?

Can you clarify what you mean by that?

Confirmed it worked. For those interested. If you need to auto-populate an attribute when creating a user, such as displayName, here’s how you do it:

  1. In managed objects, assuming you have a displayName attribute, go to user ->scripts
  2. Add an onCreate and onUpdate script with the following example content
    object.displayName=object.givenName + " " + object.sn;
  3. now when you create a user, the displayName will now update with the users first and last name during both create and update using the values of givenName and sn.
1 Like

Hey Rob, Thank you so much for sharing this solution with the community! Your instructions are much appreciated, and I’m confident that it will be a valuable addition for those who are looking for a solution to this use case! :+1:

1 Like