Tuesday, June 27, 2017

Difference between flows, workflows and process builder in Salesforce

Workflows enable us to set up rules that are evaluated and the corresponding action is executed based on the type of change in record. Few common cases in which workflows are used are:

 

1. Create a new task on an event
2. Update a field
3. For email alerts
4. For outbound messages

 

Example of workflow to update the mailing city:

 

 

Process Builder is more advanced than the workflows. The major difference between workflows and process builder is the number of operations or actions they are used for performing. Process builder is used in several more complex cases like:

 

1. Update any related record
2. Send an email
3. Call Apex methods
4. Call a flow
5. Posting to chatter

 

If you want to update a process created with process builder there is no way to do it. You need to clone the existing process and update it. Due to if-else criteria of process builder, a process that will need many workflows can be built with a single process.

 

Example of a process created with a process builder for updating records in case address changes:

 

 

Flows, on the other hand, is an integrated app in Salesforce that can be used to perform various operations such as execute logic, collect data from users, call apex classes and interact with Salesforce database independent of the data change events. To create flows you need cloud flow designer in salesforce. The main difference between flows and workflows is flows are user-triggered application and workflows are event-triggered. Workflows execute their actions behind the scenes while flows can display information on the screen. In workflows, actions are associated with a particular object and its related objects which is not the case with flows since they can create, update, lookup and delete records for multiple objects.

 

Many different types of apps can be created with flow elements at a very rapid pace.

 

The business process can be anything like:

 

1.  Filling out a survey
2.  Filling out a form
3.  Working on a script

 

The basic example of flow is shown below:

 

Below is an example of a flow for creating a survey for collecting customer feedback. Every survey follows a flowchart.

 

In this example, the survey starts with the customer greeting screen. This screen will display the greeting message and will ask the user permission to proceed further. Settings and selection of screen can be done from the left panel in user interface shown in the figure. After that, you can add decision from a logic panel on left if the decision is no and you want to end the survey than you can add ‘thank you customer screen’.

 

If the decision is yes then go further and make the new screen for customer survey and add your data by how you want this survey to be done and in the end, after completion of the survey you can end the survey:

 

Workflows and approval process and process builder:


1. What is workflow rule and Workflow actions?
Many of the tasks you normally assign, the emails you regularly send, and other record updates are part of your organization's standard processes. Instead of doing this work manually, you can configure workflow to do it automatically.
Workflow automates the following types of actions based on your organization's processes:

  • Tasks—Assign a new task to a user, role, or record owner.
  • Email Alerts—Send an email to one or more recipients you specify.
  • Field Updates—Update the value of a field on a record.
  • Outbound Messages—Send a secure, configurable API message (in XML format) to a designated listener.
Before adding new action you need to deactivate workflow rule and do the changes and then again activate it.

2. A workflow already exists on object. Now user want to add time dependent workflow action to it but not able to get an option to select time dependent action. What might be issue?
Evualation criteria is set to “created, and every time it’s edited”
3. What is queue?
A queue can hold a predefined set of objects and consists of a set of users. Any of the queue members can pick up tasks assigned to the queue. Users or Queues can be owners of records.
While adding queue members to queue, you can add users, public group, partner users, specify role of users etc.

4. What are approval process?
Salesforce supports wizard based easy to configure approval process. After an object is selected, the wizard guides the user through a step-by-step setup. Approval process is triggered when a user clicks on the "Submit for approval" button.
The approval process consists of the following steps -

  • Process definition
  • Initial submission actions
  • Step definitions
  • Final Rejection actions
  • Final Approval actions
Final Recall actionsIn workflow rule,action is triggered when a record meets an evaluation criteria. Workflow rules definition does not impact existing records. Workflow rule gets applied to new record creation or edits.

5. Is it possible to create parallel approval process (ability for multiple user to approve or reject a record)?
Yes. Parallel approval process allows specifying (upto 25) multiple approvers. The approver setting could be set to unanimous, or first action. In unanimous parallel approval process, all approvers must approve a request, before it is considered as approved.

