3

I have created one Component from which I'm creating new record, using force:createRecord

The new record creation page is opening perfectly on click of Quick Action but one new blank model is also showing up on top of that page. I'm not able to figure out how to hide this popup.

The screenenter image description here of Popup:

Here is my code: Component:

<aura:component implements="force:lightningQuickAction" access="global" >
      <aura:handler name="init" value="{!this}" action="{!c.createRecord}"/>
</aura:component>

Controller:

   ({
       createRecord: function(component, event, helper) {
          var createRecordEvent = $A.get("e.force:createRecord");
          createRecordEvent.setParams({
             "entityApiName": "custom_obj__c",
              "defaultFieldValues": {
            'Name' : 'Abc'
            }
          });
          createRecordEvent.fire();
$A.get("e.force:closeQuickAction").fire();
       }
    })
  • 2
    Question, why don't you just create a new "Create Record" quick action? Is there more logic than what we can see? – Sebastian Kessel Oct 17 '17 at 15:18
  • Basically I wanted to have a list view button from where I need to prepopulate some value – salesforce Developer Oct 17 '17 at 15:41
  • Regular quick actions allow you to set default values for fields... – Sebastian Kessel Oct 17 '17 at 15:45
  • but I won't be able to use Quick Action in list view button – salesforce Developer Oct 17 '17 at 16:45
  • You should fire the closeQuickAction event before you fire the createRecordEvent. – Folkert Jul 30 '19 at 14:21
5

Basically you need fire closeQuickAction event after createRecord event to close quick action window. Add below code after firing createRecord event.

    var dismissActionPanel = $A.get("e.force:closeQuickAction");
    dismissActionPanel.fire();
| improve this answer | |
  • I already tried it. it is actually closing the new record creation model not the blank model, which is coming on top of the record creation model. – salesforce Developer Oct 18 '17 at 8:21
  • Plz share your code – brahmaji tammana Oct 19 '17 at 9:52
  • I have modified my code. – salesforce Developer Oct 20 '17 at 14:26
1

please try the following codes.

window.setTimeout(
    $A.getCallback(function() {
        $A.get("e.force:closeQuickAction").fire();
    }), 1000
);
var createRecordEvent = $A.get("e.force:createRecord");
createRecordEvent.setParams({
    "entityApiName": "custom_obj__c",
    "defaultFieldValues": {
        'Name' : 'Abc'
    }
});
createRecordEvent.fire();

and let me know whether this works for you. Thanks.

| improve this answer | |
  • It is automatically closing the blank model, but users can still see this blank model for some seconds – salesforce Developer Nov 20 '17 at 6:39
  • Put the time from 1000 to 10 or something else. There is no way to eliminate the start up of blank. Or you can add spinner in the blank popup. – Remy Chen Nov 21 '17 at 6:09
  • even giving time as 1, I can see that popup – salesforce Developer Nov 22 '17 at 7:05
  • You might need to use spinner in the blank popup. You can't make it disappear at the beginning because your new creation is created from that Action. I believe the way you want to implement is impossible. – Remy Chen Nov 27 '17 at 5:19
-1
  1. I think is not Working on direct using for Onload. It's work when you set the timeout On Load and call dismiss quick action it's Work.

    doinit : function(component, event, helper) {
    
        window.setTimeout(
            $A.getCallback(function() {
                $A.get("e.force:closeQuickAction").fire();
    
            }),100
        );
    
        var recordId = component.get("v.recordId");
        var newEvent = $A.get("e.force:navigateToComponent");
        newEvent.setParams({
            componentDef: "c:Navigate",
            componentAttributes: {
                sNavigateComVal1 :recordId
            }
        });
        newEvent.fire();
    }
    
| improve this answer | |
  • 1
    Welcome to SFSE! Please take the tour, read How to Ask and How to Answer. Right now, this doesn't look like an answer to me, but rather a similar question. Please consider asking your own question (and linking back to this one, if it helps provide context), and gather up as much information and detail as you can. – Derek F Feb 6 '19 at 12:24
-2

refer this link, worked perfectly to hide the box, box wont appear at all. and there wont be backdrop also.

https://developer.salesforce.com/forums/?id=9060G000000MVx8QAG

| 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.