• AliaBurdick
  • NEWBIE
  • 0 Points
  • Member since 2016
  • Product Manager
  • National Funding

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I have a flow called from a VFP that needs to utilize the Upload Files component in the flow. Since this component only works if the flow runs in Lightning Runtime, this has been enabled in our org. It turns out though, that any flow called from a VFP will by default render in Classic, EVEN IF Lightning Runtime is enabled.

I followed the directions in this document (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_flows_lightningruntime.htm) to create a Lightning Component extending Lightning Out with a dependency on lighting:flow. Then I updated the VFP to call this component and launch the flow. 

This did result in the flow seemingly to run in Lightning Runtime vs Classic (at least visually it did). Unfortunately, the upload file component still does not work, even with this solution in place. 

Does anyone have any idea how I can get this file upload component to function to work when called from a VFP in Lightning Runtime? I'm stumped. 

Code as its implemented now is below - I haven't set any of the finish behavior or outputs yet. 
<aura:application access="global" extends="ltng:outApp" >
    <aura:dependency resource="lightning:flow"/>
</aura:application>
<apex:page standardController="Stipulations__c" recordSetVar="stipulations">
   <html>
      <head>
         <apex:includeLightning />
      </head>
      <body class="slds-scope">
         <div id="flowContainer" />
         <script>
             var statusChange = function (event) {
               if(event.getParam("status") === "FINISHED") {
                  // Control what happens when the interview finishes
 
                  var outputVariables = event.getParam("outputVariables");
                  var key;
                  for(key in outputVariables) {
                     if(outputVariables[key].name === "myOutput") {
                        // Do something with an output variable
                     }
                  }
               }
            };            $Lightning.use("c:LightningRuntime", function() {
               // Create the flow component and set the onstatuschange attribute
               $Lightning.createComponent("lightning:flow", {"onstatuschange":statusChange},
                  "flowContainer",
                  function (component) {
                     // Set the input variables
                     var inputVariables = [
                        {
                           name : 'inputOpptyId',
                           type : 'String',
                           value : "{!$CurrentPage.parameters.Id}"
                        }
                     ];
                     
                     // Start an interview in the flowContainer div, and 
                     // initializes the input variables.
                     component.startFlow("Stipulations_Submit_Documentation", inputVariables);
                  }
               );
            });
         </script>
      </body>
   </html>
</apex:page>


 
We have a flow that has been in use for quite some time which is supposed to create a campaign member for the primary contact role when certain criteria on a related opportunity are met. We have a daily upload from an external system that is updating values on the opportunity, which in turn triggers the workflow rule/launches flow (this is a time-delayed workflow action, so the records are still sitting in the time-based workflow queue even though the scheduled date has passed).

Most of the time this works as expected. Today I started receiving a Flow Error email with the following message:
"An error occurred at element CampaignMemberCreateSignor (FlowRecordCreate).
INSERT --- INSERT FAILED --- ERRORS : (ALL_OR_NONE_OPERATION_ROLLED_BACK) Record rolled back because not all records were valid and the request was using AllOrNone header, " This error is coming in every 15 minutes or so and hasn't stopped for 24 hours.

All the records listed in the error email look like they are valid, so I'm not sure how to debug this. The flow itself is fairly simple - it looks up the opportunity that triggered the flow, looks up the primary contact role, looks for a campaign that matches criteria on the opportunity, looks for an existing campaign member, and then creates a campaign member if no matching member is found. Does anyone have any advice on how to investigate this further and prevent it from happening in the first place? Thank you in advance for any advice/help that's out there!

Here is an example of what I'm getting back in the email for each affected record - each one of them follows the flow correctly until it gets to the last step where the Result is "Failed to create record.". 

Flow Details
Flow Name: CreateRenewalCampaignMemberSignor
Type: Autolaunched Flow
Version: 7
Status: Active
Flow Interview Details
Interview Label: CreateRenewalCampaignMemberSignorv1.2b 2/23/2016 7:13 AM
Current User: DB Amp NF (00580000008bsXi)
Start time: 2/23/2016 7:13 AM
Duration: 0 seconds
How the Interview Started
DB Amp NF (00580000008bsXi) started the flow interview.
Some of this flow's variables were set when the interview started.
inputOpportunityId = 0063400000yS1f5
RECORD QUERY: OpportunityLookUp
Find one Opportunity record where:
StageName Equals {!conStageNameIsFunded} (Funded)
Id Equals {!inputOpportunityId} (0063400000yS1f5)
Result
Successfully found record.
{!varAccountId} = 0013400001KNgJZAA1
{!varOpportunityId} = 0063400000yS1f5AAC
{!varIntRenewalNumber} = 100A
RECORD QUERY: CampaignLookUp
Find one Campaign record where:
Int_Renewal_Email_Campaign_Iteration__c Equals {!varIntRenewalNumber} (100A)
Result
Successfully found record.
{!varCampaignId} = 701800000016AwiAAE
RECORD QUERY: OpportunitySignorLookUp
Find one OpportunityContactRole record where:
Role Equals {!ConSignor} (Signor)
OpportunityId Equals {!varOpportunityId} (0063400000yS1f5AAC)
Result
Successfully found record.
{!varSignorId} = 0033400001oEp3pAAC
RECORD QUERY: CampaignMemberLookup
Find one CampaignMember record where:
CampaignId Equals {!varCampaignId} (701800000016AwiAAE)
ContactId Equals {!varSignorId} (0033400001oEp3pAAC)
Result
Failed to find record.
DECISION: SignorNotInCampaign
Executed this outcome: Signor_Not_In_Campaign
Outcome conditions: and
1. {!varCampaignMemberId} (null) Is null true
Logic: All conditions must be true (AND)
RECORD CREATE: CampaignMemberCreateSignor
Create one CampaignMember record where:
CampaignId = {!varCampaignId} (701800000016AwiAAE)
ContactId = {!varSignorId} (0033400001oEp3pAAC)
Status = {!conSent} (Sent)
Result
Failed to create record.