How to get access properties of a workflow step?

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
Accepted answer

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.

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.

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

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.

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

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
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

302 views 0 1
Read article

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