Salesforce Workflow Actions – Tasks, Send Email

In our previous Salesforce tutorial we have learned about What is workflow rule in Salesforce and learned about different steps involved while creating Workflow rule. In this Salesforce Tutorial we are going to create Salesforce Workflow rules with rule criteria.

What is workflow rule in Salesforce?

Salesforce Workflow Rules are the automated process used in business process to send Email alerts, assign a task, update a field on rule criteria or action based criteria requirements.

In our previous Salesforce tutorial we have learned about Salesforce workflow rules and different workflow rules such as Rule criteria and Rule Actions.

  • Rule Criteria : Rule Criteria defines when the rule actions should happen.
  • Rule Actions  : Rule actions happens when the rule criteria is satisfied.

Creating Workflow Rule with Rule Criteria.

Salesforce Workflow Rule illustration with an Example

Requirement :-  If the invoice amount is greater than 12000.

  1. then it should be marked as “Bulk Invoice” and an email alert should be sent to the invoice owner.
  2. Task should be assigned to the user to review the invoices and Outbound message to be sent out with the Invoice details.

Now we have to understand Rule criteria and Rule actions before creating Workflow rules in Salesforce. As per above example we can understand that workflow rule criteria is Invoice Amount is > 12000 and Rule actions are the above sending email alert, generating Outbound messages, assigning task to the user and marking as Bulk Invoice. Salesforce Workflow Actions

To create salesforce workflow rules login to Salesforce and navigate to Setup | Build | Create | Workflows & approvals | Workflow rules.

  • Click on New rule to create immediate workflow rule in SFDC.

Step 1 : Selecting the Object.

In the process of creating workflow rules in Salesforce there are four steps. Now we have to select invoice Object.

  • As per per our requirement select Invoice Object and click on Next button.

Step 2 : Configuring Workflow Rule.

In this step we have to configure salesforce workflow rule by selecting Evaluation criteria and Rule criteria.

  • Rule name : Enter rule name as Amount greater than 12000.
  • Evaluation Criteria : Evaluate the rule when the record is created when the invoice amount is greater than 12000.
    • Created : This rule will be evaluated at the time of record creation.
    • Created and every time it’s edited : This rule will be evaluated when the record is created and every time the record gets edited.
    • Created and every time it’s edited to subsequently meet criteria : This rule will be evaluated at the time of record creation and edited but with condition only the record meets the criteria.
  • Rule Criteria : In run this rule if the following criteria are met.
  • Invoice Amount greater than 12000.
  • Now click on Save.

Now we have successfully saved our workflow rule. Creating a workflow rule and adding workflow action is a must. So now we are going to add workflow actions to this workflow rule. There are four type so workflow actions in Salesforce they are

  1. Email alert.
  2. Field update.
  3. Outbound Message.
  4. Assigning Task.

Workflow rule with out workflow rule action is useless. When adding workflow rule actions we can also add existing Workflow rule action to the workflow rule.

How to create Salesforce Workflow Actions?

As discussed in the beginning of this SFDC tutorial we have to create the following Salesforce workflow actions.

Requirement :-  If the invoice amount is greater than 12000.

  1. Then it should be marked as “Bulk Invoice” and an email alert should be sent to the invoice owner.
  2. Task should be assigned to the user to review the invoices and Outbound message to be sent out with the Invoice details.

Updating the field as Bulk Invoice when Invoice amount > 12000.

In this scenario the bulk invoice field must be marked as bulk invoice when the invoice amount is greater than 12000 the bulk invoice checkbox should be checked. Before creating workflow action, create a field called ‘Bulk Invoice‘ and made it as checkbox.

  • Click on New field Update as shown above.
  • Enter name.
  • Description.
  • Enter the field to update(Invoice).Field update can be done on the same object and also on the parent object.
  • Select checkbox option as True.
  • Now save all the settings.

Sending Email alert using Workflow rule actions.

Sending email alert is the one of the workflow action provided in Salesforce. The email alert must be send to the customer whose invoice amount in greater than 12000. Let us create new email alert in Salesforce.

  • Click on Email alert.
  • Enter description and select Email Template.
  • Select recipient types like Users, Role, Roles and Subordinates, Owner and so on. Here we are sending email to creator.
  • Click on Save button.
  • Now we have successfully created email alert using Salesforce workflow rule actions.

Creating a Task using Salesforce Workflow rule actions.

We dont have an option called ‘Task’ in workflow actions. Why dont we have option called Task. By default task is available for Standard Object. Here we are working on Invoice Object which is custom object. To add task to Invoice Object, go to Invoice object definition page and click on Edit.

  • Enable Track activities and save it.

Adding new task using Salesforce Workflow rule actions.

  • Select New task as below.

In this workflow action we have to select the user to which this task is to be assigned.

  • Select the user.
  • Enter Subject name.
  • Select due date as shown above.
  • Status is not started and priority is normal.
  • Click on Save button.

Creating Outbound messages using Salesforce Workflow rule actions.

What is an Outbound Message in Salesforce?

Outbound messages are SOAP(Simple Object Access protocol) transactions that are sent to external systems which are integrated to our Salesforce application.

How to can we send Outbound message in Salesforce?

  • Select New Outbound Message in workflow rule action.
  • Enter all the details required to send Outbound message in salesforce.com.
  • End endpoint URL.
  • Select the user to send.
  • Select Invoice fields to send from available fields to selected fields.
  • Finally click on Save button.

Successfully we have all Workflow action in Salesforce.com and we will check the WSDL for the Outbound message.

Activating Salesforce Workflow Rule.

Without activating workflow we can not work on Workflows in Salesforce. Go to workflows and activate the workflow rule.

  • Click on Activate.

Checking Salesforce Workflow Rule Output.

Go to Invoice Object and create a new record where invoice amount in greater than 12000.

  • Click on Invoices as shown above.
  • Click on New to create new record.

  • Enter Invoice amount greater than 12000.
  • Enter all the details like Hospital name, Status.
  • Finally click on Save button.

As shown above Bulk Invoice checkbox is checked automatically because the invoice amount is greater than 12000.

Login into Salesforce as the task assigned user. Now go to Build | Create | Workflow & Approvals | Tasks. Salesforce Workflow Actions

  • Click on Review the generated Invoice .

Conclusion 

In this Salesforce.com Training we have learned about How to create Salesforce Workflow rules and how to create new Salesforce Workflow rule actions and how to check workflow rules and Workflow actions. In our upcoming Salesforce tutorial we are going to learn about Approval Process and configuring multiple steps and multiple approvers to the approval process in Salesforce.com.