Transitioning Spring '18 Local Actions to Summer '18
This Pilot Update is for Salesforce customers participating in the Spring '18 pilot for Flow Local Actions.
Local Actions that run on Spring '18 orgs are not compatible with Summer '18. Summer '18 versions of the sample actions made available as part of the pilot are available at lightningflow.net and will need to be installed when your org running Local Actions is upgraded to Summer '18.
You may need to remove the old Local Action from any flows in which you've installed it. (If you are getting an error message “Error parsing file: 'localAction' is not a valid value for the enum 'InvocableActionType'” then you have a flow that still has a saved reference to the old version. See “InvocableActionType Change”, below.
For Developers of Local Actions
If you have created Local Actions using the Spring '18 pilot, you will want to be aware of the following:
Existing Local Actions require the following changes to work with Summer '18:
- The marker interface has changed from “
flowruntime:availableForLocalInvocableActions
” to “lightning:availableForFlowActions
”. This change is made in the “cmp” file of your lightning component file set. - The “callback” mechanism has been removed. Both of these lines, which will exist in Spring '18 local actions, must be removed to work on Summer '18. If you wish to pass success vs. failure information at the end of your local action, you can do it one of two ways:
- create a variable and set its value, and then have the flow subsequently decision on that value
- use the recommended async approach, involving Promises (see the release notes and developer guide documentation, available soon).
Other transition notes:
- We encourage builders of Local Actions to use promises. An example of that is available in the release notes for Summer '18. An example of the recommended form is shown below.
- InvocableActionType Change. If you have created flows that use local actions, InvocableAction enum in the Metadata API, the enum value for a local action has changed from "localAction" to "component". One place this manifests if if you have extracted metadata for a flow that had a local action. The file will have a section that looks like this:
- <actionCalls>
- <name>Success</name>
- <label>Success</label>
- <locationX>595</locationX>
- <locationY>431</locationY>
- <actionName>c:showToast</actionName>
- <actionType>localAction</actionType>
In cases like this change “localAction” to “component” to avoid the error message:
Error parsing file: 'localAction' is not a valid value for the enum 'InvocableActionType'
Recommended Form for Invoke Methods as of Summer '18
invoke : function(component, event, helper) {
var args = event.getParam("arguments");
return new Promise(function(resolve, reject) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = $A.getCallback(function() {
if (this.readyState === 4) { // DONE
if (this.status >= 200 && this.status < 300) {
var response = JSON.parse(xhttp.responseText);
component.set("v.churnVal", response);
resolve();
} else {
var errorText = "";
if (this.status === 0) {
errorText = 'Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.';
} else {
errorText = this.statusText;
}
reject(new Error(errorText));
}
}
});
var customerId = component.get("v.customerId");
xhttp.open("GET", "https://upp57qbj5b.execute-api.us-west-1.amazonaws.com/production/customer/"+customerId+"/churn", true);
xhttp.send(null);
});
}