1

I have an Aura Component which I'm using to dynamically show a set of fields based off of a record type. This is done using Custom Metadata to store the association between record type and field that needs shown. In the component helper, I then use $A.createComponent to create a lightning:input, which uses cmp.getReference() to map the field on the record to the value attribute of the lightning:input. This works to display the value of the field, but does not send the value back to a flow. Here is my code:

helper js:

var componentType = "lightning:input";
var fieldReference = "v.selectedEntry." + field.Field_API_Name__c;
var params = {
    "label" : field.Field_Label__c,
    "value" : cmp.getReference(fieldReference),
    "type" : "text"
};
$A.createComponent(componentType, params, function(newCmp, status, errorMessage) {
    if(status === "SUCCESS") {
        let body = cmp.get("v.body");
        body.push(newCmp);
        cmp.set("v.body", body);
    }
    else {
        console.log("Error: " + errorMessage);
    }
});

And in my design file I have <design:attribute name="selectedEntry" label="Output Entry Record" />

This is then used in the flow in the Store Output Values to Select Variables section, and the NVCA_Temp_Entry variable is then inserted later in the flow

Variable used in flow

Overall, I know the reference is working, because it will display the value already there, but any idea why when the record is later saved in the flow, the new values don't get saved?

0

Turns out this did work correctly as written. The flow variable that my component saved to was never actually used in saving the record later, which was the issue.

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.