and more in a single search tool across platforms. Read the announcement here. |
07/28/2022 04:32 AM
Hello,
We are trying to import users from a csv file to an organization in Saviynt. The end date of users who are still with the organization is empty and an end date is only filled in when we know the date the user is going to leave.
How can we add an empty end date in the enddate attribute of a user? We have tried adding a case in the SAV file which states:
Solved! Go to Solution.
07/28/2022 05:21 AM
"UPDATE NEWUSERDATA SET ENDDATE = CASE WHEN NEWUSERDATA.END_DATE = '' THEN null WHEN NEWUSERDATA.END_DATE IS NULL THEN null ELSE DATE_FORMAT(STR_TO_DATE(NEWUSERDATA.START_DATE,'%Y-%m-%d'),'%Y-%m-%d') END"
07/28/2022 05:31 AM
This unfortunately also does not work. I think the issue lies in the fact that if there is no enddate, the format for sql (d-m-y) is not correct so the job throws an error.
07/28/2022 06:10 AM
"UPDATE NEWUSERDATA SET ENDDATE = CASE WHEN NEWUSERDATA.END_DATE = '' THEN DATE_FORMAT(STR_TO_DATE('2099-12-31','%Y-%m-%d'),'%Y-%m-%d')WHEN NEWUSERDATA.END_DATE IS NULL THEN DATE_FORMAT(STR_TO_DATE('2099-12-31','%Y-%m-%d'),'%Y-%m-%d') ELSE DATE_FORMAT(STR_TO_DATE(NEWUSERDATA.START_DATE,'%Y-%m-%d'),'%Y-%m-%d') END"
08/02/2022 02:04 PM
Hello @Robbe_Cronos,
Can you share the date format of the enddate for the user when they do have one in the csv feed ?
08/03/2022 12:16 AM
Hi @Robbe_Cronos ,
Can you share the Modify User Data JSON you are trying to use?
With the following sample Modify User Data JSON, I could set null to the user's enddate attribute.
{
"ADDITIONALTABLES": {
"USERS": "SELECT username, enddate FROM USERS"
},
"COMPUTEDCOLUMNS": [
"enddate"
],
"PREPROCESSQUERIES": [
"UPDATE NEWUSERDATA SET enddate= CASE WHEN enddate='' then NULL else DATE_FORMAT(STR_TO_DATE(NEWUSERDATA.enddate,'%Y-%m-%d'),'%Y-%m-%d') END WHERE username is NOT NULL;"
]
}
08/03/2022 12:32 AM
We already managed to fix it using a query like yours but forgot to close the post, thanks anyway!