☏ 01494 590428 | ✉ hello@commerceworks.net

Crafty things with Visual Flows, Process Builder and a bit of Magic

Now you’ve all read the last Blog about Product Schedules and I know you're itching to get started with them, let’s look at making them a bit funkier.

Here’s the Scenario.

Toots Printers have implemented Product Schedules, it’s saving a lot of time and producing much more accurate revenue forecasting. However, they've hit a problem as the Close Dates on their Opportunities tend to move quite a lot and they want the Schedule dates of a Product to move with the Close Date.

OK, so how are we going to do this?

First things first, what tools within Salesforce will allow us to get to the Product Schedules?

After a lot of head scratching, turning Workflows and Process Builder inside out, it looked like it would have to be done with a Trigger.

Hmm, we always lean towards standard solutions in advance of code.

Whilst I ‘m hanging on for a developer I remembered an article I came across written by a guy called Nick Spencer (Thank you Nick you’re amazing!) who had done something similar with a mix of workflows, process builders and Visual Flow!  Never being one to reinvent the wheel I thought I’d have a go at using his approach and adjusting it to meet the needs of Toots Printers.

So, onwards and upwards!

Let’s list out what we need:

Custom Date field ‘Days Shifted’ on the Opportunity as we need to capture how many days the date has moved by;

  1.  2 flows;
    • Flow 1 to update the Line Schedule
    • Flow 2 to update Opportunity Line Item Dates
      • Flow 1 will be a sub-flow of Flow 2;
  2.  A Process which will fire the Flow;
  3. Workflow to update the number of days the date has moved by.

Step 1
Create the ‘Days Shifted’ number field with no decimal places on the Opportunity.

Step 2
Workflow to Populate the field in Step 1.  This workflow will fire whenever the Close Date changes.


The action for the Workflow sets the value for the ‘Days Shifted’ field, remember to tick the ‘Re-evaluate Workflow Rules after Field Change’.



Before you go to Step 3, if you’re new to Flow then you need to read my previous Blog and also check out the Salesforce guide here.

Step 3 Flow 1 – Update Line Schedules

This flow is the sub-flow in Flow 2.  So, don’t worry if you have some loose ends flying around!

This is going to find all the Product Schedule records that are associated to an Opportunity Line record and then it will update all the dates on the records.

Here is an overview of the Process


1. Flow Fast Lookup

The Fast Lookup will find all the OpportunityLineItemSchedule records that’s Opportunity LineItem ID is the same as the svarOpportunityLineItem.Id. – we will use the svarOpportunityLineItem.Id in the other flow.

All records that meet the criteria will be put into a collection (scvLineSchedules) and the ScheduleDate of the records is stored along with the ID’s in the Collection.


1. The Loop

The Loop cycles through all the records in the scvLineSchedules collection and assigns the next record to the SObject variable svarLineSchedule.

If a connection is found a connection from a loop, it gives two options: “for each value in the collection” and “when there are no more values to process”.


3. Assigning the new Date to the Record

Once the Loop has added a single record to svarLineSchedule, now it needs to assign the new date value to that record.  The formula for that was set up in the flaNewScheduleDate.


4. Add the updated record to a new Collection

Now we have the new date in our variable we need to add it to a new collection within the Flow.


In this assignment the operator is Add.

The flow will now loop around and repeat the process until all the records are processed.

5. Fast Update Salesforce

Now Salesforce will be updated with the values from the new Collection – scvNewLineSchedules.


Save the Flow.

Flow 2 – Updating Opportunity Line Item Dates

While the first Flow updates the dates on all the Product Schedule Records.  This flow loops through the Opportunity Line Items related to the Opportunity and calls Flow 1 as a sub-flow.

  1. Looks up the Opportunity and populates a new variable
  2. Finds all the Opportunity Line Item records relating to the Opportunity and assigns them to an sObject Collection variable.
  3. Assigns the first record in the Collection to a sObject Variable and passes that record to…
  4. Flow 1
  5. Assigns the new Date value to the Opportunity Line Item record.
  6. Adds that record to another sObject Collection Variable
  7. All the records get updated using the new Collection’s values.
  8. Sets the custom Field ‘Days Shifted’ back to 0

