Forums

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

How to read workflow status name using groovy

Arunajyothi Samala September 12, 2023

Hi, Team

How to read workflow status name "To-Do" in Jira using groovy (ScriptRunner), then convert into string and compare the value?

2 answers

1 accepted

1 vote
Answer accepted
Vishal
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.
September 12, 2023

Hi @Arunajyothi Samala 

Check this community question which might solve your query.

Thanks

Arunajyothi Samala September 12, 2023

Hi @Vishal 

Thanks for your reply, sorry for the missing details earlier. I am trying to use this in a behaviour script. Could you please let me know what changes I would need to make to be able to read status of the current issue? I have already tried the following but couldn't get it to work.

def Customfield = getFieldById(getFieldChanged())
def value = Customfield.getValue() as Number
def Customfield8 = getFieldByName("Feature Name")
def Status = underlyingIssue.getStatus().getName()

if ((value >=20000) && (Status.toString().equals("To Do")){
        Customfield8.setHidden(false)
        Customfield8.setRequired(true)
}
Vishal
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.
September 13, 2023

try this instead & see if it works

if (value >=20000 && underlyingIssue.getStatus().name == "Status Name")
Arunajyothi Samala September 13, 2023

Thank you @Vishal It is working for me.

Vishal
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.
September 14, 2023

@Arunajyothi Samala Welcome, Please accept the answer so that its useful for other community members.

Arunajyothi Samala September 14, 2023

@Vishal Yes, I did. And thank you! can you please help me with the below question as well. 

I have three conditions for my scriptrunner behaviour script.

1. If value >= 20,000(For this condition , the issue is not yet created, this condition is for create screen)

2. If value >= 20000 && underlyingIssue.getStatus().name == "To-Do")

3 if value < 20000

I need to show fields and make them required when shown

I need to hide them and make not required when they are not shown

I need an if, else if, else statement here.

0 votes
Arunajyothi Samala September 13, 2023

Hi @Vishal 

I have three conditions for my scriptrunner behaviour script.

1. If value >= 20,000(For this condition , the issue is not yet created, this condition is for create screen)

2. If value >= 20000 && underlyingIssue.getStatus().name == "To-Do")

3 if value < 20000

I need to show fields and make them required when shown

I need to hide them and make not required when they are not shown

I need an if, else if, else statement here.

Suggest an answer

Log in or Sign up to answer