and more in a single search tool across platforms. Read the announcement here. |
02/06/2023 05:44 AM
In my case, I have two auth sources. Source A and Source B. there can be common users in both.
I want to restrict a user who got added by Source A to be updated by Source B. so let say for user import on Source A, I have CP3 updated for newly created user as 'A'.. now if the same user comes in user import of Source B .. it's should be skipped to be updated for any value change.
Both sources have username as recon field.
I believe pre-processor will work to put some additional logic for the data that has already been brough by "user import" json, so not sure if that can help.
Solved! Go to Solution.
02/06/2023 01:22 PM
You can use the USERSOURCE field in users table using preprocessor to restrict updating users which have been added as part of the 1st connection.
USERSOURCE field is populated with the connectionkey of the connection used to import the user data.
So your preprocessor query would be something like
{
"ADDITIONALTABLES": {
"USERS": "SELECT USERNAME, FIRSTNAME, MIDDLENAME, LASTNAME FROM USERS WHERE USERSOURCE = 'CONNECTIONKEYofSOURCEA'"
},
"COMPUTEDCOLUMNS": [
"USERNAME"
],
"PREPROCESSQUERIES": [
"INSERT INTO NEWUSERDATA (USERNAME, FIRSTNAME, MIDDLENAME, LASTNAME) SELECT USERNAME, FIRSTNAME, MIDDLENAME, LASTNAME FROM CURRENTUSERS CU WHERE CU.USERNAME NOT IN (SELECT USERNAME FROM NEWUSERDATA)"
]
}
02/06/2023 10:19 PM
@Ishan Thanks very much for the quick reply. I will try the above option. One clarification : As per my understanding preprocessor run post the data is imported in users table using "importjson" .. isnt it?
If that is the case then data will already be there in users table for all incoming users. then how pre-processor will help?
02/08/2023 08:51 AM
@abhiupadhyay You're welcome! Preprocessor doesn't run after data is imported to users table. It pre processes the data using whatever query you add before adding it to the users table. You should use MODIFYUSERDATAJSON to add your preprocessing logic.
02/08/2023 08:58 AM
thanks @Ishan .. a simple query to delete the records ( which are from another usersource ) in preprocessor did the trick.