Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Generate Username via Inline Preprocessor

rohanpandit
New Contributor II
New Contributor II

Hi Team,

We have a requirement to generate username via Inline Preprocessor. We are using below inline preprocessor but getting error.

Username Requirement: All values should be unique

1. Firstname+Lastname

2. Firstname+Middlename(1)+lastName(If middlename exist)

3. Firstname + Middlename+lastName (If middlename exist)

4. Firstname + LastName(+1 increment)

"UPDATE NEWUSERDATA SET USERNAME = CASE WHEN EMPLOYEECLASS!= 'Contingent Worker' THEN CONCAT(firstname,lastname) WHEN middlename is not NULL AND EMPLOYEECLASS!= 'Contingent Worker' then CONCAT(firstname,substring(middlename,1,1),lastname) WHEN middlename is not NULL AND EMPLOYEECLASS!= 'Contingent Worker' then CONCAT(firstname,middlename,lastname) WHEN EMPLOYEECLASS!= 'Contingent Worker' and location!= 'Jacksonville (US_JACKS)' then CONCAT(firstname,lastname,substring('1',1,1)) end"

 

8 REPLIES 8

NM
Regular Contributor III
Regular Contributor III

Hi @rohanpandit looks fine what error do you see in logs?

rushikeshvartak
All-Star
All-Star

UPDATE NEWUSERDATA
SET USERNAME = CASE
WHEN EMPLOYEECLASS != 'Contingent Worker' AND middlename IS NULL THEN CONCAT(firstname, lastname)
WHEN EMPLOYEECLASS != 'Contingent Worker' AND middlename IS NOT NULL THEN CONCAT(firstname, LEFT(middlename, 1), lastname)
WHEN EMPLOYEECLASS != 'Contingent Worker' AND location != 'Jacksonville (US_JACKS)' THEN CONCAT(firstname, lastname, '1')
ELSE USERNAME
END;


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

rohanpandit
New Contributor II
New Contributor II

@rushikeshvartak @NM 

Getting below error. User with name(TestEICFTestF) already exist. Ideally, it should go to next condition if username already taken but it is not.

First Name: TestEICF

Last Name: TestF

Field error in object 'com.saviynt.ecm.identitywarehouse.domain.Users' on field 'username': rejected value [TestEICFTestF]; codes [com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.error.com.saviynt.ecm.identitywarehouse.domain.Users.username,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.error.username,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.error.java.lang.String,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.error,users.username.unique.error.com.saviynt.ecm.identitywarehouse.domain.Users.username,users.username.unique.error.username,users.username.unique.error.java.lang.String,users.username.unique.error,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.com.saviynt.ecm.identitywarehouse.domain.Users.username,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.username,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique.java.lang.String,com.saviynt.ecm.identitywarehouse.domain.Users.username.unique,users.username.unique.com.saviynt.ecm.identitywarehouse.domain.Users.username,users.username.unique.username,users.username.unique.java.lang.String,users.username.unique,unique.com.saviynt.ecm.identitywarehouse.domain.Users.username,unique.username,unique.java.lang.String,unique]; arguments [User Name,Users,TestEICFTestF]; default message [Property [{0}] of class [{1}] with value [{2}] must be unique

NM
Regular Contributor III
Regular Contributor III

@rohanpandit , any reason you only want to create username using inline processor .? And not with saviynt username register rule

rohanpandit
New Contributor II
New Contributor II

@NM   saviynt username register rule come s into picture only when users created through Saviynt UI/API.

NM
Regular Contributor III
Regular Contributor III

@rohanpandit , did you give it a try it should ideally pick it up ..

rohanpandit
New Contributor II
New Contributor II

Validate query from data analyzer and fix


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