function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rajasekhar TRajasekhar T 

Lightning Component button on partner portal it's opening partially and immediately closing the window

I have Implementing 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.

 

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;}
    }
}

Can you anybody help me to fix the issue.