Control the visibility of Create and Search Jira Buttons on LWC

  • Category : Permissions
  • Article Number : 23
  • Publish Date: 08 Feb, 2024

Objective

In this article, we will walk you through the steps to show/hide Create Jira or Search Jira buttons inside the Lightning Component based on Profile or Permission sets.

Solution

We will first create a new record inside the Sinergify custom setting and then we will assign it based on Profile or Permission sets, depending on the use case.

Create a record in the custom setting.

  1. Log in to Salesforce.

  2. Go to the Custom Settings from the quick find.

  1. Find the JiraSalesforceDetail custom setting and open the record.

  2. Select Manage.

  1. Select New to create a New record in the custom setting.

  1. Fill in the exact details as mentioned below

    1. Name: Enable Custom Access

    2. Value: Yes

      Yes: This custom setting will be enabled.

      No: This custom setting will be disabled and buttons will be visible as per the permissions you might have already given to users based on the ‘Jira Project’ Object Level.

    3. Instance Number: Less Than 1000 (e.g., 001)

Grant Custom Permissions to Users

Once the custom setting has been created and marked as Yes, we will assign permissions to users either via Profile or via Permission sets, based on the business use case.

  1. Go to the respective user profiles or permission set.

  2. Click on Enable custom permissions and then click Edit

  1. Add Create or Search or both depending on the use case.

  • Grz_Sf.Create Jira Permission: This will allow user(s) to see the Create Button

  • Grz_Sf.Search Jira Permission: This will allow the user(s) to see the Search Button

  1. Once Done click Save.

Use Case 1

2 Profiles are able to see the Sinergify Lightning component on the object record page. You want Profile 1 to see both the create and search buttons. Profile 2 will only be able to see the search button.

Solution: Go to user profile 1 and assign the custom permission of both Create and Search Permissions. Go to profile 2 and assign only the search Permission

Use Case 2

2 Profiles are able to see the Sinergify Lightning component on the object record page. You want a few users of Profile 1 to see both the create and search buttons, the rest should only be able to see the search button.

Solution: Create a new permission set for those 3 users. Assign the custom permission of both Create and Search Permissions. Create another Permission Set for the rest of the users of profile 1 and assign them with the search Permission only. Profile 2 users can be given permissions via profile level for Search only.