Flow Designer - Adding user to Active directory group

Nadeem Basha
Tera Contributor

Hi Team ,

 

I have the microsoft AD spoke installed in the instance  and would like to know if user can be added to the Active Directory group just by entering the group name in "Add User to Group " AD spoke in the flow ???

If not ,let me know what script can be written to add users  in the Active directory group .

 

NadeemBasha_0-1710873289528.png

Thanks

 

 

3 REPLIES 3

James Chun
Kilo Patron

Hi @Nadeem Basha,

 

Yes, you can use the spoke to add users to groups without writing a script.

Did you run into an issue whilst running it?

 

Cheers

Sohail Khilji
Kilo Patron
Kilo Patron

Hi @Nadeem Basha,

 

As i see your using the AD spoke then you can simply use the ''add user to group'' action in flowdesiger to add any user to ad group.

SohailKhilji_0-1710875157633.png

 

 

if you need to do via script then:

var ad = new GlideRecord('Active_Directory_Group');
ad.addQuery('name', adGroupName);
ad.query();
if (ad.next()) {
var user = new GlideRecord('sys_user');
user.addQuery('user_name', current.user_name);
user.query();
if (user.next()) {
ad.addUser(user.sys_id);
}
}

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Hi Sohail,

 

Thank you for the response.

Hope i can simply use "microsoft Ad spoke " to add users into Active directory group.

Also i would like to know if there is a way to stop adding the user in the Active directory group if he is already a part of it ?

If so pls let me know how can we achieve it using flow designer .

 

Thanks