Pages

Showing posts with label Approval. Show all posts
Showing posts with label Approval. Show all posts

Sunday, August 30, 2015

Salesforce: Approval Process - How to approve ?

In previous blog, we discussed about who can approve in approval process? Next, we would like to discuss on how to Approve?

In the approval process, when user submit for approval, system will send an email to approver using email template defined in Approval Assignment Email Template, but this template is not mandatory, so when no template defined, system will use default template with a link to Approval Page Layout page in system.

When using custom email template for approval submission, use following merge field to bring approver directly to the approval page layout: {!ApprovalRequest.Internal_URL} 

Sample email template:
Dear Sir or Madam,

{!User.Full_Name__c} ({!ApprovalRequest.Process_Assignee}) has requested your approval for expense with amount: {!NullValue(Expense__c.Amount__c, "0")}
Expense detail: {!Expense__c.Link}
Expense status: {!ApprovalRequest.Status}

Please click this link to approve or reject {!ApprovalRequest.Internal_URL}

regards,
Salesforce.com

** notice the usage of formula {!NullValue(field name, string)} 


There are few ways for approver to approve or reject the approval process request:

1. Record page layout - Approval History 
Scroll down to Approval History related list of the record page layout, just make sure Approval History is added to the page layout. All users (with access to the record) will see the approval history here, from when and who submit for approval, when and who approve, how many level of approval and reassign history.


2. Home page - Items to Approve
Home page is the landing page when user login to Salesforce, so it is good idea to add Items to Approve component in the Home Page Layout. Only items need to approve by that user will show in user home page. User can approve or reject from here, or by click a link to open record detail. It also show who and when submit for approval.



3. Chatter page
To enable approval process in Chatter, navigate to Setup | Customize | Chatter | Settings, looks for Allow Approvals and enable it. Once enabled, all approval process will be available in Chatter.

If the approver have Salesforce1 mobile app, he/she will see the approval request as notification in the Salesforce1 app. Click the notification will allow user to approve or reject from the mobile.



4. Email
When enabling email approval, system will lets users to reply to email approval requests by typing APPROVE or REJECT in the first line and adding comments in the second line.

To enable approval from email, navigate to Setup | CreateWorkflow & Approvals | Settings, look for Enable Email Approval Response and enable it.

If there is no template assigned to 'Approval Assignment Email Template', and approval via Chatter is enabled, screenshot below taken from email received by approver, where user can use acceptable words: APPROVE, APPROVED, YES, REJECT, REJECTED, NO - not case sensitive, to approve or reject.




Friday, July 17, 2015

Salesforce: Approval Process - Reminder for Approver

In earlier blog, we discussed who can approve on Approval Process? Once user submit a record for approval, approver will receive email to approve or reject, this email is based on email template in Approval Assignment Email Template, but by leave this email template blank, Salesforce will use 'default' template.

But, the approver may missed that email, so the request never been approved or rejected. User also cannot re-submit for approval, by default Submit for Approval button is removed by system after submit for approval.

To track all pending approval requests, admin can run and schedule a standard report called All Pending Approval Requests report, but this will be additional work for admin to manually follow-up on this. Go to Reports tab - Administrative Reports folder - All Pending Approval Requests report.



Solution: create Workflow with Time-Dependent action for Email Alert.
With Time-Dependent Workflow Actions, we can define multiple email alerts for different timing to send alert to approver prior approval / rejection.

Step by step::
1. On the object, add 3 new custom fields to track the approval process:
a) Submit for Approval Date Time - Date/Time field
b) Submit for Approval - Boolean field (default False)
c) Approved - Boolean field (default False)

2. On Approval Process
At Initial Submission Actions, add 2 new Field Update actions to update:
a) Field update: Submit for Approval Date Time = NOW()
b) Field update: Submit for Approval = True

At Final Rejection Actions and Recall Actions, add 1 new Field Update action to update:
c) Field update: Submit for Approval = False
we can leave Submit for Approval Date Time field, so understand the records has been (or when the last) submitted for approval, but rejected/recalled.

At Final Approval Actions, add 1 new Field Update action to update:
d) Field update: Approved = True

3. Create new Workflow with Time-Dependent action:
a) Rule Criteria: Submit for Approval = True AND Approved = False
b) Add Email Alert actions, depend on how many alerts required, as Time-Dependent Workflow Actions
c) Remember to Activate the Workflow.


Issue: the recipient in email alerts (point 3b above).
The recipient in this case would be the approver. Assume the approver is the record owner's manager.
Looking at available recipient type in email alert, there is no option for Owner's Manager.
Vote for this idea: Use 'Owners' Manager for workflow purposes



Here a few options for the workaround:

1. Create a custom Lookup field to User object, this field will show in Related User in the recipient type. You need to have apex trigger to populate owner's manager to this field, but if you are not the #DeveloperHero, use option (2 and 3) below.

