Salesforce Approval Process Example Essay

Salesforce provides a way to fetch external data using Apex callouts. The Apex code uses the Remote Site Settings URL to retrieve the data from an endpoint, and also the Apex integrates with Web services by using SOAP, WSDL, and HTTP (REST).

The example below shows how to display the external data in Salesforce from an endpoint using Apex callouts.

Step 1: Create a Remote Site Settings.

URL (https://raw.githubusercontent.com)

The URL contains the candidate details in JSON format with a few fields: Candidate name, Account number, Source, Website, and Email.

Step 2: Create a Wrapper Class

Consolewrap.apxc

public class consolewrap {public String Name{get;set;}public String AccNumber{get;set;}public String Source{get;set;}public String Site{get;set;}public String Email{get;set;}}

The Consolewrap wrapper class contains variables to hold the values from the external data source.

Step 3: Create a Visualforce page

Callout.vfp

<apex:page controller="calloutcontroller" title="JSON table" ><apex:form ><apex:pageBlock ><apex:pageBlockTable value="{!performcallout}" var="wrap" width="100%"><apex:column headerValue="Name" value="{!wrap.Name}"/><apex:column headerValue="AccountNumber" value="{!wrap.AccNumber}"/><apex:column headerValue="Source" value="{!wrap.Source}"/><apex:column headerValue="Website" value="{!wrap.Site}"/><apex:column headerValue="Email" value="{!wrap.Email}"/></apex:pageBlockTable></apex:pageBlock></apex:form></apex:page>

The VF page contains the PageBlockTable to display the candidate details in a table format by calling the Controller class.

Step 4: Create an Apex Class

Calloutcontroller.apxc

public class Calloutcontroller {public List<consolewrap> ConsoleWrapperList{get;set;}public List<consolewrap> getperformcallout(){ConsoleWrapperList = new List<consolewrap>();HttpRequest req = new HttpRequest();HttpResponse res = new HttpResponse();Http http = new Http();req.setEndpoint('https://raw.githubusercontent.com/parthiban019/samplejson/master/student.json');req.setMethod('GET');res = http.send(req);if(res.getstatusCode() == 200 && res.getbody() != null){ConsoleWrapperList=(List<consolewrap>)json.deserialize(res.getbody(),List<consolewrap>.class);}return consolewrapperlist;}}

The Calloutcontroller class uses the HTTP request and GET method to retrieve the data from the endpoint which is in JSON format and the class populates the external data in a wrapper list used to display the data on the Visualforce page.

Step 5: Execute the Visualforce page

In our previous salesforce tutorial we learned about how Approval processes in salesforce works, what are it’s features, what are the steps to be followed before creating approval processes in salesforce. In this crm salesforce training tutorial we create Approval Process with an example.

In creating Approval Processes we have follow 8 steps. Understand each and every step clearly.

  1. Selecting Approval wizard
  2. Enter name, Unique name and description.
  3. Select Criteria for Entering Process.
  4. Specify Approver Field and Record Editability.
  5. Select Email Notification Template.
  6. Configure Approval Request Page Selecting Approval wizard.layout.
  7. Specify Initial submitters.
  8. Activate the approval process.

Above 8 steps must be done to configure Approver processes. Now login to salesforce.com and follow the path.

Setup=>Build=>Create=>Workflow & Approvals=>Approval Processes.

Step 1:- Selecting Approval wizard.

We have two different types of wizards they are

  1. Jump Start wizard :– Jump start will have automatic default settings and it is quick way to create simple approval processes.
  2. Standard Setup Wizard :- By using standard setup Wizard we can create complex approval processes which have multiple steps.

use standard setup wizard

Here we selected Standard Setup Wizard and selected Standard Object opportunity.

Step 2 :- Enter name, Unique name and description.

Approval Process example in salesforce

Now specify the entry criteria and this is optional . This option is used to mention which record should enter the approval process. We can enter formula logic or Selecting certain fields, operator and value as shown below.

Specify entry criteria

In the above screenshot we made only the sales team is to submit opportunity reviews so we entered the criteria Current User : Department equals to Sales.

Select Next.

Step 3 :- Selecting Approver Field and Record Editability Properties.

In this step we want to sent automatic approval request to a user called manager so select manager as shown below.

specify Approver field and record editability properties

We have selected use Approver Field of Opportunity Owner check box, we can set the approval process to use the the standard manager field or Custom Field and then select appropriate record Editability Properties as shown above.

When a approval process is assigned to a user, salesforce.com automatically sends e-mail so we have to create E-mail template to select E-mail notification template in Step 4.

Step 4 :- Select Email Notification Template.

Approval Process example in salesforce

Step 5 :- Select Fields to Display on approval page Layout page.

Approval Process example in salesforce

Approver page is that where approver approves or rejects a request. Here we select the fields that to display on the approval request request page. We have selected the field to display like Date, Status, Assigned to, Actual Approver, Comments and Overall Status as shown below.

Approval Process example in salesforce

Step 6 :- Specify initial Submitters.

Approval Process example in salesforce

We have selected opportunity owner user to submit records for approval and optionally we can select Add the approval history relates list to all opportunity page layouts and Allow submitters to recall approval requests.

Select Save Button.

Creating Approval Steps.

We are able to activate the approval process until we have created at least one approval step for approval processes.

To create approval steps go to Setup=>Build=>Create=>Workflows & approvals=>Approvals=>select the approval process we have created=>Approval Steps=>New approval Step.

creating approval steps

Enter name, Unique name description and Step number as shown below.

creating approval steps

Select Next.

creating approval steps

In the above option we can select all records should enter this step or only the records who have certain attributes.

Now select Next.

creating approval steps

In Step 3 : Select Assigned Approver where we choose to approve he record.

When we select Automatically assign to approver(s) option the page will be like below.

creating approval steps

Delegate approvers cannot reassign approval request

Now Select Save Button.

Now go to detail view of the approval processes and select View Diagram as shown below.

Approval Process example in salesforce

When we click on View Diagram a simple two-step approval step will be displayed like below screenshot.

Approval Process example in salesforce

By using the above process visualizer we can take a printout for understanding.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *