Post Function - Condition

Manoj August 17, 2022

Hi,

I have to set up a condition on transition:

if the total Price (in custom field) is <100 then it is simply gets approved but when total price is >=100 then it will go for manager's approval. 

any suggestion.

Currently i have tried Value Field (JSU) for the same irrespective of total prices its get approved. 

2 answers

0 votes
Adnan Ali August 20, 2022

What are the steps you have to follow, if you are setting fields during a status transition, or if you are editing an issue, in order to set these fields. It should be noted that Post Functions are only applicable in the case of a Status Change. In the case where you are filling out the fields during the process of editing a record, a Post Function will not be triggered.Can you explain how the status of an application changes from Unapproved to Approved? In other words, does that mean that the ScriptRunner function is doing the summarization for you?We would be very grateful if you could provide us with a copy of the code/function that triggers the status change from Unapproved to Approved so that we can see how it works.Are you using a specific type of Jira? Is Jira cloud based or is Jira server/datacenter based?

0 votes
Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 17, 2022

Can you show us the details of your post function?

When you say it "gets approved" or "go for manager's approval", what exactly does that mean? Are you expecting it to get yet another status after the status you are transitioning to? Are you setting a field in the issue?

Manoj August 19, 2022

To give you more details, 

When I create a ticket, it remains in draft, once I fill the ticket with "cap-price" and "op-price"  Say 40 and 60 whose total price (custom field which auto sum the cap and op-price via scripteunner) is 100, and update the ticket and its simply gets approved. 

But when total is equal to or more than 100 then it should check the condition and trigger a status as to "go for manager's approval" And ticket should directly get assinged to Manager and he will have to review it and approve. 

 

Pls See the attachment this may give you more clear requirementIMG_20220820_000748.jpg

Trudy Claspill
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 19, 2022

Hello @M 

Are you setting the fields during a status transition, or by simply editing the issue?

Post Functions are applicable only to a Status Change. If you are filling the fields during an Edit operation, that itself will not trigger a Post Function.

What is currently triggering the change of status that results in the transition to Approved? Is that the ScriptRunner function that is summing the values?

We need to see the code/function that is triggering the status transition to Approved.

Are you working with Jira Cloud or Jira Server/Data Center?

Manoj August 19, 2022

Hello @Trudy Claspill , 

Yes am setting the fields during a transition, and yes script runner summing the total price. Ok I will reply back with code soon. 

Yes working on jira server only. 

Suggest an answer

Log in or Sign up to answer