We have two post function on our workflow. The first creates a Initiative issue in the TECH project. The second creates an Epic in the REG project. As part of the post function to create the Epic, we are using the jmwe.last.issue.created property to set the Parent Link between the Epic and the Initiative. The Initiative is created as expected. when the post function attempts to create the Epic, an error is thrown stating the newly created Initiative can not be found. Am I not setting the post function correctly?
Hi,
This is actually odd. You might want to increase the delay on the second post-function to 5 second though, to give Jira time to finish creating the initiative.
Hi David,
I had the delay set at 5 seconds. I tried increasing the delay to 8 seconds and 10 seconds. At these delay levels, I still see the message that it can not find the Initiative and the Parent Link is not being set.
The Initiative and the Epic (when I am trying to set the Parent Link) are being created in 2 different projects. Could this be ab issue?
Jeanne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
CORRECTION:
I am still seeing the same error - can not find the Initiative
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looking in the log. There appears to be a space added to the custom field when it searches for the Initiative. Could this prevent JMWE from finding the Initiative?
I have verified the post function. There is no space in the post function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Good catch! That is indeed the problem. Jira does trim spaces around issue keys.
And I check your JMWE logs, and in fact you do have a leading space in your template for the value of the Initiative field:
>>> {{ issue | issueProperty("jmwe.last.issue.created")}}<<<
(I wrapped the code between >>> and <<< to make the space obvious)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Not sure if I should reopen this issue or create a new one.
We are currently migrating from Jira Cloud to Jira On-prem. How would I convert this code to work on-prem?
{{issue | issueProperty("jmwe.last.issue.created")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jeanne Howe
there is no direct equivalent on Jira Server, but for your requirement, you can use
transientVars.newIssue
which contains the issue created by the most recent Create Issue(s) post-function in the same transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
David,
How would I save this value so that I can use it to set the Parent Link in the Post Function?
Once I create the initial issue, I need to create two additional issues.
Each of these additional issues need to have the Parent Link field set to the key of the first issue I created.
I believe I should be using transientVars.newIssue?.key but I have not been successful in setting the value so I can re-use multiple times.
Jeanne
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Jeanne Howe ,
you can simply, in the "post-creation script", save the value in another property of transientVars:
transientVars.myParentIssue = transientVars.newIssue
and then use transientVars.myParentIssue in the subsequent create issue(s) post-functions.
An even easier solution is to use the first value of the transientVars.newIssues property in the subsequent Create issue(s) post-functions:
transientVars.newIssues[0]
since transientVars.newIssues accumulates all new issues created by any Create Issue(s) post-functions in the current transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.