Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Submit form to custom rest (POST)


I'm trying to submit an HTML form in JIRA dialog.

import groovy.transform.BaseScript


@BaseScript CustomEndpointDelegate delegate

showDialog(){ MultivaluedMap queryParams ->

    // get a reference to the current page...     def issuekey = queryParams.getFirst("issuekey")

    def dialog =
        """<section role="dialog" id="sr-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" aria-hidden="true" data-aui-remove-on-hide="true">
            <header class="aui-dialog2-header">
                <h2 class="aui-dialog2-header-main">Send comment</h2>
                <a class="aui-dialog2-header-close">
                    <span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
            <div class="aui-dialog2-content">
                <form action="http://localhost:8080/rest/scriptrunner/latest/custom/sendcomment" method="post" id="usrform" class="aui" enctype='application/json'>                 <fieldset>
                <textarea class="textarea" name="comment" id="textarea-id" placeholder="Your comment here..."></textarea>
                <input id='issuekey' type="hidden" name="issuekey" value='"""+issuekey+"""'>
                <div class="buttons">
                <input class="button submit" type="submit" value="Submit" id="comment-save-button">
            <footer class="aui-dialog2-footer">
                <div class="aui-dialog2-footer-actions">
                    <button id="dialog-close-button" class="aui-button aui-button-link">Close</button>
                <div class="aui-dialog2-footer-hint"></div>



The problem is that I get "XSRF check failed" error.

I even tried to just print a log from the custom rest but I it does not print to the logs.

I get this is the log error:

2018-04-04 11:58:54,477 http-nio-8080-exec-4 WARN admin 718x3452x1 jr3nl4 0:0:0:0:0:0:0:1 /rest/scriptrunner/latest/custom/sendcomment [] XSRF checks failed for request: http://localhost:8080/rest/scriptrunner/latest/custom/sendcomment , origin: http://localhost:8080 , referrer: http://localhost:8080/projects/STAR/issues/STAR-1

I saw that the solution it submit the form with JQuery but It's not recommended to add <script> tag to inline groovy code

add this to the post header- "X-Atlassian-Token", "nocheck"

Is anybody know a way to add it to the HTML code?


1 answer

0 votes



Have you implemented it?

But you can do it as ajax function 

like this 

$.ajax({    url: 'foo/bar',    headers: { 'X-Atlassian-Token': 'nocheck' }



Gonchik Tsymzhitov 

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira Service Management

Jira Service Management Documentation Opportunities

Hello everyone, Hope everyone is safe! A few months ago we posted an article sharing all the new articles and documentation that we, the AMER Jira Service Management team created. As mentioned ...

313 views 0 9
Join discussion

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