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
Mike Lee PCLMike Lee PCL 

Conditionally hide button/quick action in Lightning experience

Hello,

I'm new to developing for Lightning and wanted to find out if it's possible to hide a button/quick action in Lightning based on the profile of the user?

I've seen examples of how to do this using VF but can't find anything about this using Lightning.

Thanks,

Mike
NagendraNagendra (Salesforce Developers) 
Hi,

First step, create ui:button
<ui:button label="test" press="{!c.doAction}" aura:id="myButton"/>
Next step, add to controller
({ doAction : function(component, event, helper) { var button = component.find("myButton"); $A.util.addClass(button.getElement(), 'invisible'); ... code }, })
And you can add new class in STYLE
.THIS .uiButton.invisible { display: none; }
Related Salesforce Documentation: Adding and Removing Styles (during runtime)-https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/intro_framework.htm

Regards,
Nagendra.