Date post: | 08-Jan-2017 |
Category: |
Technology |
Upload: | shankar-sharma |
View: | 207 times |
Download: | 0 times |
Lightning Process Builder &
Apex FlexQueue
Ahmedabad - June 20th, 2016
Agenda• Process Builder
• Demo of Process Builder
• Invocable Methods Demo & Best Practices
• Apex FlexQueue
• Questions
Process BuilderWhat is it and how does it help
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
What is Process Builder?Next Generation Workflow New Actions
Workflow Rules
Multiple “Rules” in 1 processMore FlexibilityGraphical Interface
Process without Programming
• Built for all Admins - from beginners to advanced
• Easy edit lets users respond quickly to business changes
• Creates a shared canvas for IT and the Business to collaborate
Needs updated screenshot
Add powerful actions with a single click
Process Builder Demo
Process Builder Use Case• Create related Child Records
– “Create a Contact when an Opportunity is Closed”• Update records
– “Keep Contacts address in sync from Account”• Post to Chatter
– “Update Opportunity won on Chatter”
Invocable MethodsIntroduction & 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 MethodsDemo
Invocable Methods Best Practices
Invocable Methods Best Practices *• Single Invocable method per apex class.• Not available via Triggers• Must be static & public/global• Parameter/ReturnType with data-type :
Primitive data type or a list of primitive data type List of sObject type – generic sObject not supported. List of user-defined type
• Once added in package, can’t remove from later versions.• Make use of label, description and required annotation
attributes to make your methods more accessible to end users of Process Builder
Process Builder Hot Topics• What are the limitations on deleting a process ?• How Can I move processes from one org to another ?• Formula Limitations ?• How do I know which automation tool to use ?• Can I create Task with Process Builder ?
Resources• Community Blogs featuring Process Builder and Incovable Methods
– Lightning Process Builder and Invocable Methodshttp://bobbuzzard.blogspot.co.uk/2015/02/lightning-process-builder-and-invocable.html
– Extending Lightning Process Builder and Visual Workflow with Apexhttp://andyinthecloud.com/2015/03/01/extending-lightning-process-builder-and-visual-workflow-with-apex/
– The Revolution !! Invocable Power - Spring 15http://andyinthecloud.com/category/process-builder/
– Controlling Internet Devices via Lightning Process Builderhttp://andyinthecloud.com/2015/01/31/controlling-internet-devices-via-lightning-process-builder/
– Process Builder Workflow Automation Grouphttps://success.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F9300000001rzc
• General Gotchas
– Process Builder Bulkification issue with field expressionshttp://www.tquila.com/blog/2015/03/09/bulkify-lightning-process-builder
– Salesforce Process Builder Known Issueshttps://success.salesforce.com/issues_index?tag=Process%20Builder
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
Apex FlexQueue
Before :\
Which Options Do We have ?
@future
@Batch Jobs
Schedule Jobs
Limitations of Asynchronous Process
Waits for salesforce resources
No Job Id
Only Return Void
Parameters must be primitive
@futureCan’t order jobs
Only 5 active jobs
Batch
And Now :
Flex Queue
Flex Queue Add-On
More than 5 apex jobs in Apex Jobs Table
5 Jobs Processing + 95 Jobs holding
New UI to monitor & manage Jobs
Reorder the holding apex Jobs
Apex FlexQueueDemo
Thank you