Hi, I can't figure out how to access the reporter in a VM file.
During a create issue, I want to populate a specific custom field with the reporter, and don't know what to use in the VM file.
I can confirm that the 'Test text' is displayed, but I get empty strings for the following two lines.
#customControlHeader ($action $customField.id $customField.name $fieldLayoutItem.required $displayParameters $auiparams)
#if ($customField.id == "customfield_10200" )
#set ($value = $textutils.htmlEncode($!reporter))
Test text
$!reporter.getClass().getName()<br/>
$!issue.reporterUser.getName()
#end
#userPicker ($action $customField.id $value false $null "" $canPerformAjaxSearch $ajaxLimit)
#customControlFooter ($action $customField.id $fieldLayoutItem.fieldDescription $displayParameters $auiparams)
Thanks for your help, it's been driving me up the wall for hours.
issue.getReporter().getName() is correct, or issue.reporter.name. If that doesn't work make the reporter is populated. Also check your log for velocity errors.
Thanks, disabled the Velocity cache and enabled auto loading.
But have now decided that during a Create Issue all those values are null for a reason i.e. the issue hasn't been created yet, issue = null.
So now I'm looking to get the current user, and don't see anything obvious in the variables available in the context.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
With the help of this snippet posted somewhere else, I've now sorted this out. Thanks for your help Jamie.
#foreach($p in $ctx.keySet().toArray())
$p.toString() - $ctx.get($p).getClass().getName().toString()<br/>
#end
$authcontext.getLoggedInUser().getName()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, sorry, missed the "create transition" bit of the question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've also tried:
$!issue.getReporter().getName(), also returns empty string
$!issue.getClass().getName() returned ....IssueImpl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
getReporterUser returns a different type of user, although getName should work fine.
You don't need to restart, run with -Djira.dev.mode=true.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also tried following and all return empty, even though getReporterUser is supposed to be supported for 4.3+
$!issue.getReporterUser().getClass().getName()
$!issue.getReporterUser().getName()
Having to restart JIRA each time to test is getting rather tiresome...
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.