6. Difference between workflow rule and approval process?
WorkflowApproval
They are activated when a record is saved.Approval process are triggered by explicitly clicking the "Submit for Approval" button.
Workflow consists of single step and different actionApproval process consists of multiple steps. Also different action is taken based upon whether the record is approved or rejected.

7. Is it possible to start approval process after records is created in salesforce without clicking on submit for approval button?
Yes. Process builder or apex trigger can be used to initiate approval process when record is created.

8. How we can achieve dynamic approval process like approve of position record should be user defined in hiring manager field of position?
It is possible through apex triggers because in standard approval process, you need to define approver while creating approval process.

9. Is it possible to skip steps in approval process?
Yes.
In processes that have steps that are optional depending on criteria, use the skip step feature.
To skip steps, use filter criteria or formula, then choose what should happen to records that do not meet the criteria. The options are:
- Approve Record (approves the request and performs all final approval actions).
- Go to Next Step (skips this step and goes to the next step).

10. Can we implement multilevel approval process in salesforce?
Yes. Define different steps in approval process.

11. Can we update parent record with workflow field update?
Yes, only if relationship is master detail. If it is look-up relationship, then it is not possible.


1. What is process builder?
The Process Builder is a workflow tool that helps you easily automate your business processes by providing a powerful and user-friendly graphical representation of your process as you build it. The Process Builder’s simple and powerful design allows you to:

  • Create your processes using a convenient layout with point-and-click efficiency.
  • Create your whole process in one place rather than using multiple workflow rules.
  • Create processes by collaborating with different teams in your business.
  • Stop using Apex code to automate simple tasks.
Automated processes in the Process Builder are based on records and consist of:
  • Criteria that determine when to execute action groups.
  • Immediate and scheduled actions to execute when those criteria are met.
Any change that causes a record to match the criteria can automatically trigger the action group.
You can use the more powerful and flexible Process Builder to perform the same actions as workflow. The process builder doesn’t support outbound messages, but you can easily create one yourself with Apex. With the Process Builder, you can:

  • Create a record
  • Update any related record—not just the record or its parent
  • Use a quick action to create a record, update a record, or log a call
  • Launch a flow—you can’t schedule this action with workflow
  • Send an email
  • Post to Chatter
  • Submit for approval
  • Call apex metheod
2. What should be the condition we need to specify in process builder to specify schedule actions?
Below are 2 conditions:

  • Only when record is created
  • When record is created or edited and while define criteria select the checkbox for below setting
    • Do you want to execute the actions only when specified changes are made to the record?
3. Is it possible to edit the process once it is activated?
No, You need to clone and while cloning you can create new process or create new version.

4. How to troubleshoot the errors if any issue comes in process builder?
Use the error messages that appear in the Process Builder and the emails you receive when a process fails to help solve problems that arise when you’re working with processes. When all else fails, look at the Apex debug logs for your processes.

  • Identifying Errors in the Process Builder
The API names for criteria nodes and actions are created in the background. When you create or update processes, you might see error messages that reference those names to help you identify specifically where the problem occurred.
  • Errors Received after a Process Starts Evaluating a Record
When a user performs an action that triggers a process (such as creating a record) and that process fails, the user sees a page with this error: “Workflow Action Failed to Trigger Flow.” In addition, the administrator who created the process receives an email with more details.
  • Using Debug Logs to Troubleshoot Processes
Use debug logs to find detailed information about your running processes after they finish running. For example, if a process doesn’t seem to trigger when a record meets the process’s criteria, or if you want to understand the sequence of processes being executed.

5. What user permission is required to create edit and view process?
“Manage Force.com Flow” AND “View All Data” in profile.

-----------------------------------------------------------------------

How does Time-Based Workflow impact my existing records?

Workflow rules are not triggered retroactively. If you create a rule now, the rules are not applied to previously created records.
 
  • Example: When you create an Opportunity reminder rule, it doesn't run against existing Opportunities. The new rule only applies to records created or updated after the rule is activated.
     

What workflow actions can I use with Time-Based Workflow?

All existing actions will be available: Email Alerts, Field Updates, Tasks and Outbound Messages.
 

Can I configure multiple actions to occur at different points in time for the same rule?

