Feeds:
Posts
Comments

Archive for February, 2015

Submit to approval process for Pick list value change

We can achieve this by using trigger. We can get the new value and store it in new hidden field. Using the new field we can trigger the approval process with the help of Process Builder.

Let’s take example.

While updating opportunity stage from “Prospecting” to “Qualification” by a user, The record must be submitted for Approval Process automatically.

Step1: Setup->Build->Customize->Opportunities->Fields->Opportunity Custom Fields & Relationships
Create new text field called “Selected Stage”. If required add to page layout.
Step2: Setup->Build->Develop->Apex Triggers
Write new trigger

trigger tgrUpdatedStage on Opportunity (before update) {
for (Opportunity objOpp: Trigger.new) {

if(objOpp.StageName != Trigger.oldMap.get(objOpp.ID).StageName){
objOpp.Selected_Stage__c= objOpp.StageName;
objOpp.StageName = “Prospecting”;
}
else{
objOpp.Selected_Stage__c = “”;
}
}
}

Step3: Setup->Build->Create->Workflow & Approvals->Approval Process Create a workflow for Opportunity.
Entry Criteria must be Selected Stage equals to ”Qualification”
Create Approval Step and assign to Specific user for approval.

Final Approval Actions:
Unlock the record for editing Do the Field Update.
Update Opportunity Stage to “Qualification”
Make sure to uncheck “Re-evaluate Workflow Rules after Field Change”
Do the Field Update: Update “Selected Stage” equal to “”

Rejected Actions:
Unlock the record for editing
Do the Field Update: Update “Selected Stage” equal to “”

Step4: Setup->Build->Create->Workflow & Approvals->Process Builder

Create a new Process Builder Called “Stage Automatic Approval Process”

Add Object “Opportunity and Start this process when a record is created or edited Click on Add Criteria->Provide Criteria Name

Filter Conditions->Selected Stage Equals “Qualification” and Save. Activate the Process by Clicking Activate.

 

Ready for testing………………………..

Read Full Post »