Tag: Salesforce maintenance exam

An Opportunity team is a set of users that usually work together on an opportunity. A typical Opportunity Team might include the account manager, the sales representative, and a pre-sales consultant. In Salesforce a user can follow Chatter groups or Records. As of now, Salesforce does not have any out of the box functionality to auto follow records when a user is added to a team or etc., apart from the Automatically follow records that you created.Let’s start with a business use case

Business Use Case

Rachel Gillett is working as System administrator in Universal Container. She has received a requirement from the management when a new user is added to the Opportunity team, then auto adds him as Opportunity follower.

Solution for the above business requirement

There are a few possible solutions for the above business scenario, but we’ll use Flowand Process Builder to solve the above business requirement. Follow the below instructions to create a Process Builder andFlow to resolving the above business requirement

1.click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows2.Click onNew Flow, it will open the Flow canvas for you. Now create an SObject Variable Sov_OpportunityTeamMemberto store the Opportunity Team Member data (we will pass the value through Process Builder), as shown in the following screenshot

SObject Variable

3. The next step is to use EntitySubscription object to check whether the Opportunity team member is already following the Opportunity or not. To do this drag-and-drop a Record Lookup (Enter the name Check follower detail) onto the canvas and map the fields according to below details

Select Object EntitySubscription

For criteria selectParentId= {!Sov_OpportunityTeamMember.OpportunityId} andSubscriberId= {!Sov_OpportunityTeamMember.UserId}. Save the record Id in one Text variable as shown in the following screenshot

Check follower detail

4. Based on{!VarT_SubscriberDetail}we will decide whether we have to add a new Opportunity Team Member to Opportunity follower or not. Drag-and-drop a Decision Element (Enter the name Add as follower or skip) onto the canvas and map the fields according to the following screenshot

Add as a follower or skip

5.The final step is to add a new opportunity team member to Opportunity follower. To do this drag-and-drop Record Create element (Enter the name Opportunity team member to Opportunity follower) onto the canvas and map the fields according to below details

Select Object EntitySubscription

For criteria selectParentId= {!Sov_OpportunityTeamMember.OpportunityId} andSubscriberId= {!Sov_OpportunityTeamMember.UserId}, as shown in the following screenshot

Opportunity team member to Opportunity follower

6. Finally, yourFlowwill look like the following screenshot

7. Saveyour flow with nameAdd OTM to Opportunity follower and close the canvas. Don’t forget to Activatethe Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on theOpportunity Team Member object to launch a Flow. To create a Process Builder on theOpportunity Team Member object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder and click on the New button, Enter Name, API Name and then click on the Save button2. To create a new process from scratch, click on the New Button available on Process Management page. A popup will appear where you have to enter the Name (Use Add OTM to Opportunity follower PB as name), API Name and Description as shown in the below screenshot

Define Process Properties

3. Click onObjectnode to add object and then selectOpportunity Team Member object. For the entry criteria, Select onlywhen a record is created, as shown in the below screenshot

Evaluation Criteria

4. The next task is to add ProcessCriteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions(In this case select No criteria—just execute the actions!) and click on the Save button as shown in the following screenshot

Process Criteria

5. The next step is to addan Immediate action to Process. Click onAdd Action(Under Immediate actions), Select the type of action to create (In our case Flows), and then fill out the fields to define the action, as shown in the following screenshot

Add action – Flows

6. Once you are done, click on theSave button, it will redirect you to Process canvas. Finally, theProcess will look like the following screenshot

This is a continuation from my last articleGetting Started with Process Builder – Part 35 (Delete Chatter Messages), In that I had discussed a way through which you can allow your users to delete Chatter messages. This article goes a step ahead and explains, how to delete all messages at once, i.e. how to delete a Chatter conversation. Chatter conversation is nothing but messages that members have sent or received. Let’s start with a business use case

Business Use case

Rachel Gillett is working as System administrator at Universal Containers (UC). She has received a requirement from the management, they want to allow their Sales reps (License Type: – Salesforce Platform) to delete a Chatter conversation from Salesforce UI.

Solution for the above business requirement

There are a few options for the above business scenario, but we’ll use Flowand Process Builder to solve the above business requirement. As discussed in the previous article System administrator with the Manage Chatter Messagespermission can view and delete all users‘ messages in Chatter. Business users are not allowed to delete messages or conversations. The steps to solve the above business use case are mentioned below

The steps to solve the above business use case are mentioned below