Yes, you can create a timeline of actions by configuring multiple time triggers and defining actions for each one.
 
  • Example: Consider a rule for all high value opportunities (value > $500K, probability > 70%). The immediate actions could include sending an email alerts to the Account team stating that a new high value Opportunity has been created. The time-dependent actions could include the following:
    • 10 days before the Opportunity close date, assign a Task to the Opportunity owner to follow up with the customer.
    • 7 days before Opportunity close date, change the owner of the Opportunity to VP Sales, and send an email alert to the new owner.

Are there any restrictions for Time-Based Workflow?

Yes, it's not possible to configure a time-dependent workflow action that's set to evaluate criteria "Every time a record is created or edited."
 

Can I see which time-dependent actions are pending executions?

Yes, all pending actions to be triggered on a future date appear in the Workflow Queue.
System Administrators can view and manage the queue from:
 
  • Improved Setup Under Interface (Enabled): Go to Setup | Monitor | Time-Based Workflow
  • Improved Setup Under Interface (Disabled): Go to Setup | Administration Setup | Monitoring | Time-Based Workflow

Will the pending actions in the queue ALWAYS trigger?

No. Time-dependent actions remain in the Workflow Queue until processed or the rule criteria for the Workflow Rule are evaluated as "false." If a record no longer matches the rule criteria when the rule is evaluated, Salesforce removes the time-dependent actions queued for that record.
 
  • Example: An Opportunity Workflow Rule may specify:
    • A criteria set to "Opportunity: Status not equals to Closed Won, Closed Lost."
    • An associated time-dependent action with a time trigger set to 7 days before the Opportunity close date. If a record matching the criteria is created on July 1st and the Close Date is set to July 30th, the time-dependent action is scheduled for July 23rd. However, if the Opportunity is set to "Closed Won" or "Closed Lost" before July 23rd, the time-dependent action is automatically removed from the queue.

Can the pending actions for a record be queued again?

Yes, if the record is updated and you set the evaluation criteria to be "When a record is created, and anytime it's edited to subsequently meet criteria" (The record should not have previously meet the entry criteria).
 
  • Example: If the Opportunity status is changed from "Closed Lost" to "Prospecting" and the Workflow rule evaluation criteria is set to "When a record is created, and anytime it's edited to subsequently meet criteria" (Assuming the record did not previously meet the criteria), Salesforce re-evaluates the time triggers and adds the appropriate actions to the Workflow Queue.

What if the evaluation criteria is set to "Only when a record is created"?

In this case, the Workflow rule evaluates the time triggers only once. If the record that fired the rule changes and no longer meets the evaluation criteria, the pending actions are removed from the queue and the rule is never reapplied to the record.
All pending actions are evaluated only for as long as the rule criteria is true. While Salesforce evaluates the rule every time the record is updated, it does not trigger all the actions associated with the rule every time.
 
  • Example: Consider two rules that are identical, except the evaluation criteria of Rule 1 is "On create only" and Rule 2 is "When a record is created, and anytime it's edited to subsequently meet criteria."
    • If you create a record that matches both rules, Salesforce executes the immediate actions and queues the time-dependent actions of both rules. If you then update the record and it no longer meets the rule criteria, Salesforce removes the pending actions for both rules. If you then update the record so it meets the rule criteria again, Salesforce only executes the actions associated with Rule 2.

What happens if I update the value of a date field used in a time trigger?

Salesforce recalculates the time trigger as long as the time trigger has not yet fired and the recalculation does not reschedule the time trigger to a date in the past.
 
  • Example: If a Workflow Rule alerts the Opportunity owner 7 days before the Opportunity Close Date and the close date is set to Feb 20, 2018, Salesforce sends the alert on Feb 13, 2018. If you update the Close Date to Feb 10, 2018 and the current date is Feb 2, 2018 (or before), Salesforce reschedules the alert for Feb 3, 2018. The evaluation date of pending actions is ALWAYS reevaluated and updated (if necessary) irrespective of the rule criteria. If the rule is evaluated to false, it won't matter as the actions are removed from the queue.

What happens if I delete a record that has pending actions?

The pending actions are deleted from the Workflow Queue and cannot be restored, even if you undelete the record.
 

Why do I get an error "Pending Workflow" when trying to convert a lead?


