I have a Lightning Action that initiates a Flow. The flow gathers record data, collects one variable from the user that is selected via a radio-button choice, then launches a lightning component that fires force:createRecord with preset parameters based on the Flow input.

The Code

The Lightning Component code is as follow:


<aura:component implements="force:lightningQuickAction,lightning:availableForFlowActions">
    <aura:attribute name="Institution__c" type="String" />
    <aura:attribute name="Level__c" type="String" />
    <aura:attribute name="Meeting_Date__c" type="Date" />
    <aura:attribute name="Name" type="String" />
    <aura:attribute name="RecordTypeId" type="String" />
    <aura:attribute name="Wavemaker__c" type="String" />


    <design:attribute name="Institution__c" />
    <design:attribute name="Level__c" />
    <design:attribute name="Meeting_Date__c" />
    <design:attribute name="Name" />
    <design:attribute name="RecordTypeId" />
    <design:attribute name="Wavemaker__c" />


    invoke : function(component, event, helper){

        var Institution__c = component.get("v.Institution__c");
        var Level__c = component.get("v.Level__c");
        var Meeting_Date__c = component.get("v.Meeting_Date__c");
        var Name = component.get("v.Name");
        var RecordTypeId = component.get("v.RecordTypeId");
        var Wavemaker__c = component.get("v.Wavemaker__c");

        var createRecord = $A.get("e.force:createRecord");

            "entityApiName": "Intervention__c", 
            "defaultFieldValues": {
                "Institution__c" : Institution__c,
                "Level__c" : Level__c,
                "Meeting_Date__c" : Meeting_Date__c,
                "Name" : Name,
                "RecordTypeId" : RecordTypeId,
                "Wavemaker__c" : Wavemaker__c,

The Problem

This flow works as expected in the sandbox in which it was created, opening a new record with prepopulated data as if through a salesforce classic URL-Hack. The solution is based off of this article.

Unfortunately, once I ported the button/flow/component via a change set to a secondary sandbox, I receive the flowing error:

enter image description here

Strangely, the new draft of the record is still created, but rather that redirecting to it, the error message above occurs and the flow remains open.

The information provided in the error is, as you can see, extremely limited. My best guess is that there is some sort of environmental variable between the sandboxes that is causing this issue, but I don't know what might be causing it.


I was able to resolve this issue.

After testing the Flow with the debug log in the new sandbox, I noticed that one of the input fields, Institution__c, was returning Null rather than an Id value as expected.

This field was not populated in the second sandbox because the automation that populates it was just introduced in the same change set as the lightning component. Once I ran the automation that populated the field, the redirect worked as expected.

I've encountered similar errors with force:createRecord in the past. My recommendation to anyone encountering errors with this aura component is to first check that none of the field values assigned via .setParams() are null.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.