I'm doing a custom version of the 'Add Products to Opportunity' standard component, and I'm trying to fit a two-stage process within a modal ('Select Products' and 'Create Line Items').

I thought I could do it by having a container component that creates the modal and content, with another method that dynamically updates the modal's body with a new component.

It looks roughly like this.

showModalInitially : function(...){
     //Creating modal as per component library instructions
     $A.createComponent(modalBodyComponent, attributes,
       function(content, status) {
           if (status === "SUCCESS") {

                    header: modalHeaderName,
                    body: content,
                    showCloseButton: true
                }).then(function (overlay) {

                     //Get reference to modal/modal body somehow?
                     //component.set("v.modalRef", overlay);?


updateModalBody : function(...){
    component.set("v.modalThatWasCreated.body", /*Create second 

I've haven't been able to get anything like this working, so far. Has anyone been able to do this? Or is there a better way to do this?

  • I don't believe there's a way to do what you're asking, as you're asking it. You would probably want to build a custom modal instead. It's mostly copy-paste from the SLDS documentation. – sfdcfox Aug 2 '18 at 3:57
  • Yeah you're probably right. Thanks for the help 👍 – Lachlan B Aug 2 '18 at 5:14

Your Answer

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

Browse other questions tagged or ask your own question.