If there are any pending Approval Processes or Workflows to be triggered, you will not be able to convert a Lead. That said, you can remove the pending actions under Setup and the conversion will go through.

----------------------------------------------------------------------
 What is the AppExchange?

AppExchange is a Website Owned and Operated by salesforce.com which enables Partners and Customers to Download & Install Custom Apps and Components as per the need.

 Jump Start Wizard vs. Standard Wizard ?

The Jump Start wizard creates a one-step approval process for you in just a few minutes
The Standard Wizard is useful for complex approval processes.

Jump Start Wizard
• The jump start wizard is useful for simple approval processes with a single step.
• Use the jump start wizard if you want to create an approval process quickly by allowing Salesforce to automatically choose some default options for you.

Standard Wizard
• The standard wizard is useful for complex approval processes.
• Use it when you want to fine tune the steps in your approval process.
• The standard wizard consists of a setup wizard that allows you to define your process and another setup wizard that allows you to define each step in the process.

Parallel Approval Routing ?

Parallel Approval Routing is sending approval requests to multiple approvers in a single step Wait for approval from all the approvers or wait for approval from any one
Configure an approval step to request approval from any combination of multiple users and related users.
Configure 25 parallel approvers at each step.

----------------------------------------------------------------------

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 usersa 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.
----------------------------------------------------------------------


Interview Questions on Workflows and Approval Process In salesforce


1. What is work flow ?
Ans: Work flow works based on certain criteria,By using workflow we can automate the business process like Email alerts,tasks,filed updates

2. What are the different kinds of evaluation criteria’s (events)?
Ans: 1.created
2.created, and every time it’s edited
3.created, and any time it’s edited to subsequently meet criteria

3. In which object workflows are stored?
Ans: Workflow

4. What is the difference between Created and everytime edited to meet the criteria and Created and edited to subsequently meet the criteria?
Ans: If we select 'Created and everytime edited to meet the criteria' whenever we create a record or edit a record if the criteria of the workflow rule meets then it will trigger every time. If we select 'Created and edited to subsequently meet the criteria' -

While creating the record criteria meets so that workflow will fire and while editing the record again criteria meets workflow won't fire (meeting the criteria to meeting the criteria)
While creating the record criteria doesn't meet so workflow won't fire and while editing the record workflow criteria meets then workflow will fire (not meeting the criteria to meeting the criteria)
Conclusion: Previous state of record should be not meeting criteria and current state of record should be meeting the criteria then only in current state workflow will fire.

