I am trying to write a complex condition (if statement) in scriptrunner for a custom field that is an issue type to check the value of another custom field, then transition that issue. Then if all the issues equal the same status then it will transition another issue type to another status. This will use 2 workflows that talk to each other. Example below
I have enough coding experience to know that this doable but the custom fields and transitions are confusing me with JIRA
So for an example:
issue type 1 - dealership (customField)
issue type 2 - manager (customField)
field - car (customField)
options in car - "in stock" ,"out of stock" , "preorder"
issue status (1) - Search
issue status (1) - Add to cart
issue status (1) - Buy
issue status (2) - Sold out
1s go with issue type 1 & 2s go with issue type 2
Problem
When status goes from, "search" to "add to cart", check if in "dealership" that "car" has the value "in stock". If value = "in stock", then transition "dealership" status to "buy". If all dealership's status is buy then transition "manager" to "sold out"
Logic
When status search transitions to add to cart
Then for dealership
if car = in stock
Then status transitions to buy
If all dealership status = buy
then transition manager to sold out status
- I italicized all the logical statements
- Bolded all the transitions
- Underlined all the custom fields
I tried this multiple times with automations but nested for if statements aren't possible. I may can do this with 2 automations at the same time but I get errors.
Feel free to ask questions for more details because I am aware of the complexity. The getting the value/status of custom fields stomped me.
Please help.