Comments
-
That error is telling me that your "admin" user possibly doesn't have global admin permission. Make sure you supply an active user with the global admin permission in line 11. I don't work for either Atlassian or Adaptavist. So I'm not really in a position to provide more direct help. Answering questions here is not part…
-
Do you get any log outputs when the indexing is skipped? You can try to add a few additional log statement to try to get to the cause.
-
You can use either def issue = event.issue or def issue = event.issue as MutableIssue Both will work. The first one might show some static type checking errors, but those aren't usually fatal. They're only telling you that the code checker can't determine for sure what type of data it's going to receive. So it doesn't know…
-
This code is not checking for an event, it's defining what kind of event the update transaction should trigger. Both the IssueManager.updateIssue() method and IssueService.update() methods only allow a single EventDispatchOption You define which event to check for in the Listener configuration screen. This selection will…
-
Try something like this: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.type.EventDispatchOption import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.index.IssueIndexingService import com.atlassian.jira.util.ImportUtils def currentUser =…
-
This is a Json string: [ { "ItemiD": "ABC-ITEM", "weight": 10, "weightUnit": "KG" }] Here is how you would represent that in groovy: body = [ [ ItemId : "ABC-123", weight : 10, weightUnit: "KG" ] ] Note the square brackets. In groovy, you define an empty map (object in json) with [:] and an empty list/array with [] The…
-
It wasn't clear to me what type of field the User Name field was. So I assumed text. If it's a user picker, then you don't need to use the UserManager to get the user. The getFieldValue will return an application user. Then if the user is empty, it's not because it doesn't exist in Jira, it's because they user forgot to…
-
The condition may not run if an earlier condition in a group already made a determination (the first one failed in an AND group, or the first one passed in an OR group). For readability, I'd rewrite your condition like this: import com.atlassian.jira.component.ComponentAccessor def customFieldManager =…
-
You get the value from the issue object def groupName = issue.getCustomFieldValue(groupNameToAddCf) Then if you want to get a group object def groupObj = ComponentAccessor.groupManager.getGroup(groupName) Put all together: import com.atlassian.jira.component.ComponentAccessor def groupNameCf =…
-
You need to create an instance of the SimpleDateFormat So either def formattedDate = new SimpleDateFormat('YYYY-MM-20').format(new Date()) def jql = """issuetype = Bug AND created >= "$formattedDate" """ Or def formatter = new SimpleDateFormat('YYYY-MM-20) def formattedDate = formatter.format(new Date()) def jql =…
-
There is no "now" in groovy. You can do new Date().getMonth() + 1 +1 because the getMonth returns the zero-base month index You can also use: import java.text.SimpleDateFormat new SimpleDateFormat('M').format(new Date()) Or to get "09" import java.text.SimpleDateFormat new SimpleDateFormat('MM').format(new Date()) Or even…
-
Here is a short script to retrieve and update a filter: import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.search.SearchRequestManager def searchRequestManager = ComponentAccessor.getComponent(SearchRequestManager) def searchService…
-
I can help with a groovy script to modify a filter. But I'm not sure this business case necessarily requires it. If for example, you're interested in all issues created in the previous month you can use strict JQL with relative date functions: created > StartOfMonth(-1) and created < EndOfMonth(-1) Right now, this shows…
-
I should mention that I've not validated this with Jira 9. I'm still on Jira 8.13. But I don't expect any issues.
-
The "getSubTaskObjects" already returns a list of Issue objects. You don't need to extract the Id and retrieve the object again. Try this: import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.component.ComponentAccessor import…
-
Scriptrunner issue picker JQL does not support (to the best of my knowledge) any placeholder to reference the current issue. Any JQL you place there needs to be able to work exactly as is in a regular issue navigator screen. The only way to get only the issues linked to the current issue is to use dynamic JQL. Read more…
-
Many static type checking error can be ignored. That's just the editor's syntax checking telling you it can't be sure if this will work or not. Did you try run the code as is without commenting that line out? You might be able to make the error go away by telling the editor's syntax checking routine what to expect from…
-
Correct, this question was just about sorting and retrieving that last attachment object. Nothing was mentioned about retrieving the actual file content.
-
Are you suggesting concatenating ALL comments for a single issue into a single string to be placed in a single cell for a given issue? That could quickly exceed the size limit from just about any system that you might use to read that cell. But if you really need to, you could try something like this: import…
-
There was a typo in the first response. Make sure the declared variables in line 1 is spelled the same as the variable used in line 6 def linkedIssuesFld = getFieldById("issuelinks-issues") def linkInputFld = getFieldById(getFieldChanged()) def inputIssue = linkInputFld.value if(inputIssue){…
-
You could try something like this: def abcSubtaskFound = false if(issue.subTaskObjects){ abcSubtaskFound = issue.subTaskObjects.any{it.issueType.name == 'abc'} } Or as a oneliner: def abcSubtaskFound = issue.subTaskObjects && issue.subTaskObjects.any{it.issueType.name == 'abc'}
-
Because of your response to #5, my recommendation is to use a behavior script. This way, the Total field will be visible on create/edit screens, but in a read-only fashion and calculate in real time as you change either Field A or FieldB. The one CON to this option is that Field A and Field B will no longer be editable…
-
I prefer to use the "SearchService" to perform searches Try this bit of code: import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.web.bean.PagerFilter import groovy.xml.MarkupBuilder def searchService =…
-
I actually just accidentally came across: https://docs.atlassian.com/software/jira/docs/api/8.13.15/com/atlassian/jira/issue/link/DefaultIssueLinkManager.html#removeIssueLinksNoChangeItems-com.atlassian.jira.issue.Issue- But it won't help you with the creation part. And it removed ALL the issue links. As stated in the…
-
For a full script to be developed, you'll need to be a lot more explicit with your requirements. Where and when you want this to happen will have a pretty significant impact on how such a script would be implemented. Some preliminary questions: * Are all 3 fields "Number" fields? * Should Total be updated any time Field A…
-
I am not aware of a way to create issue links using lower level API that don't also create the history. You'd need to get into some pretty complexe "OfBizDelegator" methods. You can always go explore the source code for the DefaultIssueLinkManager class (you should have access to the jira source code from your license…
-
Creating an object is a lot more complicated than that. And you'll need to know the name of the attribute to set the label to (typically Name). Here is the simplest code I can figure out to create an object with a single required field. import com.atlassian.jira.component.ComponentAccessor import…
-
We have a mix of incidents/request types that are either fully customer-facing (traditional) or internal like you describe. We go the scriptrunner behaviour route. We have a single issue type "Technical Service Request" with a single workflow etc. But the first field in the create screen is: "Type of Request" (single…
-
Correct. The field must be optional in the field configuration if you want to use behaviour to conditionally make it visible/required or hidden/optional.
-
For anyone watching this... I encountered an infinite loop situation because my supplied closure was updating issues such that they disappeared from the JQL. I edited the code in the original post with a fix. The new version will process the issues in the search in reverse order. Also, there is an exit condition that will…