It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to get access properties of a workflow step?

Sathish Venkat Nov 15, 2011

Hi All,

I need to execute certain part of a groovy script that I am having as a post function in a workflow transition based upon some value.I thought of utilizing the workflow step properties that are available.How can I access that in my groovy script,It would be great if someone provides me a sample code snippet.

I do not want to set the properties,I just need to get the values.Also I am afraid if the properties can collapse the entire workflow bcoz it happened when I tried to set properties last time using a groovy script.Is there any risk in using that.

Any help on this is appreciated.

Thanks in advance.

Sathish

3 answers

1 accepted

1 vote
Answer accepted
Sathish Venkat Nov 15, 2011

int id = transientVars.get("actionId");
ImmutableWorkflowDescriptor wdes = (ImmutableWorkflowDescriptor)transientVars.get("descriptor");
ActionDescriptor actDes = wdes.getAction(id);
log.debug(actDes.getMetaAttributes());

getMetaAttributes returned the property of the specific transition.

0 votes
Wojciech Seliga Nov 15, 2011

com.opensymphony.workflow.loader.ActionDescriptor#getMetaAttributes is what you are looking for I guess. It returns a map, so you can call get("myattributename") on the result to retrive concrete property of your workflow transition.

You get ActionDescriptor instances usually by calling appropriate method on com.opensymphony.workflow.loader.WorkflowDescriptor

I don't have experience with Groovy scripts, but AFAIK you can just invoke them in a normal way - as anything from JIRA you call in your scripts.

Sathish Venkat Nov 15, 2011

Hi Wojciech,

Thanks a lot.It worked like a charm.Below is the code snippet that I used to retrieve the property.

int id = transientVars.get("actionId");
ImmutableWorkflowDescriptor wdes = (ImmutableWorkflowDescriptor)transientVars.get("descriptor");
ActionDescriptor actDes = wdes.getAction(id);
log.debug(actDes.getMetaAttributes());//this gave all the properties in a map.

Tons of thanks for your help.

0 votes
JamieA Nov 15, 2011

transientVars and args are made available in the binding, both of which are Maps.

If you log.debug them you will find the properties in one of those... iirc.

Or if not, you also have the step available so, you can get them as Wojczek says.

Sathish Venkat Nov 15, 2011

I tried this but was not able to see the properties......

Sathish Venkat Nov 15, 2011

Hi Jamie,

Thanks for the post.I did not get the peoperties directly but used transientVar to get the property using below code snippet.

int id = transientVars.get("actionId");
ImmutableWorkflowDescriptor wdes = (ImmutableWorkflowDescriptor)transientVars.get("descriptor");
ActionDescriptor actDes = wdes.getAction(id);
log.debug(actDes.getMetaAttributes());

Thanks a lot for your help.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Marketplace Apps & Integrations

Demo Den Ep. 4: Continuous Integration with CircleCI & Jira Software

Get ready! Demo Den Episode 4 is coming your way on Tuesday, May 28, 2018 with a Continuous Integration and Delivery special demo. CircleCI Director of Solutions Engineering, Eddie Webb will show us ...

454 views 0 4
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you