what is the return value of "object.status.name.equals("Eng Assign")"?

Hi,

In my groovy script, I need to check what is the return value of "object.status.name.equals("Eng Assign")", means it's integer value, boolean value, etc.

def object = ComponentAccessor.getIssueManager().getIssueObject(link)         

if( object.status.name.equals("Eng Assign")  == 1 )

{ do some thing here }

else

{ do dome other logic here }

 

Also using this object I would like to get one custom field value - how to get this using object along with the status of the link issue.

object.server release == "some value" like this ....

  • Manju

1 answer

1 accepted

This widget could not be displayed.

For comparing equality, Groovy makes strings easy:

import com.atlassian.jira.component.ComponentAccessor


def issue = ComponentAccessor.getIssueManager().getIssueObject(link)         
if( issue.status.name == "Eng Assign")
{ do some thing here }
else
{ do dome other logic here }

Both .equals and the == operators will return a boolean (true or false) as you'd expect.

To get the value of a custom field, you have to get the custom field object first, then get the value:

//...continuing from above script
def customFieldManager = ComponentAccessor.customFieldManager
def releaseField = customFieldManager.getCustomFieldObjects(issue).find{it.name == "Release"} //Change the name here to match your custom field; casing matters!
issue.getCustomFieldValue(releaseField)

Thank you very much for your prompt response Jonny.

It really helps me to proceed fruter with my planned work now. Thanks again.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

593 views 25 15
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you