Getting Started with Visual Workflow – Part 1 (Launch a Flow using Lightning App)

Posted on Updated on

Flow and Lightning App BuilderThe series of article on the Visual Workflow is to discuss the basic concepts and to show the power of Flow. Visual Workflow allows you to automate business processes by building applications, known as Flows, that collect, update, edit, and create Salesforce information, and then make those flows available to the right users or systems. Flows can execute logic, interact with the Salesforce database, call Apex classes, and guide users through screens for collecting and updating data. There are various ways through which you can launch your Flows, one of them is Lightning App Builder. Let’s start with a business use case

Business Use case :-  Rachel Gillett is working as System administrator in Universal Container. She has developed a flow to get  the Sales reps feedback. She wants to use the Lightning App to launch a Flow.

Solution of above business requirement

We I’ll use Flow, Visualforce Page and Lightning App Builder to solve the above business requirement. Steps to create a Lightning App to launch the Flow are mentioned below

  • Create a Flow
  • Embed the Flow in a Visualforce Page
  • Create a Lightning Page in Lightning App Builder
  • Add Visualforce page as a component
  • Activate the Lightning page. Activate adds your app the Saleforce1 Mobile navigation

Follow the below instructions to solve the above business requirement

1. Click on Name | Setup | App Setup | Create | Workflows & Approvals | Flows and then click on the New Flow button, it will open the Flow canvas for you. Create a sample Flow (Save it with the name Survey) as shown in the following screenshot

Sample Survey Flow
Sample Survey Flow

If you want step-by-step guide to create the above flow, then check out this article Survey Powered by Visual Workflow

2. The next step is to embed the Flow in a Visualforce Page (Save it with the name Flow), to do this you can use the below mentioned code

<apex:page >
<flow:interview name=”Survey”/>
</apex:page>

3. Now we will create a Lightning Page in Lightning App Builder. Click on Setup | Build | Develop | Lightning App Builder, then click on the New button under Lightning Pages to start Lightning App Builder. Choose one Column template (A template defines the basic behavior and layout of the page you plan to create) and click on the Next button. In the next screen, i.e. Create a New Lightning Page pop-up enter a unique name (TestApp) for your new page and click on the Finish button, as shown in the following screenshot

New Lightning Page
New Lightning Page

4. Drag-and-drop Visualforce Standard Lightning component onto the canvas, as shown in the following screenshot

Add Standard Component to Lightning Page
Add Standard Component to Lightning Page

You can use the control panel to select a Visualforce page (In our case select Flow) that you want to include, as shown in the following screenshot 

Controls for the App Builder
Controls for the App Builder

Once you’re done, click on the Save button. It will save the current definition of your app.

5. Final step is to activate the Lightning page. Activate adds your app the the Saleforce1 Mobile navigation.

Activate the Lighting Page
Activate the Lighting Page

It also allows you to set the Tab visibility.

Proof of concept

IMG_0265

 

Getting Started with Process Builder – Part 38 (Automatically Create Cases from Unresolved Questions)

Posted on Updated on

CaseAs our community grows, organization have to ensure that customers get quick answers to their questions. Question-to-Case allows moderators to escalate unresolved questions to cases from the question detail page. You can automate this escalation process using Process Builder or Workflow Rule. It allows you to use Question-to-Case and automation tool in several ways, for example

  • Create a case from a question if, the question has received more than two likes without reply.
  • Create a case from a question immediately if the question contains the word Urgent Help.

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, auto create a case whenever a new question is created, which contains word Urgent help in the title.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but we’ll use Process Builder and Create a record action to solve the above business requirement. Follow the below instructions to create a Process Builder to solve the above business requirement

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 button
2. 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 Automatically Create Cases from Unresolved Questions as name), API Name and Description as shown in the below screenshot

Define Process Properties
Define Process Properties

3. The next step is to add entry criteria. For this click on Add Object, select Question object and for the entry criteria, Select only when a record is created, as shown in the below screenshot, once you are done click on the Save button

Evaluation Criteria
Evaluation Criteria

4. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions  (In this case set [Question].Title Contains Urgent Help) and click on the Save button, as shown in the following screenshot

Process Criteria
Process Criteria

5. Once you are done, click on the Save button it will redirect you to Process Canvas. Now we have to add an Immediate action to create a case, for this we will use Create a Record action. Use Field Picker to select the field Description and Text Entry field to enter a comment or sentence. Please refer the following screenshot for more information