2. Similar with option (1) above, create a custom Lookup field to User object, this field will show in Related User in the recipient type. But, instead of using apex trigger to populate owner's manager, you can use Process Builder with action Update Records.



3. Create a custom Email field, this field will be shown in Email Field in the recipient type. You can populate owner's manager email address by using Field Update action, Formula Value = Owner.Manager.EmailThe Field Update action can be added into Approval Process at Initial Submission Actions.


Limitation: if the original approver (Owner's Manager) re-assign the approval process to someone else as Approver, above workflow for reminder will keep send email alert to the original Approver, which is the Owner's Manager.


ReferenceApproval Process With Reminder after submission




Tuesday, July 14, 2015

Salesforce: Approval Process - Who can approve ?

To build an approval workflow in Salesforce is simple, since Salesforce provide Approval Processes. You can find this under Setup - CreateWorkflow & ApprovalsApproval Processes.

In early blogs, we have discussed about Serial and Parallel Approval in Salesforce, in this blog, we would like to discuss in depth option of users can approve?

Manager Approval
In the approval process Step 3. Specify Approver Field and Record Editability Properties, there is option to determine next automated approver.

Notice that Next Automated Approver Determined By is not a mandatory field here.

Option available here:
  • Manager - a standard field in user object and has no relation with Role Hierarchy
  • All custom fields in user object with type = Hierarchy - in above sample: Boss and Sales Director.

If you select Manager as in above screenshot, when you set up Approval Step, in Step 3. Select Assigned Approver you will have option to select Automatically assign using the user field selected earlier. (Manager).


Once this approval step saved, if you go back to approval process Step 3. Specify Approver Field and Record Editability PropertiesNext Automated Approver Determined By become mandatory field.


Change the user field here will auto change Assigned Approver in Approval Steps.


Which Manager?
In Approval process Step 6. Specify Initial Submitters, admin can define who can submit for approval. We have option for the submitter: Record Owner, Record Creator, Public Groups, Role, Role and Subordinates, or specific User. This mean the Manager who approve could be Record Owner's Manager or Submitter's Manager.


How we configure this in Salesforce?

1. Submitter's Manager
This is default option, in approval process Step 3. Specify Approver Field and Record Editability Properties, just select Manager.


2. Record Owner's Manager
If we need the one who approve is not submitter's manager, which valid in many use case, you need go to approval process Step 3. Specify Approver Field and Record Editability Properties, just select Manager, also check Use Approver Field of Opportunity Owner.


Once save, we can confirm in the Approval Process.



Who else can approve?
In approval step - Step 3. Select Assigned Approver you will have option to automatically assign to approver(s)


  • User  --> a specific user to define
  • Queue --> only for object support Queue, such as: Case, Lead and custom object
  • Related User --> in this list, we have Record Owner, Record Creator, User who last modify the record, Lookup field to User in the object (example in Opportunity) - this is not related to custom field in User object.

For information on When multiple approvers are selected, check out this blog.



Monday, April 20, 2015

Salesforce: Manager and Delegated Approver report

In Salesforce user detail, there are 2 fields link to other user and both are optional:

1. Manager
Manager is who a user report to, it is optional and not available in standard user report. Vote the idea here.

But, you can create Custom Report Type to show Manager in a report. Step to create custom report type:
1. Go to Setup | Create | Report Types 
2. Click New Custom Report Type button
3. Select Primary Object = Users
4. Enter Label and Description
5. Store in Category = Administrative Report
6. Deployment Status = In Development or Deployed
7. Click Next and Save button


Now create report using above report type created, you should see Manager field available to use.

2. Delegated Approver 
You can't assign a group or queue as a delegated approver. When an approval request email is sent to the assigned approver, the delegated approver also receives an email notification that there is an approval request to review. Delegated approvers can't reassign approval requests; they can only approve or reject approval requests.

But, using above custom report type created, Deletegated Approval is not available. On the other way, Manager is available on Standard User report type.

If you would like to get both fields in a report, you need to use Joined report.
The solution will be to create a joined report containing both the standard report type and the custom report type on the user table. The report can be grouped by User Full name and have both the Delegated Approver and The Manager Approver in the same report.



Also you can now Export the report (by using the Print Report button) and joined report can now be displayed on Dashboard as well.


Reference: How can I Report on delegated approved and manager field for the user object in one report?



Friday, July 11, 2014

Salesforce: Serial and Parallel Approval

Approval process has been introduced in Salesforce platform sometimes back. But when someone ask you, if Salesforce support Parallel and Serial approval process?

The answer is YES, although Salesforce do not implicitly said it is parallel or serial approval process.

The good thing is, this functionality available out of the box. So you do not need to write any code. Just with point and click configuration, you can build this process within hours.


Parallel Approval
Parallel Approval means you are sending multiple approvals out in one step of the approval process. Any approver able to approve without need to wait for other approvers to approve.

The approver can be specific users, a queue or related user in the record.

How to configure this in Salesforce?
When you reach Approval Steps - Select Assigned Approver, choose Automatically assign to approver(s)

In sample above, when user submit for approval, it will go to a user 'Maria Ann' and also go to 'Finance Queue' at the same time. Maria do not need to wait a user from Finance queue to approve, and the same for user in Finance queue can approve without have to wait Maria approval.

You also can specify whether only the first approval is needed or ALL approval need to approve, when all approved, it will move to the next step of approval process. It is configured in above screen at When multiple approvers are selected. When you select "Require unanimous approval from all selected approvers." the record is only approved if all of the approvers approve the request. The approval request is rejected if any of the approvers reject the request.

Note: approval assigned to a queue, it does not mean ALL users in the queue have to approve, when one of the user in queue approve, it is considered as Approve from the queue.

Here is a screenshot once user submit for approval, it will go to both user and queue for this sample.

This when Linda from Finance has approved


Serial Approval
Serial Approval means after a user approve, it will move to the next user to approve. Most use case for this when next approval is needed when it hit certain criteria, example:
1. When discount given < 10%, only Sales Manager need to approve, but
2. When discount given >= 10%, after Sales Manager approved, it also need to be approved by Sales Director. So, Sales Director only need to approve when it has been approved by Sales Manager.

How to configure this in Salesforce?
When you reach Approval Steps, you need to create multiple steps. Each steps may have different criteria. See screenshot below for the details.

When user submit for approval, he will only see the immediate approver only:

When Linda approve, because discount for this opportunity is more than 10%, it will go to the next approver


You can click View Diagram button in Approval Process to display the flow, you also can click each item to show the properties.



Last one, you also can combine both parallel and serial approval in an approval process. Example: after Sales Manager approve, it will go to Sales Director approval and also Ops Director approval, both user need to approve, so we select Require UNANIMOUS approval from all selected approvers.


ReferenceCreating Approval Steps



Monday, January 6, 2014

Salesforce: Approval Process status (2)

Last year, I blog about how to get Approval Process status using SOQL query to ProcessInstance object, see this blog.

Query to ProcessInstance (04g) will give you Status of approval, together with the date/time of when approval submitted and user submit it, see CreatedDate and CreatedById field.
Note: LastModifiedDate and LastModifiedById will NOT change when a user approve / reject an approval request)

