Skip to main content
Sekhar CPQ (SFDC) が「#Security」で質問

I have created component for creating new opportunity record whenever user click new opportunity button custom object detail page. It is working fine in lightning experience window but not in partner portal.

 

Error:  If i click the button on partner portal it's opening partially and immediately closing the window.

Component:

 

<aura:component implements="lightning:actionOverride,force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" 

 

                access="global"

 

                controller="NewOpportunityCreation">

 

    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

 

</aura:component>

 

Component Controller:

 

({

 

    doInit : function(component, event, helper) {

 

        var action = component.get("c.getEmployeeobject");

 

        action.setParams({"EmpId":component.get('v.recordId')});

 

        // Configure response handler

 

        action.setCallback(this, function(response) {           

 

            var state = response.getState();       

 

            if(state === "SUCCESS") {     

 

                var returnVal = response.getReturnValue();

 

                if($A.util.isEmpty(returnVal)){

 

                    $A.get("e.force:closeQuickAction").fire();

 

                    return;

 

                }

 

                var createRecordEvent = $A.get("e.force:createRecord");

 

                createRecordEvent.setParams({

 

                    "entityApiName": "Opportunity",

 

                    "defaultFieldValues": {

 

                        'AccountId' : returnVal.AccountId,

 

                        'Emp__c' : component.get('v.recordId')

 

                    },

 

                    "recordTypeId":returnVal.RecordTypeId

 

                });

 

                createRecordEvent.fire();

 

                $A.get("e.force:closeQuickAction").fire();

 

            } else if (state == "ERROR"){

 

            } 

 

        });

 

        $A.enqueueAction(action);           

 

    },

 

})

 

Apex Class:

 

public class NewOpportunityCreation {

 

    @AuraEnabled

 

    public static wrappClass getEmployeeobject(String EmpId){

 

        wrappClass wrapcls = new wrappClass();

 

        try{

 

            wrapcls.AccountId = [Select Account__c from Emp__c where Id=:EmpId].Account__c;

 

            wrapcls.RecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('OPP').getRecordTypeId();

 

        }catch(Exception ex){

 

            System.debug('Exction Occured'+ex.getMessage());

 

        }

 

        return wrapcls;

 

    }

 

    public class wrappClass{

 

        @AuraEnabled

 

        public Id AccountId {get;set;}

 

        @AuraEnabled

 

        public Id RecordTypeId {get;set;}

 

    }

 

}
3 件の回答
  1. 2018年11月21日 6:58
    What I can see in your Lightning Component wrong is that you are calling Close Quick Action immediately after firing the createRecord Event.

     

    You need to call "$A.get("e.force:closeQuickAction").fire();" line after createRecordEvent.fire();

     

     

    That might be the issue. 
0/9000