5.What are the types of rule criteria’s?
Ans: 1.Criteria meet (field - operator - value, if there are multiple criteria’s then in filter criteria we can give conditions like ( 1 or 2) and 3, field to field comparison is not possible, we can't fetch the previous state information of the field )
2.Formula evaluated (we can write formulas with this we can do field to field comparison and we can fetch previous state value of the record)

6. What is immediate workflow action?
Ans: The action which will be performed immediately after the record criteria meets.

7. What is time dependent workflow action?
Ans: The action which will be performed in future based on the any of the date field. To create time dependent workflow action we should create one time trigger. in time trigger we can give either days or hours with the maximum of 999 value and we can select either before or after.

8. For which event we can't create time dependent workflow action?
Ans: Created and everytime edited to meet the criteria.

9. What are the different kinds of workflow actions?
Ans: New field update (we can update a field of the same object or the fields of the parent objects which are at master side in master-detail relationship, only for master-detail parent objects we can update the field and for lookup we can't update)
New email alert (we can send emails if the criteria meets)
New task (we can create new task)
New outbound Message (we can make a callout)

10. What are the types of email templates?
Ans:1.Text
2.HTML (with letter head)
3.Custom HTML (without letter head)
4.Visual Force

12. How can you monitor future actions of time based workflow?
Ans: setup --> administration set up --> monitoring --> time based workflow

13. There is a timebased workflow which will update one of the fields if the criteria meet. User submits the record with valid criteria, workflow triggered so that the field update is queued in the 'time based flow' queue which will fire after one day. If the user modifies the record which is submitted before the scheduled date, after modification, a record criterion is not meeting. Whether the field will be updated or not in schedule date?
Ans: It won't trigger in the schedule date because if we modify the record to not meeting criteria that queued field update will be removed from the 'time based flow' queue.

14. For the same scenario explained in the above question what happens when we deactivate or modify the criteria of the workflow to different criteria? Whether the field will be updated or not in schedule date?
Ans: Yes, It will trigger in scheduled date.

15. Scenario: There are two workflow rules on the same object say namely wf1 and wf2. If wf1 fires then a field will be updated on the same object, if the field updated and due to this wf2 criteria meets then what will happen, wf2 will fire or not?
Ans: It won't fire. To fire wf2 we should enable 'Re-evaluate Workflow Rules' checkbox of the field update which is there in wf1.

16. What is recursive workflow rule? How to avoid recursive workflow rules?
Ans:Whenever we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule, due to this field update other workflow rules on the same object will be fired if the entery criteria of those workflow rules satisfied.

Incase, in other workflow rules also if we enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update recursive workflow rules will come in some scenarios.

We can take two steps to avoid recursive workflow rules -

For the workflow Evaluation Criteria if you choose created, and any time it’s edited to subsequently meet criteria option, we can avoid recursive workflow rules.
If you don't enable Re-evaluate Workflow Rules after Field Change checkbox in the Field Update of a workflow rule we can avoid.

17. What is Approval Process?
Ans: If the criteria of the record meets then by clicking on submit for Approval button user can submit the record for approval (Note: Approval history related list should be displayed on the record detail page)

18. Scenario: After activating the approval process, I want to add one more step. Is it possible?
Ans: It’s not possible, to add one more step deactivate the approval process and clone the deactivated approval process and add the new steps.

19.In which object all Approval process are stored?
Ans: Approval.
----------------------------------------------------------------------

Multiple approvers for Approval process in Salesforce


1. Go to Setup --> Create --> Workflow & Approvals --> Approval Processes.


2. Select the object to create approval process.

3. Click "Create New Approval Process" button and click "Use Standard Setup Wizard" link.


4. Enter a name and description for your new approval process.

5. Click "Next" button.


6.  Specify Entry Criteria.

7. Click "Next" button.


8.  Specify Approver Field and Record Editability Properties.

9. Click "Next" button.


10. Select Notification Templates.

11. Click "Next" button.


12. Select Fields to Display on Approval Page Layout.

13. Click "Next" button.


14. Specify Initial Submitters.

15. Click "Save" button.


16. Select "No, I'll do this later, take me to the approval process detail page to review what I've just created".

17. Click "Go" button.


 18. Click "New Approval Step' button.


19. Enter Name and Description.

20. Click "Next" button.


21. Specify Step Criteria.

22. Click "Next" button.


23. Select "Automatically assign to approver(s)".

24. Select the "Queue" or "User" or "Related User".

25. When multiple approvers are selected, select anyone of the following

    a. Approve or reject based on the FIRST response.
    b. Require UNANIMOUS approval from all selected approvers.

26. Click "Add Row" link to add multiple approvers.

27. Click "Save" button.


28. Click "Activate" button to activate your approval process.



29. Go to the Object's page layout and add Submit for Approval button and Approval History related list.


30. Add "Submit for Approval" button.


31. Add "Approval History" related list.



Output:

----------------------------------------------------------------------

Limitations of the workflow

The workflow feature is only available in Enterprise, Unlimited, Performance, and Developer editions. For the Professional Edition, you can enable this feature after paying an extra amount. As Salesforce is based on a multitenant architecture, it imposes a few limitations on the workflow:

• For each workflow rule, you can have the following:
  • 10 time triggers
  • 40 immediate actions
  • 40 time-dependent actions per time trigger



• For both immediate and time-dependent actions in one workflow rule,
there can be no more than:


  • 10 email alerts
  • 10 tasks
  • 10 field updates
  • 10 outbound messages


• The workflow time trigger per hour limit for different editions are as follows:
  • Professional Edition: 250
  • Enterprise Edition: 500
  • Developer Edition: 50
  • Unlimited and Professional Edition: 1,000


• The workflow e-mail limit per day is as follows:


  • 1,000 per Salesforce standard license
  • 200,000 per organization



Note: Once an organization's daily e-mail limit of 200,000 exceeds, Salesforce will send a warning e-mail to the default workflow user and discard all the e-mails. Salesforce does not try to resend them later.
-----------------------------------------------------------------

Call an Apex Method from a Process builder:

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 a 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 aApex method. To call an Apex method, add the Call Apex action to your process and select an Apex class with a @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 ContainerHe 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 for the 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. @InvocableMethodAnnotation. This annotation lets us mark an Apex method as being something that can be called 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 Nameand 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 NameType of action and set filter conditions (In this case set [Quote].Status Equals Acceptedand 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 Apex), 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 theopportunity page. As shown in the following screenshot
Opportunity with Quotes - After quote gets Accepted
OPPORTUNITY WITH QUOTES – AFTER QUOTE GETS ACCEPTED

Salesforce Time-Dependent Workflow and Entry Criteria

Time-Dependent Workflow is a very nice feature out-of-the-box from Salesforce. You can easily configure it to do action such as: create task, send email alert, field update and send outbound message. The actions will only trigger when a certain date or hour hit as it is configured.

Actions for Time-Dependent Workflow is exactly the same with Immediate Workflow, and you can share the same actions between Time-Dependent Workflow with Immediate Workflow, depend on your business needs, even to combine Time-Dependent and Immediate workflow in the same workflow rule.

One thing you need to note when create Time-Dependent Workflow is the Evaluation Criteria, make sure it is set to created or created, and any time it’s edited to subsequently meet criteria only. Created, and every time it’s edited will NOT allow you to have Time-Dependent Actions.





I get a request from my user to change a running Time-Dependent Workflow from 7 days before Birthdate to 14 days before Birthdate. Here is the step:
1. Screenshot existing Time-Dependent Workflow with the actions (for backup purpose)
2. Deactivate the workflow
3. Remove all existing actions in that Time-Dependent Workflow
4. Edit Time-Dependent Workflow and you will be able to modify the day to 7 days
5. Add back all existing actions for that Time-Dependent Workflow
6. Activate the workflow back

Few items to note:
1. All existing data will be NOT trigger again for Time-Dependent workflow, because it already met the entry criteria earlier. So, if your Entry Criteria is 'Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria', you need to make the record to 'meet' the criteria again:

  • Update the record NOT to meet the criteria, then update it back to meet the criteria.
  • Example: if we are using Rule Criteria "Birthdate NOT EQUAL TO null", we need to make it to null first (make sure to backup first), then populate the original Birthdate back, so it will meet the criteria again.

2. Monitoring, you can monitor record queue to be triggered for Time-Based Workflow from Setup - Administration Setup - Monitoring - Time-Based Workflow. You can select some criteria to monitor the queue or just leave all to --None-- and hit Search button.



Cross-Object Workflow in Salesforce.com

With Spring '12 Release, cross-object field updates in workflow rules and approval processes now support standard objects. Both custom-to-standard and limited standard-to-standard relationships are supported.
This feature only available in Enterprise and Unlimited edition.

Only Master-Detail relationship support using cross-object workflow, so cross-object will not work in Lookup relationship.

Here is a sample case for using Cross-Object workflow.
Master object: Customer__c
Child object: Order__c
Company would like to know how much and when latest order for each customer, but date use to determine is payment date, not order date, and payment date will be blank when customer have not make payment.

So, here we go:
1. Create a workflow in Order which will run on create and every time edit
Rule criteria:
NOT ISNULL( Payment_Date__c ) && 
( Payment_Date__c >= Customer__r.Payment_Date_hidden__c || 
  ISNULL( Customer__r.Payment_Date_hidden__c )) 
Explanation:
- if payment date is blank, stop workflow
- if payment date in order is newer than stored payment date in customer, proceed workflow OR
- if stored payment date in customer is blank

2. Create field update in Order
a. Update Payment Date in Customer
Select object = Order
Field to Update = Customer, the select field Payment Date
Formula Value = Payment_Date__c from Order

b. Update Amount in Customer
Select object = Order
Field to Update = Customer, the select field Amount

Formula Value = Amount__c from Order


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.

No comments:

Post a Comment