+ Start a Discussion
Praveen Jha 18Praveen Jha 18 

Add contact to specific group when checkbox is selected - Very Very Urgent

I have one custom field "Notify me on new release" on contact object, whose data type is checkbox. I want to add those contact automatically  in specific public group name "Alert" when user select "Notify me on new release" checked. How can i achieve this?? any help will be appericiated .
Frédéric TrébuchetFrédéric Trébuchet
Hi,

I think this is an example of what you want to do https://developer.salesforce.com/forums/ForumsMain?id=906F0000000913KIAQ

Hope this help,
Fred
MithunPMithunP
Hi Praveen,

You can't add "Contact" records in Public groups.

We can add only "Users", "Public Groups", "Roles" and "Role and Subordinates" within a Public group.

Best Regards,
Mithun.
MithunPMithunP
Hi Praveen,

Here is the Group object details.

https://www.salesforce.com/developer/docs/api/Content/sforce_api_objects_group.htm

Best Regards,
Mithun.
Bhanu MaheshBhanu Mahesh
Hi Praveen,

Yes as Mithun answered we cannot add contacts to Groups. 

Regards,
Bhanu Mahesh
Praveen Jha 18Praveen Jha 18

Hi Bhanu,
The only problem we are facing is when i already added user to the group as per role base, then we are unable to remove that user even deselect the checkbox "Notify me on new release" .

As your code working when no any user is added in the group initially. 
Please go to the https://developer.salesforce.com/forums/ForumsMain?id=906F0000000Auz7IAC
Bhanu MaheshBhanu Mahesh

Hi Praveen,

We cannot remove remove any user if they are added to the group by role. Evwey user withat role will get added automatically even if we remove them.

If the user is added manually then only we can remove user from public group.

The work around would be

If the user is added manually (explicitly) to the group then they can be removed. If they are part of the group by proxy, example as you describe, the role is part of the group then they cannot be removed.

The way to exclude them from the group is to :
1) Create a whole new role for that user
2) Create another public group for the role which has the users manually added and exclude this one user. You can then add this group to the public group.


Please refer the following link

https://success.salesforce.com/answers?id=90630000000ghlLAAQ


Regards,
Bhanu Mahesh Gadi