Skip to content

Instantly share code, notes, and snippets.

View thebrettbarlow's full-sized avatar

Brett Barlow thebrettbarlow

View GitHub Profile
@thebrettbarlow
thebrettbarlow / Flow From Visualforce.html
Last active May 15, 2017 05:02
Sample code to launch a flow from Visualforce
<apex:page standardController="ObjectName">
<flow:interview name="FlowName"
finishLocation="/{!ObjectName.Id}">
<!-- This is an example apex:param that would pass the a value from this record to the Flow -->
<apex:param name="varName" value="{!ObjectName.FieldName}"/>
</flow:interview>
<apex:page standardController="Contact">
<!-- When the flow finishes, the user will end up back on this Contact's page. This is determined by the finishLocation -->
<flow:interview name="Contact_Update"
finishLocation="/{!Contact.Id}">
<!-- The first apex:param is setting the v_ContactId variable in my flow to the id of the Contact -->
<!-- You can set as many of these as you want simply by listing them out list this -->
<apex:param name="v_ContactId" value="{!Contact.Id}"/>
<apex:param name="v_ContactFirstName" value="{!Contact.FirstName}"/>
/**
* Created by brettbarlow on 2/24/18.
*/
// LightningComponentInVisualforce
window._lightningComponentInVisualforce = (function() {
return {
LightningComponent : function(type, attributes, locator) {
this.type = type;
this.attributes = attributes;
<apex:page standardController="ObjectName">
<flow:interview name="FlowName"
finishLocation="/{!ObjectName.Id}">
<!-- This is an example apex:param that would
pass a value from this record to the Flow -->
<apex:param name="varName" value="{!ObjectName.FieldName}"/>
</flow:interview>
<apex:page standardController="Contact">
<!-- When the flow finishes, the user will end up back on
this Contact's page. This is determined by the finishLocation -->
<flow:interview name="Contact_Update"
finishLocation="/{!Contact.Id}">
<!-- The first apex:param is setting the v_ContactId variable
in my flow to the id of the Contact -->
<apex:page standardController="Brewery__c">
<flow:interview name="Refresh_Beer_Inventory"
finishLocation="/{!Brewery__c.Id}">
<!-- Brewery Id to be used by the flow -->
<apex:param name="v_BreweryId"
value="{!Brewery__c.Id}"/>
<!-- Beer Inventory Data to be used by the flow -->
SELECT Id, Name
FROM Account
WHERE Name = 'Brett's Awesome Company'
SELECT Id, Name
FROM Account
WHERE Name = 'Brett\'s Awesome Company'
SELECT Id, FirstName, LastName, Email, Phone
FROM Contact
WHERE NOT FirstName LIKE 'B%'
SELECT Id, FirstName, LastName, Email, Phone
FROM Contact
WHERE NOT (
FirstName LIKE 'B%' OR
FirstName LIKE 'C%'
)