Add action - Create a Record
Add action – Create a Record

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

Automatically Create Cases from Unresolved Questions

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

Proof of concept

 1. Now create a question from the community user login via the UI

Create a question
Create a question

2. Navigate to the case tab and check out the newly created case

Question to case
Question to case

Note :-  I will suggest you to implement this first on your developer org, test it and then move it to production.

 

 

Getting Started with Process Builder – Part 37 (Auto add Opportunity Team Member to Opportunity follower)

Posted on Updated on

An Opportunity team is a set of users that normally 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 add him as Opportunity follower.

Solution of above business requirement

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

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

SObject Variable
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 select ParentId= {!Sov_OpportunityTeamMember.OpportunityId} and SubscriberId{!Sov_OpportunityTeamMember.UserId}. Save the record Id in one Text variable as shown in the following screenshot
Check follower detail
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 following screenshot

Add as a follower or skip
Add as a follower or skip

5. 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 select ParentId= {!Sov_OpportunityTeamMember.OpportunityId} and SubscriberId{!Sov_OpportunityTeamMember.UserId}, as shown in the following screenshot
Opportunity team member to Opportunity follower
Opportunity team member to Opportunity follower

6. Finally your Flow will look like the following screenshot

Auto add Opportunity Team Member to Opportunity follower

7. Save your flow with name Add OTM to Opportunity follower and close the canvas. Don’t forget to Activate the Flow.

Launch a Flow from Process Builder

Our next task is to create a Process Builder on the Opportunity Team Member object to launch a Flow. To create a Process Builder on the Opportunity 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 button
2. 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
Define Process Properties

3. Click on Object node to add object and then select Opportunity Team Member object. For the entry criteria, Select only when a record is created, as shown in the below screenshot

Evaluation Criteria
Evaluation Criteria

4. The next task is to add Process Criteria, 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
Process Criteria

5. The next step is to add an Immediate action to Process. Click on Add 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
Add action – Flows

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

Add OTM to Opportunity follower PB

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

It’s time to test this feature

1) Navigate to the Opportunity tab, identify the Opportunity and click on Opportunity Name. 

Opportunity with no Team Members
Opportunity with no Team Members

2) Now I’m going to add user Brendon Schaefer to the Opportunity Team member, as shown in the following screenshot

Final output
Final output

Note :-  I will suggest you to implement this first on your developer org, test it and then move it to production.

 

Getting Started with Process Builder – Part 36 (Delete Chatter Conversations)

Posted on Updated on

Delete ConversationThis is a continuation from my last article Getting 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 in Universal Container. 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 of above business requirement

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

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

  1. Create a custom object that will be used to save the Id of Chatter conversation, which the users want to delete
  2. On creation of the record use Process Builder to trigger a Flow (Runs in System mode) and pass the Chatter conversation Id
  3. Use Flow to delete the Chatter Message

Before proceeding ahead, you have to understand ChatterMessage objects in Salesforce. It represents a message sent as part of a private conversation in Chatter. Few important 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, grant Manage Chatter Messages permission to your user record (Via Permission Sets), to create a Flow. Otherwise, you will get the following error while creating a Flow at step 3.

Flow Error
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
Custom Object – Delete Chatter Conversation

Make sure that you have marked the field Chatter_Conversation_Id__c as required, Unique (Case Sensitive) and also granted CRUD 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 | Flows
4. Click on New 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
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 select ConversationId= {!VarT_ChatterConversationId}, as shown in the below screenshot
Delete Chatter Conversations
Delete Chatter Conversations

6. Finally, your Flow will look like the following screenshot

Delete Chatter Conversation

7. Save your Flow with name Delete Chatter Conversation and close the canvas. Don’t forget to Activate the 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 the Delete Chatter Conversation object to launch a Flow. To create a Process Builder on the Delete 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 the
New 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
Define Process Properties

3. Click on Object node to add object and then select Delete Chatter Conversation object. For the entry criteria, Select only when a record is created, as shown in the below screenshot. Once you’re done, click on the Save button

Evaluation Criteria
Evaluation Criteria

4. The next task is to add Process Criteria, 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
Process Criteria

5. The next step is to add an Immediate action to Process. Click on Add 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
Add action – Flows

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

Delete Chatter Conversations PB

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

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
Salesforce Platform User

No extra permission is assigned to this user apart from Create and Read permission on the Delete 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
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 Conversation Id, navigate to message section and right click on a Chatter Conversation then select Inspect Element, as shown in the following screenshot

