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

Issue with User Import: Assigning Email as Username

gaurav007
New Contributor II
New Contributor II

I am currently working on a user import process in Saviynt and need assistance in creating both email and username for new hires and must be same.

I am facing an issue during the user import process into Saviynt, where I need to assign the generated email as the username for new hires. The Saviynt requires a username for user creation, and I want to streamline this process by using the email generated in Saviynt as the username.

If there are alternative approaches, best practices, or examples tailored to this scenario, your insights would be highly valuable

6 REPLIES 6

rushikeshvartak
All-Star
All-Star

You can use preprocessor 


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

currently I am generating e-mail in Saviynt in global_config and want to same e-mail map with username while importing the user.
if I go with preprocessor so need to create e-mail and username both because username and e-mail must be same and Unique. 

if you have any sample query to generate unique email and username with auto increment for preprocessor so please share it will be helpful.

 

You can generate username from global config and using preprocessor populate to email field


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

I tried to generate usernames and email addresses in a Saviynt preprocessor using the below provided code. The process involves utilizing the "firstName" and "lastName" attributes from a CSV file containing "firstName," "lastName," "statuskey," and "employeeid" fields. However, I encountered the following error:
Error : Missing username for the record# 1 : [SaviyntTest, Test, 1, A43214, , ]
 
Upon reviewing the logs, I observed that the Java code responsible for generating usernames is working as expected.
 
Logs:
-Enter getUser
2024-01-12T23:37:30+05:30-ecm-services.UsersService-http-nio-8080-exec-9-dqnfd-DEBUG-Parameters are [controller:restful, action:getUser, filtercriteria:[username:SaviyntTest.Test@domain.com]]
2024-01-12T23:37:30+05:30-ecm-services.UsersService-http-nio-8080-exec-9-dqnfd-DEBUG-Parameters are [controller:restful, action:getUser, filtercriteria:[username:SaviyntTest.Test@domain.com], loggedinusername:Saviynt.Saviynt]
2024-01-12T23:37:30+05:30-ecm-services.UsersService-http-nio-8080-exec-9-dqnfd-DEBUG-The JSON 2024-01-12T23:37:30+05:30-ecm-ws.RestfulController-http-nio-8080-exec-9-dqnfd-DEBUG
-Exit getUser
 
CODE: 
public void doCustomPreprocess(Connection connection, Map tempTableNamesMap) throws Exception {
 
String Fname=null;
String Lname=null;
String baseUsername=null;
String username;
String userDataquery="SELECT * FROM "+tempTableNamesMap.get("NEWUSERDATA");
ResultSet rs;
int counter = 1;
try {
Statement st=connection.createStatement();
rs=st.executeQuery(userDataquery);
 
while(rs.next()) {
 
Fname=rs.getString("FIRSTNAME");
Lname=rs.getString("LASTNAME");
 
System.out.println("FIRSTNAME"+Fname);
System.out.println("FIRSTNAME"+Lname);
}
baseUsername=Fname + "." + Lname ;
             username = baseUsername;
             String accessToken = getAccessToken();
                 System.out.println("accessToken"+accessToken);
 
             while (userExists(username+ "@domainName.com",accessToken)) {
            username = baseUsername + counter+ "@domainName.com";
                 counter++;   
            }
             System.out.println("Unique Username: " + username);
             
              String qry = "UPDATE NEWUSERDATA SET NEWUSERDATA.USERNAME = '"+username+"', NEWUSERDATA.EMAIL = '"+username+"' WHERE NEWUSERDATA.EMAIL IS NULL AND  NEWUSERDATA.USERNAME IS NULL";    
executeStatement(connection, qry);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
    }
 

I am using the following function for the preprocessor when upload the CSV. Could you please help me identify where I might be going wrong?

{
"ADDITIONALTABLES":{
"USERS":"SELECT USERKEY, firstname, lastname,EMAIL,USERNAME FROM USERS" },
"COMPUTEDCOLUMNS":[
"USERNAME","EMAIL"
],
"PREPROCESSQUERIES":[
"CUSTOMFUNCTION###FUNCTION1" ],
"CUSTOMFUNCTIONS":{
"FUNCTION1":{
"FULLCLASSNAME":"com.saviynt.inspira.ConnectionUtlityService",
"METHODNAME":"doCustomPreprocess" }
}
}

gaurav007
New Contributor II
New Contributor II

.

username is mandatory when you upload user from CSV


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