Apply a dynamic filter in LDAP Filter

Johnny D_
Tera Contributor

Hi everybody.

This is my very first topic on the community.

My question is about the "LDAP OU Definition".

What we want is to identify in LDAP, the new created accounts. List them in a table, then push the mail adresse Inside Workday.

The sequence is : Scheduled Data Import --> use a data source LDAP --> Supported by a LDAP Target.

In the LDAP Target you define the LDAP Filter for requesting AD.

Everything works fine, but my target is to produce a dynamic LDAP Filter, based on the "WhenCreated" LDAP Parameter

For exemple, if i define this kind a filter : (&(objectClass=person)(sn=*)(!(objectClass=computer))(whenCreated>=20061001000000.0Z))

--> It's ok i find 10 accounts.

But i would like the criteria of the parameter whenCreated dynamic "20061001000000.0Z"

Like this i would be able to ask to LDAP "Give me the user accounts who have been created since my last execution".

To do this, i have created a "script include" (ADCaller_script_getDateCreated), including ADCaller_script_getDateCreated function who only do return "20061001000000.0Z"; (first step for proof of concept)

And i adjust the LDAP Filter :

(&(objectClass=person)(sn=*)(!(objectClass=computer))(whenCreate>=javascript:ADCaller_script_getDateCreated()))

--> It's KO i find always 0 accounts.

--> It looks the "javascript:ADCaller_script_getDateCreated()" is not translated

--> I've tried : javascript:global.javascript:ADCaller_script_getDateCreated() : KO

--> I've tried to create de DynamicFilter Option referenced to the script include : KO

--> I haven't tried to do a Class script include, with a method "getDateCreated" and call it with javascript:new MyScript().myMethod() because i think the result will be identical.

Therefore, i'm asking to the community : Is it possible to implement something like a dynamic value Inside a LDAP Filter ? If yes, what is wrong in my code and do you have a functional example?

Thanks in advance,

Cordially

 

 

12 REPLIES 12

And the file

Scott Murphy2
Giga Contributor

Johnny I like your idea. Another way would be to put it in the LDAP Scheduled Job Pre-import script.  Just before it queries LDAP it sets the filter to the day before at the same time it runs every day. I use whenChanged instead of whenCreated.

Yes it's probably a better way.

Honestly i Don't remember why i choosed to do it in post script.

But it's working fine 🙂