1

We have a Lightning Component button which allows Users to provide discounts on Opportunities.

We are currently leveraging the "Quick Action" functionality to display it on some page layouts.

The problem is that these layouts are available for Users who may neither have the Profiles ("Sales" or "Risk Ops") nor the Roles ("Vice President" or "Managing Director") which would allow the User to apply the discounts.

We have backend validation to ensure that the User will have either an appropriate Profile or an appropriate Role (it isn't necessary for the user to have both).

However, for good UX, we want to NOT DISPLAY the button unless the User is permitted to actually apply the discount.

I was looking in the Permission Sets, but I couldn't find any way to make buttons visible or invisible.

Is there a way to do this?

Or any ideas for good alternatives?

-1

You could look at aura:if inside the component.

It enables things to be displayed if a condition returns true. I've used it to display different options for quick links to reports based on Record type.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_tag_if.htm

<aura:component 
implements="flexipage:availableForRecordHome,force:hasRecordId" 
access="global" >

<!-- Collection point of below "Record Data" -->     
<aura:attribute name="recordInfo" type="Object" />
<aura:attribute name="record" type="Object"/>
<aura:attribute name="recordError" type="String"/>
<!-- Necessary to collect field data and puts it in Attribute Above */ -->

<!-- START Queries All Fields!!! -->

<force:recordData aura:id="recordLoader"
                  recordId="{!v.recordId}"
                  layoutType="FULL"
                  targetRecord="{!v.record}"
                  targetError="{!v.recordError}"
                  targetFields="{!v.recordInfo}"
                  />

<!-- /* Show Header based on RecordTypeId */-->
<aura:if isTrue="{!v.recordInfo.RecordTypeId=='012C0000000UmVLIA0'}">
<header style="font-size:25px;margin-bottom: -35px;">Header Text or Ltng 
button</header><hr/><br/>
</aura:if>

</component>
3
  • That could hide the contents of the Lightning Component, but the QuickAction button would still display. Sep 13 '18 at 11:27
  • You could do a check to see if a user has particular rights, and if not, write an error message saying something as such. eg "This functionality is not available for your user".
    – DCole
    Sep 21 '18 at 2:42
  • I'm not looking to make the button ineffective, but to completely hide it. Sep 21 '18 at 6:14

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.