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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

Mohammed Amine Community Leader Sep 26, 2020

Thank you for this share.

Comment

Log in or Sign up to comment
TAGS
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

455 views 5 18
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you