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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Append XSRF token to a Script Fragment Link? Edited

Our dev team is tired of copying data from a parent item to a sub-task every time they create one. I have introduced a new transiton that creates the subtask and copies a set of data elements in the process. This works well but, of course, the transiton button appears in the available transition list. The team would like this transition to appear in the More actions dropdown - specifically, it should replace the normal Create sub-task option in the operations-subtask area.

I have added a scriptrunner fragment that removes the native create sub-task option and a second one to introduce the new option. This custom web item fragment has a "Do What" option of "Navigate to Link". The Link is set to 

/secure/WorkflowUIDispatcher.jspa?id=${issue.id}&action=901

where 901 is the new transition that I'd like run. 

This all works well with the exception of a missing XSRF security token error. If i append &atl_token=mysecuritytoken into the link, the operation works perfectly. 

Is there any option to append the user's token in the above link string?  

2 answers

1 accepted

0 votes
Answer accepted

The support desk at Adaptavist give me this link to the Form Token Handling article on Atlassian's site.

Appending &atl_token=${atl_token} to my above link worked perfectly and was exactly what i was looking for. 

One caveat if you are calling transitions this way is that any screens you may have will not appear in a modal but rather full screen. A minor difference that isnt a deal breaker for me. 

XSRF token is typically in cookies as part of http requests - haven't had a need to generate one myself with Java API yet but this looks promising https://docs.atlassian.com/software/jira/docs/api/8.5.8/com/atlassian/jira/security/xsrf/SimpleXsrfTokenGenerator.html

What comes to mind is..

 - either generate a new token and use it (if it will be valid and work)

 - get the user's xsrf token from the HttpRequest when they open the issue view

 - disable the xsrf token check altogether (via a header passed in the http request)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

4,546 views 12 8
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