Comments
-
You need an issue or issue context to call "getRelevantConfig" since a config/context in a custom field can be mapped to a projects and/or issue type. import com.atlassian.jira.issue.context.IssueContextImpl def context = new IssueContextImpl(project, issueType) def fieldConfig =…
-
You can get to each fields using the getFieldScreen method that's built into behaviours. something like getFieldScreen().tabs.each { tab -> tab.fieldScreenLayoutItems.each { field -> getFieldById(field).setReadOnly(true) } } Or as a one-liner fieldScreen.tabs*.fieldScreenLayoutItems*.each{getFieldById(it.fieldId).readOnly…
-
You weren't too far off. Cascading selects return an ArrayList or String values for the selected option. The first item in the list is the first element in the cascade, and the second item in the list would be the second element. But with behaviour, you can only fire a script when the first element changes. Changing the…
-
Doing a bit of digging for older unanswered questions and found this one... Behaviours can't "expose" a field ... you have to add the Reason field to your edit (or transition) screens first. Then, you can use behaviours to hide the Reason field by default, but run a script when the Due Date is changed that will trigger the…
-
I'm not going to post a separate response because I think Antoine was essentially correct, but I though you might appreciate a second perspective. import com.onresolve.jira.groovy.user.FieldBehaviours import groovy.transform.BaseScript @BaseScript FieldBehaviours fieldBehaviours def vgFld =…
-
Hi @Szymon Trocha I have 4 observations about your question. First, "Static Type Checking Errors" do not necessarily show stoppers. Groovy by design can be dynamically typed or strongly typed. The downside of relying on dynamic typing is the occasional inability of some parsers to detect the correct type inference to…
-
This import ... import CreateMultipleSubtasks.Configuration_CreateMultipleSubtasks ... implies that your class file is stored in a path like <jira-home>/scripts/CreateMultipleSubtasks/Configuration_CreateMultipleSubtasks.groovy Is that correct? If not, then adjust the classpath to match the file path. Also, be sure to…
-
You can access epic linkages from the IssueLinkManager. For that, you need the EpicLinkManager Try this: import com.atlassian.jira.component.ComponentAccessor import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean import com.onresolve.scriptrunner.runner.customisers.WithPlugin import…
-
That "lastComment" variable is there as a simple convenience. I don't think it's intended for such edge cases. Generally, the intent is to just include the comment that was just entered as part of the transition. Check out the documentation One variable I see that's not in the documentation is "comments" which should be a…
-
Just replace "Contains" with "Hierarchy link (WBSGantt)" in the script and if should do what you want.
-
Service Desk Request type? Or did you mean issue type? And do you mean only validate linked issues if the current issue is of a specific type? Or only prevent closing the current issue if linked issues of a specific type are still open (ignore the status of other linked issues)?
-
If you want to include only active user, you can pass an additional parameter to the getUsersInGroup method to tell it to exclude inactive users. But here is a simplified and somewhat cleaned-up version of your script: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.issue.IssueEvent…
-
Can you include your complete script as it currently stands? Also, a screenshot of the "Issue Linking" page showing your "contains" link type. I need to see all 3 elements: "Name", "Outward Description" "Inward Description"
-
That statement refers to the "in-line" edit functionality where you over over a field in the issue view and click on the pencil icon. In this case, clicking that icon opens the full edit screen instead of activating the in-line edit mode. Adding a flag via the add-flag functionality is not prevented. Same with bulk edits…
-
Ah yes, nice catch on my typo.
-
I think this is expected given the documented behaviour limitations. You can't control whether a field is visible or not on the view screen. Also, presumably, the newly unhidden field would be empty after first adding a flag. Empty fields by default are never displayed in the view screen (which is what you see in the…
-
I was wrong about the way "getOutwardIssue" works... you need to provide the name of the link type, not the outward description. For example, I have a link type called "Requires". The outward description reads "requires" and the inward reads "is required by". So in my case, I can return the issues with…
-
I like to use the helptext for debugging behaviours Add this to your script: field.setHelpText("$fieldValue (${fieldValue.getClass() - ${(fieldValue instanceof List) ? fieldValue[0].getClass() : ''})") This will give you some clues as to what kind of data you are dealing with for each situation. This should show you that…
-
Something like this should work: import com.atlassian.jira.component.ComponentAccessor def linkMgr = ComponentAccessor.issueLinkManager linkMgr.getLinkCollectionOverrideSecurity(issue).getOutwardIssues('is contained in').every{it.resolution}
-
Behaviours are evaluated every time a screen dialog is open. That's true for Create screen, Edit screen or any transition screens. Workflow Validators fire when you submit a transition form (or immediately if no screens are associated with the transition). It's possible to use getActionName() in your behaviour to see if…
-
In my experience, the URL is not available for fragment conditions in Scriptrunner. The only variable in the binding is DefaultWebInterfaceContext But depending on what kind of fragment you are trying to implement, it might be available elsewhere. For example, in a "Show Web Panel", in the Provider class/Script, you can…
-
Under the covers, the code you write with Scriptrunner in groovy consist of Java code. And in groovy just as in java, you can only interact with object classes that have been imported into the current context. A class must already exist and be available within the class loader context before it can be explicitly imported…
-
You can create a scriptrunner script field using the "Custom Picker" option. Using the "Show Snippet", I grabbed the example for Version picker, and converted the suggested configuration code to make it work as a project picker: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.project.Project…
-
Define a variable outside of the request to hold your url. While in the request, after updating the uri (instance of groovyx.net.http.UriBuilder) with path and or query, load the fullUri variable so you can examine it after the request is complete. But I think I see where you have an error. You don't want to include the…
-
This is the expected behavior. Behaviours can't execute based on In-line edits. Historically, in-line edits were always disabled and attempting to in-line edit would cause the full edit screen to open so that the Behaviour logic could execute as expected. The setAllowInlineEdit was added at some point to bypass that…
-
A simple scripted condition should work for you: cfValues['Environment'].value == 'QA2' && cfValues['Test Phase'].value == 'Hot Fix' Regardless of the manner in which those fields might get updated, if the correct value is in place, the transition button will appear. Otherwise, there will be no button.
-
I've often wondered too. That's a shame. That would make upgrades so much simpler. The best alternative I've found is to follow some of the steps for the Zero Downtime Upgrade (even if you are on Server or DC with a single node):…
-
Let me see if I understand... You are trying to have an issue picker field where the list of issues to pick from is diminished each time a ticket is created that links to one of those issues. Let's say you have 5 issues that match the JQL to pick from: AA-1, AA-2, AA-3, AA-4, AA-5 If I create and issue and pick AA-1, the…
-
I didn't have any sample code, but a quick search through the JavaDoc and I think you'll want to use the FieldLayoutManager to find the Field Layout (called field config in the UI) you want to modify. Then obtain a FieldLayoutItem for the field you want to make required. Then convert the FieldLayout into an…
-
It's not about your own personal permissions. def adminUserName = 'admin' def currentUser = ComponentAccessor.jiraAuthenticationContext.loggedInUser def adminUser = ComponentAccessor.userManager.getUserByName(adminUserName) ComponentAccessor.jiraAuthenticationContext.loggedInUser = adminUser These lines will change who the…