Create a custom object that will be used to save the Id of Chatter conversation, which the users want to delete

On creation of the record use Process Builder to trigger a Flow (Runs in System mode) and pass the Chatter conversation Id

Use Flow to delete the Chatter Message

Before proceeding ahead, you have to understandChatterMessageobjects in Salesforce. It represents a message sent as part of a private conversation in Chatter.Few relevant fields are

1) ConversationId: – ID of the conversation that the ChatterMessage is associated with.

Follow the below instructions to solve the above business requirement

1. First of all, grantManage Chatter Messages permission to your user record (Via Permission Sets), to create a Flow. Otherwise, you will get the following error while building a Flow at step 3.

Flow Error

Later on, you can remove this permission set from your user record.

2. Create a custom object (Delete Chatter Conversation) and a field to save the Chatter Conversation Id, as shown in the following screenshot

Custom Object – Delete Chatter Conversation

Make sure that you have marked the field Chatter_Conversation_Id__c as required,Unique(Case Sensitive)and also grantedCRUD access to the respective profiles.

3. The next step is to create a Flow to delete Chatter Conversation. Navigate to Name | Setup | App Setup | Create | Workflows & Approvals | Flows4. Click onNew Flow, it will open the Flow canvas for you. Now create a Text variable VarT_ChatterConversationId to store the Chatter conversation Id (we will pass the Chatter Conversation Id through Process Builder), as shown in the following screenshot

Text Variable

5. The next step is to delete a Chatter conversation. To do this drag-and-drop Record Delete element (Enter the name Delete Chatter Conversations) onto the canvas and map the fields according to below details

Select object ChatterMessage

For the criteria selectConversationId= {!VarT_ChatterConversationId}, as shown in the below screenshot

Delete Chatter Conversations

6. Finally, yourFlowwill look like the following screenshot

7.Saveyour Flow with nameDelete Chatter Conversation and close the canvas. Don’t forget to Activatethe Flow. If you want, you can now remove the permission set from your user record that you have used to grant Manage Chatter Messages permission.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on theDelete Chatter Conversation object to launch a Flow. To create a Process Builder on theDelete Chatter Conversation object follow the below instructions

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
2. To create a new process from scratch, click on theNew Button available on Process Management page. A popup will appear where you have to enter the Name (Use Delete Chatter Conversations PB as name), API Name and Description as shown in the below screenshot

Define Process Properties

3. Click onObjectnode to add object and then selectDelete Chatter Conversation object. For the entry criteria, Select onlywhen a record is created, as shown in the below screenshot. Once you’re done, click on theSave button

Evaluation Criteria

4. The next task is to add ProcessCriteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions(In this case select No criteria—just execute the actions!) and click on the Save button as shown in the following screenshot

Process Criteria

5. The next step is to addan Immediate action to Process. Click onAdd Action(Under Immediate actions), Select the type of action to create (In our case Flows), and then fill out the fields to define the action, as shown in the following screenshot

Add action – Flows

6. Once you are done, click on theSave button, it will redirect you to Process canvas. Finally, theProcess will look like the following screenshot

Don’t forget to active the Process by clicking on the Activatebutton.

It’s time to test this feature

1) To test this application, I’m going to use the Salesforce Platform licensed user, i.e. Brendon Schaefer, as shown in the following screenshot

Salesforce Platform User

No extra permission is assigned to this user apart from Create and Read permission on theDelete Chatter Conversation object.

2) Brendan wants to delete a Chatter conversation (It contains 4 messages) that’s started by System Administrator Rakesh Gupta, as shown in the following screenshot

Chatter Conversation

Now the million dollar question is how to get the Id of Chatter conversation as a business user when you can’t run a query.

3) To get a Chatter ConversationId, navigate to message section and right click on a Chatter Conversation then selectInspect Element, as shown in the following screenshot

Select Inspect Element for a Chatter Conversation

4) It will open another window, from where you can copy the Chatter Conversation id as shown in the following screenshot

Chatter Conversation Id

5) Final step is to create a new record in theDelete Chatter Conversation object, as shown in the following screenshot

Create a new record

Once you’re done, click on theSavebutton.

6) Navigate to the Chatter messages and check it out now. The conversation is started by System Administrator Rakesh Guptagets deleted.

Final Output

Note: – You can be only able to delete those Chatter conversation in which you are included, else you will get an error, i.e.There is nothing in Salesforce matching your delete criteria. It’s not applicable to the system Administrator with the Manage Chatter Messages permission.