It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Creating Mail handler plugin GUI Edited

I try to create mail handler plugin folowwing "Creating a custom mail handler for Jira" tutorial.   I can't get parameters in class EditDemoHandlerDetailsWebAction.java, which I add in to the form, when I try to create new mail handler. But I can get parameters when I try to edit already existing incoming mail handler, in that time I see parameters in copyServiceSettings method. Do I need override some more methods of AbstractEditHandlerDetailsWebaction class or something else?   Unfortunately I can't add code of my  EditDemoHandlerDetailsWebAction class because message marked as spam( Any help will be very important, thanks.

1 answer

Hello,

Have you tried to add vm resource file in <actions> tag as described in the tutorial?

You need to add getter and setter methods in EditDemoHandlerDetailsWebAction class (assuming it is your action class) per each inputs in your vm file.

Hello. Here is part of my atlassian-plugin. xml where I add EditDemoHandlerDetailsWebAction class and editDemoHandlerDetails.vm

<webwork1 key="actions" name="UI" class="java.lang.Object">
<actions>
<action name="com.example.plugins.tutorial.jira.mailhandlerdemo.EditDemoHandlerDetailsWebAction"
alias="EditDemoHandlerDetails"
roles-required="admin">
<view name="input">/view/editDemoHandlerDetails.vm</view>
<view name="securitybreach">/secure/views/securitybreach.jsp</view>
</action>
</actions>
</webwork1>

 is that OK? 

Do you have editDemoHandlerDetails.vm in the right folder? And does your EditDemoHandlerDetailsWebAction class contain those fields' (in vm file) getter/setter?

editDemoHandlerDetails.vm is in src\main\resources\view\

Here's my vm file

## couple of available navigation helpers
#set ($modifierKey = $action.browserUtils.getModifierKey())
#set ($submitAccessKey = $i18n.getText('AUI.form.submit.button.accesskey'))
#set ($submitTitle = $i18n.getText('AUI.form.submit.button.tooltip', [$submitAccessKey, $modifierKey]))
#set ($cancelAccessKey = $i18n.getText('AUI.form.cancel.link.accesskey'))
#set ($cancelTitle = $i18n.getText('AUI.form.cancel.link.tooltip', [$cancelAccessKey, $modifierKey]))
<html>
<head>
<title>$action.handlerName</title>
</head>
<body>

<form class="aui" action="EditDemoHandlerDetails.jspa" method="POST" name="mailHandlerForm" id="mailHandlerForm">
<div class="form-body">
<h2>$action.handlerName</h2>
<span class="global-errors-location">
#if ($action.getHasErrorMessages())
#foreach ($error in $action.getFlushedErrorMessages())
#AUImessage("error" "" $textutils.htmlEncode(${error}) "" "" "" "true")
#end
#end
</span>
<input type="hidden" name="atl_token" value="$atl_token">
<label>$i18n.getText('demohandler.project')<input type="text" class="text" id="issue-key" name="issueKey" value="$!textutils.htmlEncode($issueKey)"></label>
<label>$i18n.getText('demohandler.issueType')<input type="text" class="text" id="issueType" name="issueType" value="$!textutils.htmlEncode($issueType)"></label>
<label><input type="text" class="text" id="reporterusername" name="reporterusername" value="$!textutils.htmlEncode($reporterusername)">$i18n.getText('demohandler.reporterusername')</label>
<label>CheckBox1 <input type="checkbox" name="checkBox"/>CheckBox222</label>

<div class="buttons-container form-footer">
<div class="buttons">
#if ($action.editing)
#set ($addButtonLabel = $i18n.getText('common.words.save'))
#else
#set ($addButtonLabel = $i18n.getText('common.forms.add'))
#end
<input id="addButton" type="submit" class="button" value="$!addButtonLabel" accesskey="$submitAccessKey" title="$submitTitle">
<a href="IncomingMailServers.jspa" class="cancel" accesskey="$cancelAccessKey" title="$cancelTitle">$i18n.getText("AUI.form.cancel.link.text")</a>
</div>

</div>
</div>
</form>
</body>
</html>

You mean, that I need add getter/setter for all inputs in vm file?

You can add input fields (text, radio, check, select) to this vm file and access them in your java file.

Also you can get pre-defined values in your vm file by $action.field 

And yes, you have to add getter/setter

Thanks a lot! I'll inform when i try

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

864 views 6 24
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you