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

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,554,066
Community Members
 
Community Events
184
Community Groups

Atlassian Jira. Admin evolution. Part 6

Part 5

This solution should be avoided at all cost!

DB triggers and functions

If the manager has been deactivated we need to change this manager to the supermanager user. How to do it? Easy! We will create a trigger for the cwd_user table. And if a user is deactivated then we will update the customfieldvalue.

First we will create a pl sql procedure:

CREATE OR REPLACE FUNCTION public.changeusermanager()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF NEW.active <> OLD.active and NEW.active = 0 THEN
update customfieldvalue set stringvalue = 'supermanager' where customfield = 10300 and stringvalue = NEW.user_name;
END IF;

RETURN NEW;
END;
$function$
;

And now we can create a trigger:

create trigger changemanager before
update
on
public.cwd_user for each row execute procedure public.changeusermanager();

Let's check how it works. Open the User Management Jira settings and deactive the manager1 user:

Screenshot 2020-06-10 at 11.08.14.png

Click the Update button and let's open one of our created issues:

Screenshot 2020-06-10 at 11.09.31.png

It worked!

We created a solution for our approval process and ready to inform our manager that the task has been completed!

Conclusion

For this kind of solution we used the following techniques: JSP pages, JavaScript code in its worst form, database triggers and functions. If you have this kind of techniques in your Jira instance, you should be really worried about the quality of your solutions.

Moreover, if you or your Jira administrator/developer use the Developer Tools to find out how Jira works and make JavaScript code based on what he/she noticed in the Developer Tools, your solutions also must be low quality.

In the next articles I will explain why these techniques are low quality and, what is most important, how to make a better quality solutions.

Part 7

2 comments

Italo Qualisoni [e-Core]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 05, 2020 • edited

Even though it work visually you won't have consistent indexes by updating directly on Database and JQL will break, no change logs in the issue from the previous field value...

As you stated in your conclusion, this should be avoided at all cost in Production environment.

Is it possible to add a banner in the top of this article? I was reading thinking that it was a good practice article and I was relieved when I read the conclusion 

Like Kat likes this
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

great work

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events