Go Faster with
Lightning Process Builder
London May 21st, 2015
Andrew Fawcett
Force.com MVP
CTO, FinancialForce.com
@andyinthecloud
Simon Goodyear
Force.com MVP
CTO, Beaufort 12
@simongoodyear
Speakers
About FinancialForce
• Native on the Salesforce1 platform
• FFA (Accounting)
• HCM (Human Resources)
• PSA (Projects Management)
• SCM (Manufacturing)
• HQ San Francisco; Development teams in US,
UK and Spain (550 employees)
• www.financialforce.com
Agenda
• What is Process Builder and why will it make me faster?
• Adding new Process Builder Actions with Apex
• Demo of Process Builder and Invocable Methods
• Invocable Methods Best Practices
• Questions
Process Builder
What is it and how does it help
me go faster?
What is Process Builder?
• Introduced as part of the Lightning Framework
“a point and click tool for automating business
processes” sits under Workflow & Approvals
– Similar to Workflow…
• Processes driven by users manipulation of Records
• Workflow Actions Email Alerts, Approval, Field Updates
– But much more…
• Actions can be Immediate or Scheduled
• New Actions, Manage Child Records, Post to Chatter,
Call Flow, Call Apex
– Plus a great new Visual UI!
Process Builder Use Case
Go faster by coding less and building more with clicks not code!
• Create related Child Records
– “Create a Contact when an Opportunity is Closed”
• Update related Child Records
– “Close all cases when an Account is set to inactive”
• Automatically start Approval Process
– “Approve a Sales Invoice once status is Ready for Approval”
Check out a great blog from Paddy Butler, TQuila
“Salesforce Process Builder - Automate processes in Salesforce like never before”
http://www.tquila.com/blog/2014/11/12/salesforce-process-builder-automate-processes-salesforce-never
Process Builder Use Case - Demo
Use Case: Reset discount to all Opportunity Products in one operation
Process Builder Use Case - Demo
Use Case: Reset discount to all Opportunity Products in one operation
Process Builder Use Case - Demo
Use Case: Reset discount to all Opportunity Products in one operation
Invocable Methods
Introduction & Code Examples
What are Invocable Methods?
• When standard Process Builder Actions are just not enough, do I
have to stop using Process Builder?
• A means to extend Process Builder with Apex! *
– Have developers think about exposing ‘actions’
– Consider packaging actions for greater reuse
* It is also possible to extend the Salesforce Visual Flow tool in the same way.
Invocable Methods can also be called Salesforce REST API, e.g. mobile clients
Invocable Method Example A
NOTE: None void return types from
Invocable Methods are supported,
but are not of interest to Process
Builder.
Invocable Method Example B
NOTE: Note use of label and required variables enhance the
Process Builder UI for the end user
Invocable Methods
Demo: Automating Setup
Invocable Method Demo: Automating Setup
• Using Process Builder to implement sudo Universal Picklists! *
* Upvote the real Univeral Picklist Idea here!
https://success.salesforce.com/ideaview?id=08730000000BrfBAAS
Invocable Method Demo: Automating Setup
• Using an Invocable Method to expose the Salesforce Metadata API
Download Source code here, also requires Apex Metadata API deployed
https://gist.github.com/afawcett/78b8d238311b3df06e2c
Invocable Method Demo: Automating Setup
• Defining the Picklist Process via Process Builder
IMPLEMENTATION IDEA: This Invocable Method could be enhanced to take
a list of Custom Fields and avoid having to have multiple Actions in Process Builder?
Invocable Methods
Demo: Send SMS Message
Invocable Method Demo: Send SMS Message
Invocable Method Demo: Send SMS Message
Invocable Method Demo: Send SMS Message
Invocable Methods
Best Practices
Invocable Methods Best Practices *
• Platform enforces valid method signatures on Save…
– Bulkification on method signatures
• Make sure you code is fully bulkified including associated Apex classes
– Read in detail the Developer Guide topic “Invocable Method Considerations”
* These also apply when consuming Invocable Methods from Salesforce Visual
Flow and Salesforce REST API
Invocable Methods Best Practices *
• Security
• Use with sharing on the class and
only elevate to without sharing as needed, treat as controller class
• Considering check CRUD and FLS, this is an major entry point
• Design Considerations
– Design for your admins not developers this is not a typical API!
– Apex class, parameter and member names matter, naming convention!
– Make use of label, description and required annotation
attributes to make your methods more accessible to end users of Process Builder
– See my blog ‘Extending Lightning Process Builder and Visual Workflow with Apex’
* These also apply when consuming Invocable Methods from Salesforce Visual
Flow and Salesforce REST API
Recap
• Go Faster with Process Builder!
– Reduce Implementation Time
• Many use cases previously only possible with Apex Triggers now possible
with clicks not code via Process Builder
– Developers and Admins Working Closer Together to automate more!
• Think about ways to extend Process Builder via Invocable Actions
– Opportunities to create Libraries of Invocable Methods to share
• Invocable Methods can be packaged
Resources
• developer.salesforce.com
• Community Blogs featuring Process Builder and Incovable Methods
– Lightning Process Builder and Invocable Methods
http://bobbuzzard.blogspot.co.uk/2015/02/lightning-process-builder-and-invocable.html
– Extending Lightning Process Builder and Visual Workflow with Apex
http://andyinthecloud.com/2015/03/01/extending-lightning-process-builder-and-visual-workflow-with-apex/
– The Revolution !! Invocable Power - Spring 15
http://codeandvogue.com/2015/02/02/el-poder-de-invocable-spring-15/
– Controlling Internet Devices via Lightning Process Builder
http://andyinthecloud.com/2015/01/31/controlling-internet-devices-via-lightning-process-builder/
• General Gotchas
– Process Builder Bulkification issue with field expressions
http://www.tquila.com/blog/2015/03/09/bulkify-lightning-process-builder
– Salesforce Process Builder Known Issues
https://success.salesforce.com/issues_index?tag=Process%20Builder
Andrew Fawcett
CTO, FinancialForce.com
@andyinthecloud
Simon Goodyear
CTO, Beaufort 12
@simongoodyear
Speakers
Thank you

