I have a component that displays a modal form using create component and a modal promise. In the community, it works as intended, where something occurs that fires the event that creates the lightning record form component in a modal. We recently revised the component to allow to work for internal uses as well however the modal form doesn't handle the lightning record form events as well. the main feature thats incompatible is im trying to capture the submit event to set a default value and then submit the form. In the community, it works. In Salesforce, it doesnt. the error i get is [component.find(...).submit is not a function]. the main thing that i need to get working now is that when an internal user clicks save, the component.find('name').submit(); is not working

I created a quick demo of my issue and loaded it in a sample app, a community lightning page, and internal lightning page


<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global">
<aura:attribute name="modalPromise" type="Aura.Action"/>
<lightning:overlayLibrary aura:id="overlayLib"/>

click to launch modal
<lightning:button label="modal" onclick="{!c.handleShowModal}"/>



handleShowModal : function(component, event, helper) {
    var recordTypeId = '012r00000001ef7AAA'; // use a case record type        
    var modalBody;
            "objectApiName" : "Case",
            "layoutType" : "Full",
            "recordTypeId" : recordTypeId, 
            "columns" : "2",
            "mode" : "edit",
            "onsubmit" : component.getReference("c.handleFormSubmit"),
            "onsuccess" : component.getReference("c.handleSuccess"),
            "onerror" : component.getReference("c.handleFormError"),
            "aura:id" : "newForm"
        function(content, status) {
            if (status === "SUCCESS") {
                modalBody = content;
                var modalPromise = component.find('overlayLib').showCustomModal({
                    header: 'Testing Modal Failure',
                    body: modalBody, 
                    showCloseButton: true,
                    cssClass: "mymodal",
                    closeCallback: function() {
                        console.log('You closed the modal!');
                component.set("v.modalPromise", modalPromise);

handleFormSubmit : function(component, event, helper){
    console.log('handled form submit');
    event.preventDefault(); // stop form submission
    var eventFields = event.getParam("fields");
    eventFields["Type"] = 'Javascript Test';
handleSuccess : function(component, event, helper){
    console.log('handled form success');
handleFormError : function(component, event, helper){
    console.log('handled form error');


helperMethod : function(component) {
    console.log('helper method called, do you get this far?');
  • Hey textual, what is happening for you if you comment the eventFields["Type"] = 'Javascript Test'; bit? I am not quite understanding this part because it is not instantiated anywhere. If I comment that part, the submit works for me on an internal Case page. If I dont comment it, I get a reference error. Oct 25, 2018 at 21:32
  • @StasChristiansen I forgot to add a line that retrieved the form event fields. I thought I had an issue with the modal not knowing helper or component
    – textual
    Oct 26, 2018 at 0:47
  • Hey, let me know if make any progress. I'm having the same exact issue so maybe its a salesforce bug? Link to my post
    – Alex
    Oct 26, 2018 at 14:17
  • @textual You forgot the line in the question on SO or you forgot the line in your actual code? If the latter, then I assume it is working as expected now? In which cases yay! Oct 29, 2018 at 17:30


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.