8.1.4 - Sync Editor - Custom schema on 1IM side

Hello Experts,

I need to do an AD sync, condition is that on the 1IM side I only load ADS objects whose UID_Person belong to certain business roles. Means that I have to join ADSAccount With Person and then Person with PersonInOrg to actually get the list of ADSAccounts to be loaded on 1IM side. Something like this

select uid_adsaccount from adsaccount a

join person p on p.UID_Person = a.UID_Person

join PersonInOrg po on po.UID_Person = p.UID_Person

where <some where clause>

How can this be done using custom schemas in the sync editor?

Thanks

Kin

PS: Looking at the issue the other way as well, how do I put a custom schema to only get accounts from ADS which are a member of a certain set of groups (groups matching some condition)