Search code examples
javascriptsalesforce-lightningsalesforce-communities

Can you implement a Quick Action button from Community in Salesforce


I have an existing Quick Action button on an object, which I would like to display as a button for Community Users

I have tried implementing lightning:quickActionAPI in a Lightning Component that I created, then added the component to the record detail page in Community Builder. I have changed the actual names of objects and fields with general names

<lightning:quickActionAPI aura:id="quickActionAPI" />
<lightning:button label="Update" onclick="{!c.updateRequestStatus }" />

updateRequestStatus : function(component, event, helper) {
    //debugger;
    var actionAPI = component.find("quickActionAPI");
    var fields = {fieldApiName: {value:"Closed"}};
    var args = {actionName: "objectApiName.quickActionName", entityName: "objectApiName", targetFields: fields};
    actionAPI.setActionFieldValues(args).then(function(){
        actionAPI.invokeAction(args);
    }).catch(function(e){
        console.error(e.errors);
    });
}

Expected result: when clicking on the button in the community, the quick action will be called and a window will open Actual result: clicking on the button executes the JS method but nothing happens


Solution

  • I'm currently seeing the same thing in my Community. The documentation says lightning:quickActionAPI is only available in Lightning Experience, and makes no references to Communities. I don't think it's supported, yet. Though it is confusing that the actionAPI object will instantiate just fine in a Community context but its promises never complete.