Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Atlassian Jira. Admin evolution. Part 4

Part 3

This solution should be avoided at all cost!

More JS

Now we need to let only the user in the Approver field to transit an issue from the "On Approval" status to the "Ready For Work" status.

The easiest way is to hide the Ready For Work button in the Jira issue view:

Screenshot 2020-06-09 at 19.22.26.png

Let's open again the Jira view issue screen in the Developer Tools. Explore how we can find the "Ready For Work" button and then we will write a JavaScript code to hide this button if the user does not equal to the user in the Approver field. Here is the code:

 setInterval(function(){ 
         if ($("#customfield_10300-val").text()) {
           if (JIRA.Users.LoggedInUser.userName() == $.trim($("#customfield_10300-val").text())) {
            $('#action_id_11').addClass('hidden'); ;
           }
         }
      }, 3000);

  • again I start a loop. Without a loop nothing will work
  • I check if the currently logged in user equals to the value in the Approver field
  • if so I add class hidden to the Approver field

Now let's open an issue under the admin user:

Screenshot 2020-06-09 at 19.20.21.png

As you can see the "Ready For Work" button is absent.

And if we login under the manager1 user then the button will be there:

Screenshot 2020-06-09 at 19.22.26.png

You can ask how I found the JIRA.Users.LoggedInUser.userName() method to get the currently logged in user. It is simple. You can use the Developer Сonsole to find out what functions are available in the page. We will discuss later if we should use these methods or not.

Part 5

1 comment

Comment

Log in or Sign up to comment
M Amine
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 26, 2020

Thank you for this share.

TAGS
AUG Leaders

Atlassian Community Events