Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

Case When in Username Generation Logic

sab2
Regular Contributor
Regular Contributor

Hi,

I trying to do a case when statement in the username generation logic. Under the 'Add Register User Rule'.

It does not seem to be working. Even in the documentation it has case when examples for system username or email but not for username. Is this possible?

If not, does anyone have a different approach?

I tried setting username equal to system username and putting the logic needed in system username rule but that did not work either.

Thanks!

4 REPLIES 4

rushikeshvartak
All-Star
All-Star

use if condition

https://www.w3schools.com/sql/func_mysql_if.asp


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

sab2
Regular Contributor
Regular Contributor

Thank you!

Do you have a sample of successful working statement? when I try something simple like 'IF (users.middlename is not null, users.firstname, users.lastname)'

it returns username as the full statement so username is being set to 'IFmiddlenameisnotnullJonnyTester'

What is the behaviour with case when statement?

can you share you sample case when statement that didn't work?


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

sab2
Regular Contributor
Regular Contributor

we have tried a few different things, I pasted two below. The first one gives the same behavior of making username the entire statement 'case whencustomproperty40=Employeethenfirstname else lastname end'. The second one just errors out.

Statement 1: case when users.customproperty40 = 'Employee' then users.firstname
else
users.lastname
end

Statement 2: concat(case when users.customproperty40 = 'Employee' then concat(substring('users.firstname',1,6)) else concat(substring('users.lastname',1,9))end)