Forums

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

Condition based on linked issue and/or subtask issue

Mohamed El Taweel August 20, 2018

The Procurement project have many issue types "Project , invoice , task, idea" every issue type has its own workflow 


If the issue type is "Project", we set the field "Need invoicing" to "Yes" if there is a need to invoice, then we create a ticket on the same project with issue type "Invoice" and  linke it to the main ticket.  When the Invoice ticket is set to status "Invoice is paid", it is closed with status "Invoiced"

When we close the main ticket we need to add a condition, if the "Need Invoicing"= "Yes" the linked ticket with "issue type" = "Invoice" its status should be "Invoiced"

How can we implement this condition? as this issue is impacting the business

a detailed script runner example is highly appreciated.

 

Note: we may have couple of subtasks and couple of linked tickets in the main ticket

Thanks

2 answers

0 votes
Mark Markov
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.
August 21, 2018

Hello @Mohamed El Taweel

As @Tarun Sapra says you can do it with simple scripted validator.

Here is example of condition:

def linkIssues = issueLinkManager.getOutwardLinks(issue.id)*.destinationObject
!(cfValues['Need Invoicing']?.value == "Yes" && !linkIssues.any{
it.status.name == "Invoiced" && it.issueType.name == "Invoice"
})
Mohamed El Taweel August 22, 2018

I used

def linkIssues = issueLinkManager.getOutwardLinks(issue.id)*.destinationObject
!linkIssues.any{
it.status.name == "Invoiced" && it.issueType.name == "Invoice"
}

But it always return True
Like azade bagheri likes this
0 votes
Tarun Sapra
Community Champion
August 20, 2018

Hello @Mohamed El Taweel

You can easily implement your requirement by adding a custom validation in the transition of the mail ticket to status close. Such that when mail ticket is moved to closed then you check the value of custom field "need Invoicing" and then check the status of linked tickets of types "Invoice"

Suggest an answer

Log in or Sign up to answer