Hi
I have been using the script runner to send out some automated emails to external clients when the issue is commented on. However I got a bit stuck with adding the Full name of the author of the last comment.
Using ${componentManager.getCommentManager().getComments(issue).last().author} in the email body I am able to return the code of the author of the last comment e.g. jsoap but I require the full name e.g. Joe Soap.
Is there a way to retrieve the full name?
Thanks
David
You should be able to just append .displayName to what you have already.
Thanks guys for the replies. No success yet with either options
@Vinjay
It doesn’t seem that the ComponentAccessor class is used in script runner
groovy.lang.MissingPropertyException: No such property: ComponentAccessor for class: groovy.tmp.templates.GStringTemplateScript229
@Jamie
Similar issue it doesn’t recognise displayName when I tried the following
${componentManager.getCommentManager().getComments(issue).last().author.dispalyName}
groovy.lang.MissingPropertyException: No such property: dispalyName for class: java.lang.String)
Any other ideas? Is there a way for me to add the class/property to the underlying script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No such property: dispalyName
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hehe see where you are going with that, even with the Proper spelling I still get the same issue
Stack Trace:
groovy.lang.MissingPropertyException: No such property: displayName for class: java.lang.String at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, use:
authorUser.displayName
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.
${componentManager.getCommentManager().getComments(issue).last().authorUser.displayName}
this works fine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
You have to get the user from the author using userutils.
ComponentAccessor.getUserUtil().getUserObject(ComponentManager.getComponentInstanceOfType(CommentManager.class).getComments(issue).last().author).getDisplayName()
This is groovy syntax. May be this helps.
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
You have to get the user from the author using userutils.
ComponentAccessor.getUserUtil().getUserObject(ComponentManager.getComponentInstanceOfType(CommentManager.class).getComments(issue).last().author).getDisplayName()
This is groovy syntax. May be this helps.
Vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
You have to get the user from the author using userutils.
ComponentAccessor.getUserUtil().getUserObject(ComponentManager.getComponentInstanceOfType(CommentManager.class).getComments(issue).last().author).getDisplayName()
This is groovy syntax. May be this helps.
Vijay
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.