screen-shot-2016-10-31-at-13-05-07It’s been a while since I last blogged so what better way to come back than to give you a beastly little blog about the wonders of Salesforce Visual Flow. Yes I mentioned the ‘Flow’ word. *Every Admin hides under their desk.* But come on out, they don’t have to be that scary!

Before I continue I’m going to creep it real with you, Flows are tough! So tough it’s been known for Devs to shudder at the thought of creating them – the really complex Flows that is. But not ALL Flows are mind boggling. There are some Flows that are super simple yet enable you to do powerful things for your users.

Now before you run away just take a little peak at the scenario below – I think you’ll find this handy tip un-boo’lievably useful and EASY!

So here is the customer scenario:

When a Quote has been signed automatically create a Contract.

Before I provide the solution, you may be asking why I am using a Flow to create a record? Well one reason is that you might want to launch the Flow on demand, say through a button, rather than have it triggered by a change in a field or someone creating/ editing a record. Also this is going to give you great practise at creating Flows!

So here is the solution:

Record Lookup
  1. Once you have opened Flow the first thing you’ll want to do is a record lookup on Quote
  2. Drag and drop ‘Record Lookup’ from the Palette, into the Flow builder.
  3. Provide a name for this action – ‘Lookup Quote
  4. Filter the object you’ll want to lookup. In this case you’ll want to Look up ‘Quote’ that meets the following criteria
    • Id = your new variable* that you will need to create {!QuoteId}
    • Scroll down to Assign the records fields to variable to reference them in the flow. ***You can assign the fields that you require, below is just an example….
    • AccountId to be stored in a {!AccountId} variable (again you will need to create this)
    • ContractId to be stored in a {!ContractId} variable (again you will need to create this)
    • Name to be stored in a {!QuoteName} variable (again you will need to create this)
    • OpportunityId to be stored in a {!OpportunityId} variable (again you will need to create this)
    • PriceBook (your price book) to be stored in a {PriceBookId} variable (again you will need to create this)
    • Status to be stored in a {!Status} variable (again you will need to create this)screen-shot-2016-10-31-at-11-04-00

*”Sc’ariables” allow you to hold data. Think of them as pigeon holes. Each pigeon hole (Variable) belongs to someone (field name) and each one stores information (data) for that person (field).

Decision
  1. The next node you’ll need to put into our flow is the Decision. There is where we need to check to see if the Quote status is ‘Accepted’
  2. Drag and drop ‘Decision’ from the Palette into the Flow builder
  3. Provide a name for this action – ‘Check’ Status’
  4. Create an Outcome by-
    • Providing a name – Status = Accepted
    • Selecting the value – {!Status} = Accepted.

screen-shot-2016-10-31-at-11-03-43

Decision
  1. *If Status = Accepted, let’s add another decision. This time checking to see if a Contract exists.
  2. Drag and drop ‘Decision’ from the Palette into the Visual Flow builder
  3. Provide a name for this action – ‘Check ContractId’
  4. Create an Outcome by-
    • Providing a name – ContractId is Null
    • Selecting the value – {!ContractId} is Null {!$GlobalConstant.True}
screen-shot-2016-10-31-at-11-10-26Record Create
  1. *If Contract is Null, (i.e. no contract exists) then you’ll will then need to create the contract.
  2. Drag and drop ‘Record Create’’ from the Palette into the Flow builder
  3. Provide a name for this action – ‘Create Contract’
  4. Choose the record to create – Contact
  5. Assign contract fields with our variables ***You can assign the fields that you require, below is just an example.
    • AccountId = {!AccountId} variable
    • Name = {!QuoteName} variable
    • OpportunityId = {!OpportunityId} variable
    • PriceBook (your price book) = {PriceBookId}
    • QuoteId_c = {QuoteId}

Visual Flow Example

You should end up with something that looks like –

Salesforce Visual Flow Example

There you have it. In just 4 steps you could be on your way to creating records in Visual Flow. See, not so scary right?

See you soon.

Jenny

 

 

Jenny Bamber October 31, 2016

Leave a Reply

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