There are a few similarities between the two flows.  The main differences are Steps 1, 4 and 8.  This time it is looping through Opportunity Line Items and not Product Schedule records.

Variables and Formulas needed for this flow are below, remember we probably has some of these already floating around at a loose end!


1. Lookup Opportunity

Looks up Opportunity that has had its closed date changed.  It uses the value in ‘Days Shifted’ to populate the variable in the Flow.


Steps 2 and 3 are more or less identical to the first flow.

4.       Calling Flow 1

Now we’re going to call Flow 1 but we need to let Salesforce know which variables it’s setting in the target flow and what values to set.

 The output variable is required by the Flow but is not necessary for us.

The output variable is required by the Flow but is not necessary for us.

Follow Flow 1 for Steps 5, 6, and 7.

8.       Resetting the ‘Days Shifted’ to Zero

Simple Record update to reset the value to 0.


Make sure you activate all the Flow and Workflows.  Have Fun.

In the next Blog we will take this a little further....

Visual Flow - What is it and how do I know if I need it?

Salesforce have already given us workflows and process builder but, sometimes they just don’t cut it. 

How often have you started a workflow or a process and realised it just won’t do what you need it to?

Well say Hello to Visual Flow…   Visual Flow lets you automate business processes, collect, update, edit, create and delete Salesforce date/records.  You can even call Apex Classes and all without code!  Oh, and it has a drag and drop interface too. 

We all know how hard it can be to get users to fill in the right data, so what would you say to showing the users pre-defined screens walking them through what they needed to enter, how great would that be?

What if you worked on an IT service desk, it would be really cool if you had a set of screens which talked you through the customer’s issues and suggested fixes etc.

Whilst Visual flow is more of a front-end tool, using a set of screen and actions triggered by the user, although flows can be used for a multitude of processes and can be autolaunched.

So how does it work?

So, let get down to the nitty gritty.

Flow contains a number of components:



Step Element (input screens)
Kind of Placeholders, which can be converted into an input screen, these are the building blocks of the Flow.

Screen Element
Screens can be created using the Screen Element or converted from a Step above.  The screens are a series of windows that are presented to the user who can use the previous or next buttons to move through them. The Screen element allows you to add Fields, Buttons, etc.

Uses logic and data inputs to move the user to the next logical step.

Allows variables to be set to store data for the process as data variables may need to be set or rest during the process

Uses a loop variable to hold the values for the current item, then it loops round to the next item in the variable.

Allows you to add a ‘waiting time’ to a flow before an event is triggered

Data components are used when you need to look for a value or a record or need to create, update or delete a record.

New Apex Code can be created specifically for your flow or you can call existing Apex code.

You can call existing flows within more complex flows and flows can be used more than once.

Controls how the flow is executed.



Used to store updateable values

Collection Variable
Can store multiple updated values of the same data type

sObject Variable
Updateable field values for a specific Salesforce Record

sObject Collection Variable
As above but for multiple Salesforce Records.

Progress through the Flow in the logic or the UI such as some kind of indicator.

Fixed value to use throughout the flow.

Store numeric formulas.

Text Template
Store Text for the flow.

Standalone choice option.

Dynamic Record Choice
Collects data from an object’s records and generates a set of choices when run.

Picklist Choice
Generates a set of choices form the values of s Picklist or Multi-select picklist.

The great thing with Resources is that they can be created on the fly, no more having to cancel out, create the variable and restart the process!

Got it, but it seems complicated so can you show me an example?

It is complex and, when you first start with Flow, it requires patience, lots of coffee or alcohol (or whatever floats your boat) and time.  Don’t get disheartened if it doesn’t work first time, perseverance is the key!

Right an example hmm …. OK have a look at my next Blog ‘Crafty things with Visual Flows, Process Builder and a bit of Magic‘.

Let's Talk Product Schedules

Product Schedules are used when you need to manage recurring revenue and delivery over time.

There are different types of Schedules:

