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

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 vote

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

77 views 0 5
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