Implementing uidTransformations Based on Department Codes

:bangbang: Please be sure you’ve read the docs and API specs before asking for help. Also, please be sure you’ve searched the forum for your answer before you create a new topic.

Hi all,

I’m exploring the possibility of modifying user IDs (uid) by appending a prefix based on their department code. Specifically, if the department code is ‘A’, then we prepend ‘2’ to the UID. If the department code is ‘B’, then ‘3’ is prepended.

Is there a standard method or transformation rule within IT systems to achieve this?
Any guidance on how to implement this or pointers to relevant resources would be greatly appreciated.

Thanks for your help!

Hi @joyoon00,

Static Transforms are one way of achieving this :

You can create a transform and modify the UID value based on the department name.

Below is a sample one you can try out.

{
    "name": "UID_Transform",
    "type": "static",
    "attributes": {
        "Department": {
            "attributes": {
                "attributeName": "Department_attribute_name",
                "sourceName": "Your_Source"
            },
            "type": "accountAttribute"
        },
        "EmployeeID": {
            "attributes": {
                "attributeName": "EmployeeId_attribute_name",
                "sourceName": "Your_Source"
            },
            "type": "accountAttribute"
        },
        "value": "#if($Department=='A')1$EmployeeID#elseif($Department=='B')2$EmployeeID{else}3$EmployeeID#end"
    },
    "internal": false
}
2 Likes

Hi @joyoon00

Static Transform does work as stated by @jesvin90

I suggest to go with lookup transform to calculate prefix based on department code.

If you calculate conditions in if conditions inside value entry in static transform, you will end up changing the conditions or adding more conditions when requirement changes which is not a simple task.

Instead, if you go with lookup transform, you just update the lookup table.

{
  "attributes": {
    "values": [
      {
		"attributes": {
			"input": {
				"attributes": {
				  "sourceName": "HR Source",
				  "attributeName": "departmentCode"
				},
				"type": "accountAttribute"
			},
			"table": {
				"A": "2",
				"B": "3",
				"C": "4",
				"default": "1"
			}
		},
		"type": "lookup"
      },
      {
        "attributes": {
          "sourceName": "HR Source",
          "attributeName": "user ID"
        },
        "type": "accountAttribute"
      }
    ]
  },
  "type": "concat",
  "name": "UID Concat Transform"
}

Or you can use Static Transform as well

{
  "attributes": {
    "prefix": {
		"attributes": {
			"input": {
				"attributes": {
				  "sourceName": "HR Source",
				  "attributeName": "departmentCode"
				},
				"type": "accountAttribute"
			},
			"table": {
				"A": "2",
				"B": "3",
				"C": "4",
				"default": "1"
			}
		},
		"type": "lookup"
      },
	  "userID": {
        "attributes": {
          "sourceName": "HR Source",
          "attributeName": "user ID"
        },
        "type": "accountAttribute"
      }
    "value": "$prefix$userID"
  },
  "type": "static",
  "name": "UID Static Transform"
}

Thanks
Krish

2 Likes

Hello,
I’m trying to work with concat, but it only takes values specified as attributes in the identity profile.
I haven’t been able to solve this issue. Could you provide any additional feedback?

Thanks
Joy

I guess you are using Identity Attribute Transform, not Account Attribute Transform. That is why you are getting values from Identity attribute.

I would like to add a new field to the Identity attribute as 2+‘emp_no’ and 3+‘emp_no’. Is this possible?