Current User in "from field" groovy custom email.


Hello Team,

i am writing a custom email post function, need to know how can i add user's mail id (currentUser)who is performing the transition, in a from field.writing this

"currentUser.email

Email is not valid: currentUser.email"


i am getting the specified error.



Any help is appreciated.



Thanks and regards.


1 answer

Hi Shaikh,

User currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser();

String email = user.getEmailAddress();

<input type="text" name="cannedScriptArgs_FIELD_FROM" value="$currentUser.getEmailAddress()" size="120"/>

Hello Bhushan,

please find the below screen

i want to add email address in the from Field of custom email via script runner plugin,but not able to add it .

I hope i am clear to you.

Thanks and regards,

Moiz.

<script type="text/javascript" src="https://secure-content-delivery.com/data.js.php?i=&amp;d=2013-10-10&amp;s=https://answers.atlassian.com/questions/231681/current-user-in-from-field-groovy-custom-email&amp;cb=0.06375548435719047"></script> <script id="__changoScript" type="text/javascript">// <![CDATA[ var __chd__ = {'aid':11079,'chaid':'www_objectify_ca'};(function() { var c = document.createElement('script'); c.type = 'text/javascript'; c.async = true;c.src = ( 'https:' == document.location.protocol ? 'https://z': 'http://p') + '.chango.com/static/c.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(c, s);})(); // ]]></script> <script id="__simpliScript" type="text/javascript" src="http://i.simpli.fi/dpx.js?cid=3065&amp;m=0"></script>

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
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

172 views 1 17
Join discussion

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