Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Help to check if the user is member of AD group even before using "Add user to a Group" activity?

Alistair_Pleas1
Tera Contributor

Does anyone know of the best way we can perform a pre check to see if the user is apart of a AD group prior to running the Add user to a Group" activity?

We have a workflow that is adding users to AD groups, however, if the user is already apart of the AD group the workflow activity fails. We would like to do a pre check and see if the user is already apart of the AD group to bypass the 'add user to a group' activity. I have looked into using the query AD activity but not sure of the exact configuration.

5 REPLIES 5

Ankur Bawiskar
Tera Patron

Hi,

I believe you must be using AD orchestration pack here;

you can use query AD activity with the samaccountname

then in the response of this activity parse the response and check if the group is present

Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,

Could you provide some further detail on this, any hits on the query AD activity syntax and how to parse the results is what I am looking for.

Thanks,

Alistair

wbrown1
Mega Contributor

If you still need help with  this let me know.

I am trying something similiar, would you mind sharing how you got this working?