In opportunity, I created a quick action which invokes a lightning component. My requirement is, but it should be visible/enable only when stage name is "New". For all remaining stage name values it should be hidden/disabled. Is it possible to change Quick action visibility dynamically? If not possible, please provide me any other solution...

Thanks in advance.


The suite of Quick Actions displayed is set by the page layout, which itself is set via the user's Profile and the Record Type.

If you wish to not show a Quick Action at all based upon record field values, you'd need to change the record's Record Type when it moves into and out of that stage and provide different page layouts to show or not show the Quick Action.

An alternate approach would be to implement conditional logic in your Lightning component to respond differently based upon the record's Stage. For example, the Quick Action might be visible but show an error message in stages other than New.

Yet another possibility is to build a Lightning Record Page for this object and surface the functionality not as a Quick Action but as an independent Lightning component. That component can then be conditionally rendered or not rendered on the page based upon record field values, as configured in Lightning App Builder.


In your lightning component, you have to use aura:if tag for it. Then querry the StageName to be new,if not decide appropriately. I have a sample code for it.

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >

    <!-- Very simple addition -->
    <aura:attribute type="Opportunity" name="simpleRecord"></aura:attribute>
    <force:recordData aura:id="forceRecordCmp"



    <aura:if isTrue="{!v.simpleRecord.StageName=='New'}">
       You can view me
       <aura:set attribute="else">
           You cannot view me


As David said, if you wanna make it configurable, then assign that quick action on page layout and then use filter conditions on Appbuilder to control it.

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.