Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with configuring Scriprunner Jobs

Aisha M
Contributor
April 25, 2022

I have a requirement where I want to archive certain EPICS across my JIRA instance. I then realized there is an in-build Jobs option within Scriptrunner to help accomplish something similar.

So, I want to automatically archive my EPICS based on the below criteria,

* ISSUE TYPE = Epic

* WORK SEGMENT (drop down custom field value) = ABC SECTOR

* DUE DATE = Over 30days

* No issues (Story, Bug, Task, Sub-task) must be link be linked to the Epic.

In the above case, I want the EPIC to be automatically archived and an email must be triggered to a user - STAKEHOLDER (custom field with a user-picker) & the Project Lead, stating that the Epic is archived due to inactivity. 

Is this possible using Script runner Jobs, or anything else ?

Thank you !

 

3 answers

2 accepted

1 vote
Answer accepted
Tuncay Senturk
Community Champion
April 25, 2022

Hi @Aisha M 

As you mentioned, that's doable using Script Runner's Issue Archiver's Job, you can see a youtube video here.

However, as @Anzar mentioned, it won't trigger an email to stakeholders which are specified in a user custom field.

Aisha M
Contributor
April 25, 2022

@Tuncay Senturk Thank you ! 

Also, can custom scripts be used to trigger mails to certain user groups ? Or that's not possible as well :O

Tuncay Senturk
Community Champion
April 26, 2022

If you want to trigger the same email to be sent to users in a user custom field of the issue as well as the stakeholders of the issue (assignee, reporter), I don't think so.

On the other hand, you can send emails using script runner, here is a library document on how to send email via script. If you want to send an email per issue, you may define a job similarly in which a custom script will run and fetch those issues, getting the users in the custom field and sending them the content. However, it might be a bit difficult. I hope it makes sense.

Anzar
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.
April 26, 2022

Correct!
But if you accept this answer, Please accept mine too :') Appreciated!

Aisha M
Contributor
April 26, 2022

@Tuncay Senturk  That sounds way too complex :( How about JIRA Automation to trigger a mail when the EPIC is archived ?

Tuncay Senturk
Community Champion
April 26, 2022

I am not good at Automation, but it sounds like a brilliant idea. 

Aisha M
Contributor
April 26, 2022

Unfortunately there is no trigger in automation that deals with archived issues, so not sure how far that ll go . . 

Aisha M
Contributor
April 26, 2022

@Tuncay Senturk Incase you wanna know, 

There is a SCHEDULED option in automation where you can trigger mails at intervals based on your JQL.

Something like this , https://community.atlassian.com/t5/Jira-questions/How-to-add-automation-rule-that-sends-email-notification-if/qaq-p/1709583

Hoping to the JIRA Gods it works :D:D

Tuncay Senturk
Community Champion
April 26, 2022

:D fingers crossed!

Aisha M
Contributor
May 10, 2022

@Tuncay Senturk  @Anzar  I need help with the JQL . . The query mentioned in the answer doesn't filter properly . . 

I need to filter Epics that have the cascading field - Work level - parent value (ABC Work) & child vales (2020 done; 2021 done) & the epic must have no linked team issues (stories or tasks associated with it)

Our users use two methods to link stories to an epic - Epic link & a custom link we created (Child of custom link)

I tried  
issuetype = Epic AND "Work level" = "ABC Work" AND duedate >= 30 AND issueLinkType != "Child of custom link"

This still shows Epics with stories linked to it & the query is not proper. Unable to put issuelinktype is EMPTY  coz "is" operator is not supported for issuelinktype

Any help on this please  

1 vote
Answer accepted
Anzar
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.
April 25, 2022

Hi,

You can use the issue archive job which comes under Job section in script runner.

You can provide the following JQL
issuetype = epic and cf[12510] = 'ABC Sector' and duedate >= 30d and issueLinkType is EMPTY

This wont trigger an email to stake holders in the custom field.

Else what you can do is make a custom job and write a script to do the same on the above JQL.

Sending an email to a customfield or email is written in
https://community.atlassian.com/t5/Marketplace-Apps-Integrations/Help-with-using-Scriptrunner-to-send-email/qaq-p/697985

Regards,

Anzar Khan

Aisha M
Contributor
April 25, 2022

@Anzar  Thank you Anzar ! Will work with this and see how far it goes :)

And just to be clear, do I need to have a job AND a script  to get this done ? or just a job should be good ?

Like Anzar likes this
0 votes
Aisha M
Contributor
April 25, 2022

@Tuncay Senturk Hello again :D:D Just incase you are interested :D Trying to figure this above requirement & would love to get some opinion from the community. 

Suggest an answer

Log in or Sign up to answer