Select Inspect Element for a Chatter Conversation
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
Chatter Conversation Id

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

Create a new record
Create a new record

Once you’re done, click on the Save button.

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

Final Output
Final Output

Note :- You can 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 system administrator with the Manage Chatter Messages permission.

Getting Started with Process Builder – Part 35 (Delete Chatter Messages)

Posted on Updated on

message-in-trash

Basic but very important, first of all you have to understand Chatter messages and Chatter Conversation in Salesforce. Chatter messages let you have secure private conversations with other Chatter users. Use messages to send your colleague a question privately, or to communicate with a few selected people when a discussion isnt relevant to everyone you work with. Whereas Chatter conversation is consisting of messages that conversation members have sent or received. 

Remember the following points for using Chatter messages

1) A private message can include up to 9 members, including yourself.
2) Messages sent will not be viewable through Chatter feed, Chatter Profile, or Global Search results.
3) You can’t delete messages or conversations.
4) An administrator with the Manage Chatter Messages permission can view and delete all users messages in Chatter for example, for compliance purposes.

—> Messages are hard deleted. They aren’t sent to the Recycle Bin.
—> Deleted messages aren’t included in message search results.
—> If all messages in a conversation are deleted, the conversation doesnt shown in My Messages and cant be retrieved via the Chatter REST API.

5) If after reading the messages in a conversation you want to mark the conversation unread, you can do so only via the Chatter REST API, not via the user interface.

In this article Im going to discuss a way through which you can allow your users to delete the Chatter messages one-by-one. 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, they want to allow their Sales reps (License Type :- Salesforce Platform) to delete Chatter messages one-by-one from Salesforce UI.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but we’ll use Flow and Process Builder to solve the above business requirement. As discussed earlier System administrator with the Manage Chatter Messages permission can view and delete all users messages in Chatter. Business users are not allowed to delete messages or conversations. The steps to to solve the above business use case are mentioned below

  1. Create a custom object that will be used to save the Id of Chatter message, which the users want to delete
  2. On creation of the record use Process Builder to trigger a Flow (Runs in System mode) and pass the Chatter message Id
  3. Use Flow to delete the Chatter Message

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

1) Id :- Chatter Message Id
2) 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, grant Manage Chatter Messages permission to your user record (Via Permission Sets), to create a Flow. Otherwise, you will get the following error while creating a Flow at step 3.

Flow Error
Flow Error

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

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

Custom Object - Delete Chatter Messages
Custom Object – Delete Chatter Messages

Make sure that you have marked field Chatter_Message_Id__c as required and also granted CRUD access to the respective profiles

3. The next step is to create a Flow to delete Chatter Message. Navigate to Name | Setup | App Setup | Create | Workflows & Approvals | Flows
4. Click on New Flow, it will open the Flow canvas for you. Now create a Text variable VarT_ChatterMessageId to store the Chatter message Id (we will pass the Chatter Message Id through Process Builder), as shown in the following screenshot

Text Variable
Text Variable

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

  • Select object ChatterMessage
  • For the criteria select Id= {!VarT_ChatterMessageId}, as shown in the below screenshot
Delete Chatter Messages
Delete Chatter Messages

6. Finally, your Flow will look like the following screenshot

Delete Chatter Message

7. Save your Flow with name Delete Chatter Message and close the canvas. Don’t forget to Activate the 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 the Delete Chatter Message object to launch a Flow. To create a Process Builder on the Delete Chatter Message 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 the
New Button available on Process management page. A popup will appear where you have to enter the Name (Use Delete Chatter Messages PB as name), API Name and Description as shown in the below screenshot

Define Process Properties
Define Process Properties

3. Click on Object node to add object and then select Delete Chatter Message object. For the entry criteria, Select only when a record is created, as shown in the below screenshot. Once you’re done, click on the Save button

Evaluation Criteria
Evaluation Criteria

4. The next task is to add Process Criteria, 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
Process Criteria

5. The next step is to add an Immediate action to Process. Click on Add 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
Add action – Flows

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

Delete Chatter Messages PB

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

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
Salesforce Platform User

No extra permission is assigned to this user apart from Create and Read permission on the Delete Chatter Message object.

2) Brendan wants to delete a Chatter Message (i.e. What’s up?) that’s sent by System administrator Rakesh Gupta, as shown in the following screenshot 

Chatter Conversation
Chatter Conversation

Now the million dollar question is how to get the Id of Chatter message (i.e. What’s up?) as a business user, when you can’t run a query.

