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
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried this but was not able to see the properties......
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.