How to use different user formats for different conditions

When provisioning a new user account sometimes we want to use FirstName.LastName and other times we use FirstName.InitialLastName

The user name page doesn’t allow us to set conditions.

Is there still a way to do this using an expression?

Example:

WHEN user is in company ABC THEN use FirstName.LastName

WHEN user is in company XYZ THEN use FirstName.InitialLastName

2 Likes

This can be achieved by creating an C# ternary expression that checks for a condition, if the condition is true, use a specific value, if the condition is false, use a different value.

(Employment.CompanyCode.OneOf(“ABC”)) ? Person.PreferredName + ‘.’ + Person.LastName : Person.PreferredName + ‘.’ + Person.InitialLastName

It checks if company code is ABC

Employment.CompanyCode.OneOf(“ABC”)

If it is ABC, then it uses

Person.PreferredName + ‘.’ + Person.LastName

If it si NOT ABC, then it uses

Person.PreferredName + ‘.’ + Person.InitialLastName

1 Like