If you need more information, such as:
  • Approver username
  • Original approver username
  • Date/time for each transaction
  • Step Status
  • Comments
You can query from ProcessInstanceStep (04h) object, example:
SELECT p.Id, p.ActorId, p.OriginalActorId, p.StepStatus, p.Comments, p.CreatedById, p.CreatedDate, p.ProcessInstance.Status from ProcessInstanceStep p WHERE p.ProcessInstanceId = '04g500000029HCmAAM'



ActorId is the user who is currently assigned the approval step, while OriginalActorId is the user who was originally assigned to this approval step. Query to this object will give full information on the approval steps for each approval.

Another object related to approval, it is ProcessInstanceWorkitem (04i), this object will stored all approval pending request. Meaning approval that has been approved, rejected and recalled will no longer available here. Sample query:
Select p.Id, p.ProcessInstanceId, p.ProcessInstance.Status, p.ProcessInstance.TargetObjectId, p.ActorId, p.OriginalActorId, p.CreatedById, p.CreatedDate from ProcessInstanceWorkitem p


For query to ProcessInstanceWorkitem, actually you can run Salesforce report All Pending Approval Requests. This is standard Salesforce report available from 'Administrative Reports' folder. 

And screenshot below for the result and compare with query result above.


Wednesday, January 16, 2013

Salesforce: How to get Approval Process status

Out-out-the-box, Salesforce.com has Approval Process featured with lock mechanism to lock record has been submitted for Approval, so user unable to change the record.

But, Salesforce.com do not provide approval history by default. So, user cannot run a report to show which records has not approved or approved or rejected. Ideally, admin should configured field update actions to update a field with current status: pending, approved, rejected or recall.

I meet a situation where approval process has been setup and deployed for few months back, but later user  realize unable to run report on the approval status. How we can get the approval status for all opportunity has been submitted for approval? Is it possible, any workaround?

YES, as long as you are in Enterprise Edition or Unlimited Edition or Professional Edition with API enabled.

Here is the steps:
1. Run SOQL with query syntax Select p.TargetObjectId, p.Status from ProcessInstance p then  export into CSV or Excel file.

2. Export all Opportunity with Id into CSV or Excel file.

3. Open both files in Microsoft Excel as two worksheets, then use VLOOKUP() function in Microsoft Excel to get all Opportunity with approval Status from ProcessInstance object. Status should be: Pending, Approved, Rejected, Removed.

Good luck and hope this solution help.

Page-level ad