3) To get a Chatter Message Id, open the chatter message and right click on it and then select Inspect Element, as shown in the following screenshot

Select Inspect Element for a Chatter Message
Select Inspect Element for a Chatter Message

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

Chatter Message Id
Chatter Message Id

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

Create a new record
Create a new record

Once you’re done, click on the Save button.

6) Navigate to the Chatter messages and check it out now. The message (i.e. What’s up?) sent by System administrator Rakesh Gupta gets deleted.

Final Output
Final Output

Note :- You can only able to delete those Chatter messages 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 system administrator with the Manage Chatter Messages permission.

In the next article I’m going to discuss a way through which you can allow your users to delete the complete conversation instead of deleting one-by-one Chatter Messages Getting Started with Process Builder – Part 36 (Delete Chatter Conversation)

 

Getting Started with Process Builder – Part 33 (Call an Apex Method from a Process)

Posted on Updated on

Plug In

The new lightning Process builder is an enhanced version of Workflow rule, that helps you easily automate your business processes by providing a powerful and user-friendly visual representation of your process as you build it. With the Process Builder, you can perform the following actions

  • Create a record
  • Update any related record
  • Quick action
  • Launch a flow
  • Send an email
  • Post to Chatter
  • Submit record for approval

While the Process builder is very flexible out of the box, there are a few business use cases those are not achievable using it. For example

  • Process Builder doesn’t support outbound messages
  • Process Builder doesn’t allow us to delete a record

When no other process action can get the job done, add customized functionality to your Salesforce processes by calling an Apex method. To call an Apex method, add the Call Apex action to your process and select an Apex class with an @invocable method Annotation. It means they allow us to extend the Process Builder by writing Apex code that meets certain criteria, and then invoking the Apex from our Processes. If the class contains one or more invocable variables, manually enter values or reference field values from a related record. @InvocableMethod Annotation support bulk operations. Lets start with a business use case

Business Use case :- Steven Greene is working as System administrator in Universal Container. He has received a requirement from the management, whenever a quote is accepted by the customer, then auto delete related quotes from the same Opportunity to save the data storage.

Solution of above business requirement

There are a few possible solutions for the above business scenario, but I’ll use Process Builder and Apex to solve the above business requirement

Apex Method

Now, we need to understand a new Apex annotation introduced in Spring ’15 release i.e. @InvocableMethod Annotation. This annotation lets us mark an Apex method as being something that can be call from somewhere other than Apex. The DeleteOtherQuotes class contains a single method that is passing the ids of the Opportunities whose quotes (i.e. Quotes other than Accepted status) have to be deleted

public class DeleteUnacceptedQuotes
{
    @InvocableMethod
    public static void QuoteDelete(List<Id> OpportunityIds)
    {
        List<Quote> Quotes =[select id from quote
                          where Opportunity.id in :OpportunityIds
                       and Status != 'Accepted'];
        delete Quotes;
   }
}

Follow the below instructions to create a Process for the above business requirement

1.  Click on Name | Setup | App Setup | Create | Workflows & Approvals | Process Builder
2.
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 Delete Unaccepted Quotes as name), API Name and Description as shown in the below screenshot

Define Process Properties
Define Process Properties

3. Click on Object node to add object and then select Quote object. For the entry criteria, Select when a record is created or edited, as shown in the below screenshot. Once you’re done click on the Save button

Evaluation Criteria
Evaluation Criteria

4. The next task is to add Process Criteria, To do this click on Add Criteria, enter Name, Type of action and set filter conditions (In this case set [Quote].Status Equals Accepted) and click on the Save button as shown in the following screenshot

Process Criteria
Process Criteria

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

Add Action - Apex
Add Action – Apex

Under Apex Class section, It will list out all the classes that contain methods annotated with @InvocableMethod Annotation.

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

Delete Unaccepted Quotes

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

It’s time to test this feature

1) Navigate to the Opportunity tab, identify the Opportunity and click on Opportunity Name. Create a few dummy quotes, as shown in the following screenshot

Opportunity with Quotes
Opportunity with Quotes – Before Accept the quote

2) Now update the Quote Test12 status as Accepted. Now check out the quote related list available on the opportunity page. As shown in the following screenshot

Opportunity with Quotes - After quote gets Accepted
Opportunity with Quotes – After quote gets Accepted

Note :- Check out quick comparison between the two ways that you can make a class available from a flow. We can also use Flow and Process builder to achieve it.