Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Submit form to custom rest (POST)

Neta Elyakim
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Apr 04, 2018


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

Suggest an answer

Log in or Sign up to answer
0 votes
Gonchik Tsymzhitov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Sep 23, 2018



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 

AUG Leaders

Atlassian Community Events