Courion Tip – Active Directory Group Membership

I have a table of department numbers, job titles, and active directory group memberships, let’s call it JobTitleAttribs..

Department Code Job Title Group Membership
10 Administrators Remote access, Backup Operators
10 Floor Worker NONE
10 Assistants Domain users

Next, I created a custom macro to pull this into the courion workflow:
Name: [SQL].Group.Membership.From.Title
Return Type: List
Native Query String: select [Group Membership] from JobTitleAttribs where departmentcd like ‘%Custom Macro.DepartmentCD%’ AND Title like ‘%Custom Macro.Title%’

SO, you think you could put this macro into the unique resource data, group membership, for active directory. I couldn’t get it to work.

Courion confirmed that they don’t support comma delimited data like that.
They ALSO told me that vbscript connector doesn’t return arrays.
The data has to be formatted as an array.
So, you have to somehow convert this to an array.
Here’s a javascript custom macro that does this:

Name: [JS].Group.Memberships.To.Add
Return Type : List
Native Query String:

var stGroupsToAdd = “%Custom Macro.[SQL].Group.Membership.From.Title%”;

var reg1 = new RegExp(” *, *”,”g”);
stGroupsToAdd = stGroupsToAdd.replace(reg1,”,”);

var reg2 = new RegExp(“,,+”,”g”);
stGroupsToAdd = stGroupsToAdd.replace(reg2,”,”);

var reg3 = new RegExp(“,$”);
stGroupsToAdd = stGroupsToAdd.replace(reg3,””);

var reg4 = new RegExp(“^,”);
stGroupsToAdd = stGroupsToAdd.replace(reg4,””);

var groupsToAdd = stGroupsToAdd.split(“,”);

return groupsToAdd;

Now if you put this custom macro in the unique resource data, it will work properly.


Posted June 15, 2011 by mmdmurphy in Courion Tip

Tagged with

%d bloggers like this: