0

I am using lightning:recordForm on my component that is displaying some case data along with the Owner. It's not possible to edit the owner, like it is on the standard one. Is there any way around this?

fields are: CaseNumber,Status,OwnerId,AccountId,Subject,Description

enter image description here

$A.createComponent(
        "lightning:recordForm",
        {
            "aura:id":"caseCompact",
            "recordId":cmp.get("v.recordId"),
            "recordTypeId":cmp.get("v.recordTypeId"),
            "objectApiName":"Case",
            "mode":"view" ,
            "fields":cmp.get("v.fields"),
            "columns":"2",
            "onsuccess": cmp.getReference("c.handleSuccessAction"),
            "oncancel": cmp.getReference("c.handleCancelAction")
        },
        function(newForm, status, errorMessage){
            //Add the new button to the body array
            if (status === "SUCCESS") {
                cmp.set("v.body", [newForm]);
            }
            else if (status === "INCOMPLETE") {
                console.log("No response from server or client is offline.")
                // Show offline error
            }
            else if (status === "ERROR") {
                console.log("Error: " + errorMessage);
                // Show error message
            }
        }
    );
  • 3
    your component seems to indicate 'view' mode – glls Dec 28 '18 at 15:35
  • 1
    even edit mode will not bring the change owner button. – sanket kumar Dec 30 '18 at 18:53
1

From the docs: "Fields that have a spanning relationship aren't supported by lightning:recordForm. The fields specified must be associated with the same objectApiName. A field such as Contact.Account.Ownership is a cross-object reference between the Contact object and the Account object, and can't be displayed in the form."

Documentation

|improve this answer|||||

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.