I have a web fragment that creates a constrained issue. I have a behaviour that uses the id of the fragment to add the source issue as a linked issue. I began this using https://scriptrunner.adaptavist.com/latest/jira/fragments/CreateConstrainedIssue.html as an example.
Here is the current code of the behaviour (basically just modifying a custom field right now so I can see what is happening):
import static com.atlassian.jira.issue.IssueFieldConstants.*
@BaseScript FieldBehaviours fieldBehaviours
ComponentManager componentManager = ComponentManager.getInstance()
def issueManager = ComponentAccessor.getIssueManager()
//Check to make sure this is the correct context for the behaviour.
def myValue = getBehaviourContextId()
def myIssue = getContextIssueId()
getFieldByName("Customer Cross-Reference Number").setFormValue("Another Value: " + myValue + "|" + myIssue)
If the button created by the web fragment is at the "top" of the menu (always visible without pressing the "more" button), the behaviour is able to use the ID and execute its logic (in the case of the above code, this displays the ID of the web fragment after the words "Another Value" in a custom field). If the button is under the "more" drop-down, then the ID becomes null and is unusable (two nulls appear in the custom field after the words "Another Value").
After further experimentation, it looks like when the button appears at the top of the menu, the create screen appears as a "floating" form. However, when the button is lower in the "more" menu, the create screen becomes a separate page. The logic for the button is identical in either case, so I'm kind of tearing my hair out here...
Would anyone be able to assist? I'm open to alternative options for issue linking or some "workaround" that allows my buttons to work as expected.
The workaround works for the initialization portion of Behaviours (so the create window automatically sets a linked issue :) )
(To replicate the issue, use the workaround to create a "create constrained issue" button that opens the create form according to the examples provided by Adaptivist. After doing this, comment out the line that disables the issue type button and change the issue type. This leaves the text box values untouched but empties the "linked issue" field. Setting up a "server-side" script that similarly works off the getBehaviourContextId() will never do anything because getBehaviourContextId() will evaluate to null by that point.)
According to the bug report linked above, this has been fixed in 7.13.1.
I have that version installed in our production and test environments, but I have not yet tested it. I will respond here once I have. (this is lower priority for my users, so other things have taken my time instead)
This month the spotlight is on AppLiger. We caught up with Pavel Pavlovsky, CEO and Product Manager, to learn how the company started and what fuels the team's creativity. Atlassian:...
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