How to get comments in screen for postfunction via Groovy Script Runner?

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

How to get comments in screen for postfunction via Groovy Script Runner?

3 answers

1 accepted

5 votes
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013
transientVars.comment as String

Have fun,

Henning

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Hey Henning

Not worked

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Instead of last comment, I want to send comment at screen in email using https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Send+a+custom+email

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

I got error!

groovy.lang.MissingPropertyException: No such property: transientVars for class: groovy.tmp.templates.GStringTemplateScript55

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Ah ok, i thought you would like to access the comment from the transition screen from a scripted post function.

Did you surround my code with ${} within the email template? Maybe it helps if you post what you already tried.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

I'm only guessing.. and if you try

<% out << transientVars.comment %>

?

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Yes, but not work

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

I tried it by myself. If I write this

Last Comment: <% out << transientVars.comment %>

as "Email template" it works. If no comment was provided during transition you get

Last Comment: null

as email, so you should test for null before you insert the comment.

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Does not work . Here is my configuration

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

That may be the problem. I only tried it as a real workflow postfunction because transientVars is only there for real transitions.

I can't see a configuration in your previous comment...

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Did you try in admin panel or in workflow?

I am trying in admin panel and receiving same error?!

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2013

Thanks! I will try in a postfunction.

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Hey Henning!

How to check for null?

Any documentation link for transientVars functions would be great!!!

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

If you look at the linked page you provided earlier, there is an example on how to check for null for the last comment (https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-Sendacustomemail). In general it's

if (transientVars?.comment) {...}

I don't know about a documentation about the transientVars. It's a Map, and it contains different fields in different situations. You could take a look at the content if you print the content to the log.

log.error "transientVars: $transientVars"

Henning

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Does not work!!

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

What? A little more information would be nice. What did you do? How could you see that it does not work? Did you get any errors?

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

I used, but no message is received.

Last Comment:
<% if(transientVars?.comment)
out << transientVars.comment
%>

Like mani@123 likes this
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Any errors in the log?

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Uh oh, you should change that if you want to go on with scripting JIRA. Maybe your IT department could give you read only access.

Did it work without the if statement?

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Yes! it work without if statement.

Can you test on your side?

Like mani@123 likes this
Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

I do not have access on log file.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Ok, I'll test it. Give me a moment, please :-)

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Works perfect. With or without comment.

Maybe your condition is not met? Do you publish the changed workflow?

Raju KC
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

Many many thanks! It works

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 15, 2013

"Not works".

Wow - way to make it really really hard for other people to help you. Well done Henning... you have more patience than me.

Tóth_Roland_Richárd October 15, 2019

JamieA :D true

0 votes
Patrick van der Rijst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

I'm also gettting groovy.lang.MissingPropertyException: No such property: transientVars for class:

I'm using the post function Comment linked issues Function for this transition and trying to catch the comment from the transition screen.

It says issue, issueObject and log are available objects so transientVars isn't?

 

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

Are you definitely using ScriptRunner? Your previous question suggested you were using another plugin.

Patrick van der Rijst
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 23, 2016

My bad, it was indeed JIRA Misc.

0 votes
Renee Aper May 20, 2014

Just adding a "thank you". This is exactly what I was trying to do this morning.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events