Quantity Schedule – used if a Customer pays up front but has staggered deliveries;

  • Revenue Schedule – used if the Product is delivered as a whole but, payment is in instalments;
  • Quantity and Revenue Schedules – used if customers require both a delivery and quantity schedule, i.e. a monthly product paid monthly;
  • Default Schedule – used if all products and deliveries are made on the same schedule such as Service Contracts.  Not useful for Products that require customised schedules.

OK, I get that, but do I need them?

Well you tell me?

What do your revenue forecasts look like?  Accurate?  Stab in the dark? Finger in the air?

If they are accurate then great, you don’t need to read any further.  If it’s mostly guess work, slightly unreliable and requires data manipulation outside of Salesforce, then Product scheduling may be just what you need!

Product Schedules can help with the following:

  • Visibility of committed and forecast revenue streams;
  • Removes the headache of managing customer payments. Easier to see the full revenue of Opportunities;
  • Easier to manage cash flow and plan;
  • No more spreadsheets!

Take a look at this scenario..

Toot Printers are global manufacturers and suppliers of printers and associated goods.  When they win an opportunity, they have to ensure that any ‘swap out’ programme of the printers is considered when they set up their invoice and delivery plans.  This could happen over a period of 2-3 years and the revenue from that sale will be recognised over that period too.  So, Toot Printers would really benefit from Product Schedules as it will allow accurate forecasting of revenue recognition.

They also supply Maintenance Contracts which again run over the life of the printer.  Product Schedules can be set up for monthly, quarterly or yearly payments for these contracts, ensuring that the revenue for these can be tracked, managed and recognised during the right FQ.

OK I’m sold, so how do I set them up?

Right, well make sure you’re in Salesforce Classic (not available in Lightning yet) and go to Setup – Product Settings,


select the Schedules you need and select Save


To add a Default schedule to a Product, go to the Product from the Products Tab and select Edit.

Decide whether you want a Quantity or Revenue Schedule or both and complete the relevant fields and select Save.

When you now add any Product with a Default Schedule to an Opportunity, the Default Schedule will be picked up and calculated.

You’ll need to repeat this for each Product that needs a Default Schedule.


Brilliant!!  I hear you say, so how does this work with Opportunities if I want a Custom Schedule?

OK, so you go to an Opportunity and add the Product to it and select Save.

Select the Product Name from the Opportunity Product Related List and you will see a new Section called Schedule, select Establish.

Choose the type of Schedule you want and then complete the options for that Schedule and select Save.


Salesforce will calculate Quantity and Revenue dependant on what value you set up the Opportunity Product with, select Save.


If you need to change the Schedule, you can go into the Opportunity Line Item and select Edit.


Make the changes you need and select Save.

If you have to change any of the indivual Schedules then you can use the Edit Button.

The Re-establish Button allows you to reset the whole Schedule.

GDPR and Salesforce – what you need to know...

In May 2018 a new Data Protection Law (GDPR) comes into force.  Replacing the current data protection laws with a single set of rules which are enforceable in each EU member state.

GDPR regulates any processing of data relating to an EU individual.  This includes:

  • Collections
  • Storage
  • Transfer
  • Use

If your Organisation handles any personal data of individuals belonging to the EU then this applies to you.

So what’s changed?

The new laws place more obligations on Organisations and give more privacy rights to individuals.  As an Organisation you are required to:

  • Implement required policies and security procedures
  • Ensure detailed records are kept on data activities
  • Carry out an assessment of privacy impact
  • Provide written agreements with 3rd party vendors
  • Reporting of data breaches to data protection authorities and the individual concerned under certain circumstances
  • New obligations for organisations who use profiling or monitoring of EU individuals
  • Binding Corporate Rules (BCR’s) govern the legal transfer of personal data outside the EU

Large fines can be issues by authorities if a serious data breach occurs.

Salesforce and GDPR

Below are the three mechanisms that Salesforce use for personal data transfers across borders.

Binding Corporate Rules

BCR’s – European data protection Authority policies which govern the legal transfer of personal data outside the EU.

The EU-US Privacy Shield and Swiss-US Privacy Shield

Frameworks which provide a mechanism for companies to comply with European data protection requirements when transferring data from EU to US.

Standard contractual clauses

Known as ‘Model Clauses’, legal contracts for transferring data from EU to countries outside of EEA to protect personal data.