Go Faster with Process Builder

  • 1.
    Go Faster with LightningProcess Builder London May 21st, 2015
  • 2.
    Andrew Fawcett Force.com MVP CTO,FinancialForce.com @andyinthecloud Simon Goodyear Force.com MVP CTO, Beaufort 12 @simongoodyear Speakers
  • 3.
    About FinancialForce • Nativeon the Salesforce1 platform • FFA (Accounting) • HCM (Human Resources) • PSA (Projects Management) • SCM (Manufacturing) • HQ San Francisco; Development teams in US, UK and Spain (550 employees) • www.financialforce.com
  • 4.
    Agenda • What isProcess Builder and why will it make me faster? • Adding new Process Builder Actions with Apex • Demo of Process Builder and Invocable Methods • Invocable Methods Best Practices • Questions
  • 5.
    Process Builder What isit and how does it help me go faster?
  • 6.
    What is ProcessBuilder? • Introduced as part of the Lightning Framework “a point and click tool for automating business processes” sits under Workflow & Approvals – Similar to Workflow… • Processes driven by users manipulation of Records • Workflow Actions Email Alerts, Approval, Field Updates – But much more… • Actions can be Immediate or Scheduled • New Actions, Manage Child Records, Post to Chatter, Call Flow, Call Apex – Plus a great new Visual UI!
  • 7.
    Process Builder UseCase Go faster by coding less and building more with clicks not code! • Create related Child Records – “Create a Contact when an Opportunity is Closed” • Update related Child Records – “Close all cases when an Account is set to inactive” • Automatically start Approval Process – “Approve a Sales Invoice once status is Ready for Approval” Check out a great blog from Paddy Butler, TQuila “Salesforce Process Builder - Automate processes in Salesforce like never before” http://www.tquila.com/blog/2014/11/12/salesforce-process-builder-automate-processes-salesforce-never
  • 8.
    Process Builder UseCase - Demo Use Case: Reset discount to all Opportunity Products in one operation
  • 9.
    Process Builder UseCase - Demo Use Case: Reset discount to all Opportunity Products in one operation
  • 10.
    Process Builder UseCase - Demo Use Case: Reset discount to all Opportunity Products in one operation
  • 11.
  • 12.
    What are InvocableMethods? • When standard Process Builder Actions are just not enough, do I have to stop using Process Builder? • A means to extend Process Builder with Apex! * – Have developers think about exposing ‘actions’ – Consider packaging actions for greater reuse * It is also possible to extend the Salesforce Visual Flow tool in the same way. Invocable Methods can also be called Salesforce REST API, e.g. mobile clients
  • 13.
    Invocable Method ExampleA NOTE: None void return types from Invocable Methods are supported, but are not of interest to Process Builder.
  • 14.
    Invocable Method ExampleB NOTE: Note use of label and required variables enhance the Process Builder UI for the end user
  • 15.
  • 16.
    Invocable Method Demo:Automating Setup • Using Process Builder to implement sudo Universal Picklists! * * Upvote the real Univeral Picklist Idea here! https://success.salesforce.com/ideaview?id=08730000000BrfBAAS
  • 17.
    Invocable Method Demo:Automating Setup • Using an Invocable Method to expose the Salesforce Metadata API Download Source code here, also requires Apex Metadata API deployed https://gist.github.com/afawcett/78b8d238311b3df06e2c
  • 18.
    Invocable Method Demo:Automating Setup • Defining the Picklist Process via Process Builder IMPLEMENTATION IDEA: This Invocable Method could be enhanced to take a list of Custom Fields and avoid having to have multiple Actions in Process Builder?
  • 19.
  • 20.
    Invocable Method Demo:Send SMS Message
  • 21.
    Invocable Method Demo:Send SMS Message
  • 22.
    Invocable Method Demo:Send SMS Message
  • 23.
  • 24.
    Invocable Methods BestPractices * • Platform enforces valid method signatures on Save… – Bulkification on method signatures • Make sure you code is fully bulkified including associated Apex classes – Read in detail the Developer Guide topic “Invocable Method Considerations” * These also apply when consuming Invocable Methods from Salesforce Visual Flow and Salesforce REST API
  • 25.
    Invocable Methods BestPractices * • Security • Use with sharing on the class and only elevate to without sharing as needed, treat as controller class • Considering check CRUD and FLS, this is an major entry point • Design Considerations – Design for your admins not developers this is not a typical API! – Apex class, parameter and member names matter, naming convention! – Make use of label, description and required annotation attributes to make your methods more accessible to end users of Process Builder – See my blog ‘Extending Lightning Process Builder and Visual Workflow with Apex’ * These also apply when consuming Invocable Methods from Salesforce Visual Flow and Salesforce REST API
  • 26.
    Recap • Go Fasterwith Process Builder! – Reduce Implementation Time • Many use cases previously only possible with Apex Triggers now possible with clicks not code via Process Builder – Developers and Admins Working Closer Together to automate more! • Think about ways to extend Process Builder via Invocable Actions – Opportunities to create Libraries of Invocable Methods to share • Invocable Methods can be packaged
  • 27.
    Resources • developer.salesforce.com • CommunityBlogs featuring Process Builder and Incovable Methods – Lightning Process Builder and Invocable Methods http://bobbuzzard.blogspot.co.uk/2015/02/lightning-process-builder-and-invocable.html – Extending Lightning Process Builder and Visual Workflow with Apex http://andyinthecloud.com/2015/03/01/extending-lightning-process-builder-and-visual-workflow-with-apex/ – The Revolution !! Invocable Power - Spring 15 http://codeandvogue.com/2015/02/02/el-poder-de-invocable-spring-15/ – Controlling Internet Devices via Lightning Process Builder http://andyinthecloud.com/2015/01/31/controlling-internet-devices-via-lightning-process-builder/ • General Gotchas – Process Builder Bulkification issue with field expressions http://www.tquila.com/blog/2015/03/09/bulkify-lightning-process-builder – Salesforce Process Builder Known Issues https://success.salesforce.com/issues_index?tag=Process%20Builder
  • 28.
    Andrew Fawcett CTO, FinancialForce.com @andyinthecloud SimonGoodyear CTO, Beaufort 12 @simongoodyear Speakers
  • 29.

Editor's Notes