and more in a single search tool across platforms. Read the announcement here. |
10/17/2022 12:16 AM
Hello,
I have userimport rule written in sav2sav connection which is :
-----------------------------------------------------------------------------------------------------------------
<dataMapping> <before-import>
</before-import>
<sql-query description="This is the Source DB Query" uniquecolumnsascommaseparated="username">
<![CDATA[ SELECT DISTINCT
u.username AS 'username',
concat(u.SYSTEMUSERNAME,'@domain.com') as 'UPN',
REPLACE(SUBSTRING_INDEX(u.EMAIL,"@",1),'_',' ') as 'CN',
(case when u.enddate is null OR u.enddate >= date(now()) then '1' else '0' end) as 'ActiveStatus',
(case when ((u.startdate BETWEEN date(now()) AND (date(now()) + INTERVAL 5 DAY)) and if(u.enddate is not null,u.enddate >= date(now()),1) and u.SYSTEMUSERNAME is not null and u.EMAIL is not null) then 'true' else 'false' end) as 'CreateADAccount',
(case when (u.enddate = date(now()) + 15) and (u.SYSTEMUSERNAME is not null and u.EMAIL is not null and u.employeetype like '%ThirdParty%') then 'true' else 'false' end) AS "contractenddate",
(case when ((select distinct m.username from users m where m.manager=u.userkey limit 1) is not null) then 'Yes' else 'No' end) AS "Ismanager",
(case when (u.customproperty3 is not null) then 'Active' else 'Pending' end) AS "DarwinboxStatus",
(case when (u.employeetype like '%ThirdParty%' and u.customproperty5 = k.customproperty4) then k.username when (u.employeetype like '%ThirdParty%' and u.customproperty5 NOT LIKE '%@%') then '100372' when (u.employeetype not like '%ThirdParty%' and u.manager IS NULL) then '101125' else u.manager end) AS 'MyManager'
FROM
users u,
users k
WHERE u.username IS NOT NULL AND u.username NOT IN
('test_sav',''test_sav1','saviynt_apiuser')]]>
</sql-query> <importsettings> <zeroDayProvisioning>true</zeroDayProvisioning> <userNotInFileAction>NOACTION</userNotInFileAction> <checkRules>true</checkRules> <buildUserMap>true</buildUserMap> <userReconcillationField>username</userReconcillationField> </importsettings> <mapper description="This is the mapping field for SAviynt Field name" defaultrole="ROLE_SAV_ENDUSER">
<mapfield saviyntproperty="username" sourceproperty="username" type="character"></mapfield>
<mapfield saviyntproperty="statuskey" sourceproperty="ActiveStatus" type="character"></mapfield>
<mapfield saviyntproperty="customproperty12" sourceproperty="CreateADAccount" type="character"></mapfield>
<mapfield saviyntproperty="customproperty4" sourceproperty="UPN" type="character"></mapfield>
<mapfield saviyntproperty="customproperty2" sourceproperty="CN" type="character"></mapfield>
<mapfield saviyntproperty="customproperty43" sourceproperty="Ismanager" type="character"></mapfield>
<mapfield saviyntproperty="customproperty42" sourceproperty="DarwinboxStatus" type="character"></mapfield>
<mapfield saviyntproperty="customproperty51" sourceproperty="contractenddate" type="character"></mapfield>
<mapfield saviyntproperty="manager" sourceproperty="MyManager" type="character"></mapfield>
</mapper> <after-import description="SQL"> </after-import> </dataMapping>
---------------------------------------------------------------------------------------------------------------------
It works fine if i use single username in where condition.....Like:
WHERE u.username IS NOT NULL AND u.username IN ('100218') AND u.username NOT IN
('test_sav',''test_sav1','saviynt_apiuser')]]>
but if i use it without "AND u.username IN ('100218')" Sav2Sav job hangs (sometime takes a long time to finish). Even after finishing:
1) it doesn't do anything to any user.
2) it creates problem in data analyzer
Hence, i had to restart service from UI.
Am i doing anything wrong in sav2sav. If there is a problem in sav2sav, why it works for single user and doesn't work for entire user polulation.
Solved! Go to Solution.
10/17/2022 12:23 AM
You have missing join condition what is common between users table k & u should be joined in where condition
10/17/2022 12:36 AM
Hello Rushikesh,
I am using users k in in following line. I have no idea on join here (how to use). Can you please help in it? or Can you suggest any other way to achieve following condition.
Also it works fine if i use single user.
(case when (u.employeetype like '%ThirdParty%' and u.customproperty5 = k.customproperty4) then k.username when (u.employeetype like '%ThirdParty%' and u.customproperty5 NOT LIKE '%@%') then '100372' when (u.employeetype not like '%ThirdParty%' and u.manager IS NULL) then '101125' else u.manager end) AS 'MyManager'
FROM
users u,
users k
10/17/2022 12:50 AM
Not sure what is cp4 & cp5 holds & some numbers are hardcoded
try below query
SELECT DISTINCT
u.username AS 'username',
concat(u.SYSTEMUSERNAME,'@domain.com') as 'UPN',
REPLACE(SUBSTRING_INDEX(u.EMAIL,"@",1),'_',' ') as 'CN',
(case when u.enddate is null OR u.enddate >= date(now()) then '1' else '0' end) as 'ActiveStatus',
(case when ((u.startdate BETWEEN date(now()) AND (date(now()) + INTERVAL 5 DAY)) and if(u.enddate is not null,u.enddate >= date(now()),1) and u.SYSTEMUSERNAME is not null and u.EMAIL is not null) then 'true' else 'false' end) as 'CreateADAccount',
(case when (u.enddate = date(now()) + 15) and (u.SYSTEMUSERNAME is not null and u.EMAIL is not null and u.employeetype like '%ThirdParty%') then 'true' else 'false' end) AS "contractenddate",
(case when ((select distinct m.username from users m where m.manager=u.userkey limit 1) is not null) then 'Yes' else 'No' end) AS "Ismanager",
(case when (u.customproperty3 is not null) then 'Active' else 'Pending' end) AS "DarwinboxStatus",
(case when (select k.username from users k where u.employeetype like '%ThirdParty%' and u.customproperty5 = k.customproperty4) is not null then
(select k.username from users k where u.employeetype like '%ThirdParty%' and u.customproperty5 = k.customproperty4)
when (u.employeetype like '%ThirdParty%' and u.customproperty5 NOT LIKE '%@%') then '100372' when (u.employeetype not like '%ThirdParty%' and u.manager IS NULL) then '101125' else u.manager end) AS 'MyManager'
FROM
users u
10/17/2022 01:24 AM
Thank you, buddy. That helped