What do I need to do to get Compliant?

To start, the need for GDPR compliance has to be owned by senior management. 

They need to be made aware how important the compliance with GDPR is. Without this buy in and the appreciation from the top of the risks, challenges and pitfalls, this job will be difficult.

Next step will be to set up a dedicated team with an overall data protection officer.  It’s good to have at least one person from each department.  Staff from IT Security, procurement, legal HR, product management and marketing are a must have.

Now you need to look at what you currently have in place regarding privacy and security and identify the areas to focus on.  One of the biggest areas is where does your company store personal data?

This data can come from various sources such as employees, job applicants, web forms, customer purchases, loyalty or warranty cards, event attendees etc.  When you start investigating this you will probably find there are multiple places and departments where this data is stored.

From your investigations you will be able to create a data processing register which will help you identify which processes pose a high risk to data privacy.

For each of these high-risk processes you need to carry out an assessment against the GDPR guidelines and collate any actions that need to be taken to ensure compliance.

Now you have a handle on the risks, you can plan what needs to happen to ensure your Company is compliant.

Things you need to consider are:

  1. Privacy Notices – needed wherever personal data is collected, including cookies and tags;
  2. Security – needed to stop unauthorised access to personal data including editing, deleting or disclosing;
  3. Data subject rights – management of consent preferences, complaints, access, restriction, portability and the right to be forgotten;
  4. Management of Vendors – contracts are required for vendors, affiliates and 3rd parties that handle personal data including data transfers;
  5. Response to Incidents – Detection and investigation of breaches and notification of such breaches to the relevant parties;
  6. Training – Employees and vendors must be aware of their responsibilities;
  7. Assessments – Data protection impact assessments – needed for each high-risk data activity.

Does Salesforce have anything to help me?

Funny you should ask that….  

Let me introduce Salesforce Shield.

Shield is a set of security services which integrate natively with Salesforce (at an additional cost).

You may not need Shield to comply with GDPR but it can help with the journey to compliance.  Shield provides transparency over how company data is being interacted with and provides encryption at rest without affecting any functionality.  It is an enhancement on the out of the box encryption features.

You can encrypt, fields, files, attachments, chatter data.  It sits on top of field level security and object level security.

Shield has three main features:

Platform Encryption

Allows encryption of data at rest without loss of functionality, as it’s built natively on the Salesforce Platform it is easy to set up.

The ability to be able to encrypt at rest assists with GDPR compliance by de-identifying sensitive personal data which is related to a person’s race, sexual orientation etc.

Event Monitoring

Gives visibility into what data users are accessing, which IP addresses they are using and any actions happening with that data.  Accessed via the API into a csv file.

Field Audit Tail

Bit of a Time Machine as it allows you to see the value and state of data historically.  Gives 10 years of audit data and up to 60 fields per object.

Spring 18 brings a couple of new data protection features to the table.

The 'Individual' Object

This new object will store individual’s data preferences on how they want their data used, shared and stored.  A master-detail relationship connects the new object to the Lead or Contact. 

Easy to setup can be found under ‘Data Protection and Privacy’ in Setup, select Edit and check the ‘make data protection details available in records’ box, you’re nearly good to go.


Now add the ‘Individual’ field to the Lead and/or Contact Page layouts and link a Contact or Lead to their ‘Individual’ Record using a Lookup search.


The out of the box fields are basic but enough to start with:



You can add your own fields and formulas and use the individual object to filter data in reports.   For Marketing reporting, campaign segmentation allows exclusion of individuals who have opted out of receiving any communications and don’t want to be profiled. 

If you use Data.com Prospector or Clean you will see that data relating to UK and Ireland Contacts is removed from the Connect database and, the Clean Status field will display ‘Not Found’.

Salesforce - Historical Data Reporting

Have you ever wanted to go back in time and see what your pipeline was like this time last month or even 6 months ago?

Whilst there are some great 'out of the box' Salesforce Reports and Dashboards, what do you do if you want to deliver trend and point in time comparative analysis reports?

Salesforce have a couple of ways of handling this; a tucked away function called Reporting Snapshots, which allow you to capture 'snapshots' in time of data and store those results and, Historical Trend Reports.

