2

My requirement is that whenever user's Department is changed from one value to other, he should be added to a specific chatter group. Department name and ChatterGroup Name will be same in the system.

ProcessBuilder condition: Everytime user is created/edited and decision is department is not null. Action is as follows:

enter image description here

In the immediate actions, launch the flow as follows: Passing the deparment var and userid var to flow. enter image description here

My flow is as follows: enter image description here

Record lookup is for searching chattergroup matching department name. enter image description here

2nd element is for searching chattergroupmember. enter image description here

3rd element is for adding user to chattergroup. enter image description here

Now I need to remove the user from group if his department gets changed. Please help me how can I put a criteria for this?

2

I would change your entry criteria to "Every time the record is created or edited" with a filter of "Department Is Changed" instead. From there, have three variables, OldDepartment, NewDepartment, and UserId. Assign OldDepartment a formula of "PRIORVALUE([User].Department)." In your flow, Fast Lookup the old department, Fast Lookup the new department, Fast Lookup the User, Fast Lookup the old CollabGroupMember record matching that user and the old department, delete if necessary, and Fast Create the new CollabGroupMember record. You're looking at about seven flow elements. You'll need to initialize your users with the current department they're in, but by using a "changed" trigger, you'll reduce the amount of time it takes to save records when the department doesn't change, which I expect will be the more common scenario.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.