Say you want to see how your pipeline is changing over a month.

So. at the start of the month you want to know what stage each deal is at, what the close date is, who owns the deal, the amount the deal is worth, last modified date and what the probability of winning.

Mid month you want to review how it has changed from the beginning of the month and, at the end of the month you want a final review with the sales team.

So how do we do this? Reporting Snapshots is the function needed for this.

Reporting Snapshots consist of 3 components:

  • A source Report (tabular or summary);
  • A Custom Object with fields matching the columns in the Report;
  • A Reporting Snapshot which maps the field values and schedules when the Snapshot runs.

Lets look at how we set this up.

We need to create a Tabular or Summary Report based on Opportunities and include the following fields:

  • Opportunity Name
  • Owner
  • Stage
  • Probability
  • Amount
  • Last Modified

Create a Custom Object via Setup>Create>Objects called Quotes Snapshot beg Month
Create the fields to match the fields added to the report above and enable Reports and Save.

In Setup search for Reporting Snapshot, select New Reporting Snapshot and name it Quotes Snapshot.
Select a System Administrator as the Running User
Select the Source Report you created and the new Custom Object


Select Save & Edit Field Mapping
Map the fields in the Snapshot to the fields in the Object you created and Select Save


Select Edit on the Schedule Reporting Snapshot.


Select the Frequency (which for this one would be Monthly on the 1st day of the month) and select a Start and End Date. Find an available time to run the Snapshot, decide who the Report should go to and select Save.


You will need to create two additional Reporting Snapshots for Mid Month and the End of the Month.

Once the snapshots run, the data will populate in the reports and in the Snapshot object.

Historical Trend Reporting

Salesforce stores historical data for the current month and the 3 previous months. It allow you to choose up to five date snapshots and four historical filters within that span for comparison.

The data from these reports can be used in charts and Dashboards.

A good use for a Historical Trend report is tracking changes in your pipeline. How many times have you wanted to know how robust your pipeline is to meet your future sales goals?

Now you can. Lets get started.

First you need to activate the feature. Go to Setup and search for Historical Trending.
Select the Object you want to report on, for the Pipeline we need Opportunities.
Select the fields you require and ensure you select Enable Historical Trending, then select Save.


Go to Reports and create a new Opportunities with Historical Trending Report. Change the type to a Matrix Format.

Arrange the fields as you need them. In the Historical Date you can add in up to 5 date filters

date fields.JPG

Once you're happy with the Report, save and run it. You now have a report which shows how the Revenue of each Opportunity has changed over a 4 week period. This could also be used to show changed in Stages over a period of time.


Why Should You Move to Lightning?

Whilst the Salesforce Classic user interface isn’t in danger of disappearing in the near future we still advise our customers the benefits of moving to Lightning.

For some Companies staying with Classic may be the only approach available when you’re restricted to using Microsoft Internet Explorer.

A lot of companies don’t have the time and resources to make the move and whilst Classic isn’t broken why fix it?

Salesforce first released a version of Lightning in 2015.  Over the next couple of years with each new release of Salesforce (Spring, Summer, Winter) they have upped the Lightning game!  It’s not just a funky new UI, under the bonnet there has been significant improvements as well allowing customers to create attractive applications.  But beware, not all the functionality in Classic is available in Lightning yet, each release adds more.

Lightning is driven more by events than Classic, examples of this are the Sales Path and Kanban views.


A visualisation feature of the Stages an Opportunity goes through is the Sales Path.  This is great for Sales Reps, they can quickly see what needs to be done to move the deal along quickly.

The Kanban view shows up to four key Opportunity fields.  Records can be moved to the next stage by dragging them across the board.  The Pipeline automatically updates as Opportunities are moved around.  Tasks and events can be added directly from the board.


So what else is better in Lightning?

Home Page

In Classic the Home page is a bit dull and not very customisable.  In Lightning Salesforce have given us the ability to create customised Home Pages and assign them to different profiles.

In this example the Sales Rep’s home page shows the Reps closed opportunities against his quota.


Record Pages

Lightning Pages are much more compact, components are dragged and dropped onto the pages, no code needed! 

Salesforce have provided some default page layouts but also a Lightning App builder to allow us to design our own record pages using drag and drop.  Gone are the limitations of Classic!


More flexible, modern reports and dashboards

The three-column limit on Dashboards are no longer!  Now you can add up to 20 dashboard components in up to 9 columns.  The column width is decided by you and they don’t have to be uniform.


Remember when you had to redesign a whole report to add a filter?  Now you can add them on the fly, no redesign needed!


One Interface across all Platforms

Whether you’re working on your phone, laptop, desktop, watch or tablet, the interface is the same.


Spring ’18 Lightning Enhancements

Console Apps

Lightning Console functionality is much the same as Classic but has the Lightning styling.  You can change the app’s colour and branding, choose which items show and customise the Utility Bar.


Sales Cloud Einstein

Einstein is Salesforce’s Artificial Intelligence (AI), it learns from the sales activity of the Sales Users and the data and provides them with predictions, recommendations and automations to help them in their role.

Users of Einstein can get predictions on when deals are likely to be won, insights into customer relationships and prioritises leads with Predictive Lead Scoring.


So, should you move to Lightning?

We have just touched the surface here on what Lightning can do.  The decision to move to Lightning is an individual business one.

There are lots of factors to consider:

  • Do you have the resources?
  • Do you have the time?
  • Do we really need to?

Whilst these are all valid business reasons, with each new Salesforce release more Lightning ready functionality is being released which you could be taking advantage of.

Whilst Sales Cloud is ahead of Service for supported features you could do a phased rollout, Sales then Service.

A feature comparison chart can be found here.

Salesforce Spring 18 - New Features to get you hooked!

Custom Themes

Finally, we can say goodbye to bland Orgs! Salesforce have given us access to a set of custom brand images and colours


There are several Themes set up to start you off, which you can View, Preview and Activate.


You can only have one Theme active at any one time.

Salesforce Surveys

How we have all yearned for something to allow us to gain easy feedback from our Customers.
Introducing Salesforce Surveys, a seamless Survey module where all survey data is stored in your Salesforce Org. You can create easy to use forms, reports and dashboards. Available in both Classic and Lightning

The functionality is included with Health Cloud, there is an additional cost otherwise.


Linkedin Lead Integration

You can now automatically add Leads from Linkedin Lead Generation adverts. If a customer fills their info out on your Linkedin Ad the info can be directly sent to you as a Lead.

There are a few steps to follow to set this up which can be found here, but once this is done, the Leads will start coming in!

Opportunity Splits

You can now share the credit for a deal between Team Members. The revenue of the Opportunity can be split by % which can be rolled up into Quotas and Pipeline Reporting.


GDPR - Data Privacy Preferences

Salesforce have embraced the changes happening with GDPR and made changes to assist your compliance processes.
In Spring 18 a new object called 'Individual' holds fields which store data privacy preferences in data privacy records. The 'Individual' records are associated with Leads and Contacts. New custom fields can be added as required.

You can track and store individual customer preferences for:

  • Collecting, storing and sharing of their personal data
  • Packaging their personal data so they can take ownership of it
  • Deleting records and personal data related to them
  • Solicitation of products and services
  • Tracking their geolocation and web activity

Community Calendars

You no longer need a 3rd party app to use Calendars in Communities, You can now view your own and other Salesforce Calendars from the Community. You can even create events from the Community Calendar and see them in Salesforce.

Add Products Screen

If your Company has Products that have long names and descriptions then the new Add Product Interface which allows more option for viewing blocks of text like, Product Names and Descriptions is just for you.

You can widen the columns by dragging them(1), hovering over the name allows you to view the whole Product Name (2), you c an also wrap or clip text in columns (3)


Lightning Dashboard Enhancements

  • Tables with up to 10 columns can now to added to a Dashboard
  • Add conditional highlighting
  • Show Totals and % in centre of Donut charts
  • Table Columns can be reordered
  • Use component-specific Themes
  • View Report link now contains the name of the report as well i.e. View Report (Opportunity Pipeline)
  • Download chart images and png files

☏ 01494 590428 | ✉ hello@commerceworks.net