Comments
-
With regards to status type checking errors, those are not always indications of bad code. It's a failure of the editor/syntax checker to extrapolate and be able to guarantee that your code is 100% valid. In this case issue.fields.sprint.state It definitely knows what "issue" is and knows that "fields" is a valid…
-
I've adapted one of my scripts that does something similar. There are a number of deprecated methods in there, but for now, they still work. So it should do the trick for you. Define the spaces and groups on line 11 and 12. Comment out line 20 to run a test first and review the logs to make sure the actions are what you…
-
That is when the Reference Type in your attribute configuration comes in handy. The two attributes that point to Server should have different Reference Types. Then in the IQL (either type of solution), you can add a second argument to the inboundReference() function (abbreviated to inR() in my earlier response) in the IQL.…
-
You don't need behaviours for this. This is possible out of the box with Insight Custom field configuration. Try configuring your "CMDB - Server" as such: * Filter Scope (IQL): objectType=Server * Filter Issue Scope: object having inR(objectType=Application and Key in (${CMDB - Application${0}})) * Filter Assign Scope…
-
Have you looked through the scriptrunner library? This is a good resource for that kind of thing. Here is one I found for you: https://library.adaptavist.com/entity/dynamic-select
-
Yeah, that's a good idea. Didn't think/know about this event. That definitely seems the way to go. I can imagine there is a possibility of some concurrency issues though. If a user creates a filter, then the listener adds the group, meanwhile, the user is also trying to adjust the permissions immediately, I suppose there…
-
Not at all, I have several Asset Custom fields with complex cascading dependencies. Enough to give you a headache trying to understand what it does: (Customer IN (${Customer(s)${0}}) OR object having outR(objectType = Customer AND object having inR(objectType = "Customer" and Key IN (${Customer(s)${0}}),referenceType in…
-
Unfortunately, the only way I can think of, is to iterate over ALL of your filters, identify if the group has Edit permission, and if not, add it. That will be increasingly wasteful as you create more and more filters. The only option to find filters not shared to the group is to use a SQL query direct in the database.…
-
That use case is a little tricky. There isn't a good built-in way to check that ALL issues in the epic match your criteria. But I think you can do it with a creative combination (warning, this query can be very slow) issueFunction in epicsOf("status = 'To Do'") and NOT(issueFunction in epicsOf("status != 'To Do'")) You…
-
What filters are you hoping to receive with that line that's failing? There are a few things wrong with it, but I'm not sure what to suggest since I don't understand what it is trying to do. 1) you've defined an instance of the SearchRequestService class using the variable searchRequestService (notice the lowercase s).…
-
I would think you should be able to simply include "order by" in the JQL configuration of your issue picker field. But I tested it and it doesn't work. I don't think any of the customization options will let you affect the supplied list other than the JQL. So you might need to contact adaptavist support to suggest this as…
-
This is the domain of Scriptrunner Behavious. Do you have access to that app? If not, I'm not aware of any other way to conditionally show/hide a field like you suggested. If you have scriptrunner, then it's a simple matter of picking up changes in field A, then constructing an IQL query with the selected value (the IQL…
-
Correct, that's what this code is designed to do. If that's not working for you ( and you are on a server/dc instance) you will need to add some logging and review your jira logs to see what might be happening. For example: import com.atlassian.jira.bc.project.component.ProjectComponent import com.apache.log4j.Level…
-
That's because Confluence doesn't have a class called ComponentAccessor. You can't just translate Jira scriptrunner code for Confluence, they are very different at the java API level. Here is how you can get all the users in a group in confluence: import com.atlassian.sal.api.component.ComponentLocator import…
-
This would be possible with scriptrunner, but you'd need to inject some javascript that creates the hover content and the event to react to. That's pretty advanced stuff. Not out of the box.
-
Due to the dynamic nature that the Asset Custome field load the available options, Behaviours is not going to be able to interfere. The only thing you can do with Behaviours is to intercept the user's selection, place the form in an error state, and provide feedback to the user that the selection is invalid. You can't…
-
Automation is also available for Server/DC, you either need to get it as a separate app (or I think it might also be part of JSM). But it should also definitely be possible with groovy/scriptrunner. I have never liked working with the Calendar class. Here is how I would calculate those dates: def today = new Date() def…
-
There should be no issue accessing any of these packages. But there might be some that are hidden/inaccessible. For example, the class you mentioned is accessible (i.e. can be imported), but you can't construct it from scratch. There isn't a public service that will generate one of those object (that I'm aware of). Just…
-
If you paste your full script it might help. But from what I can see the main difference might be that in one, you use the project object and the other, the project key. Convert your project key to a project object and see how it goes. Remove "toString()" at the end of line 38
-
I don't think this will be possible in the cloud. It is possible for on-premise versions of scriptrunner.
-
There are no built-in or scriptrunner methods for controlling this. At best, you can use scriptrunner and groovy to identify whether you should limit the list or not, and when you establish that yes, this is the correct context for limiting the groups, then you would inject some Javascript into the page using a…
-
Owner is "Jira user" field? You can't "drill into" non-asset fields. So the short question is no, I don't think that's possible. You could replicate your users as objects with one of the attribute being "jira account" that actually link the object to the associated user. That will give you much more flexibility. The…
-
It appears that the code editor/code checker is losing track of what "organizationResults" is or should be. So it can't verify that "name" is valid. Then all the rest follows. If static type-checking errors bother you (they are a tool for the developer, not a guarantee that your code is bad), you can force the matter by…
-
Don't make the "WorkingIssue" field in your class "static". Static means that this is applicable to the blueprint rather than a specific instance. When it's static, all instances of that class will have the same value and it will change for all instances each time to set the value. Also, it is against java conventions to…
-
You can't use the "create sub task" built-in script to create multiple subtasks. You'll have to use a "Custom scripted listener" and build the sub-tasks yourself. You'll have to loop through all the selected options in the checkbox field and create sub-tasks in that loop.
-
With the release and expansion of HAPI, this utility is probably not really needed (though I haven't made the switch myself yet). But to answer @David Harkins In my testing just now, a single string group name or a collection of string group names both work (at least in my local implementation). It's been a little while…
-
You should be able to write a short groovy script to go through all issues that have a value in your Elements Connect fields and replace the team name with the team id. I have never used Elements Connect field, so I can't provide details about that.
-
There is now a simpler way to get the baseUrl. Rather than fetching the jira application property by key (which requires an extra import), you can get it directly using a designated method: def baseUrl = ComponentAccessor.applicationProperties.jiraBaseUrl
-
@Joel Batac I'm not a fan of using oauth in scripts. OAuth works well when you want to authorize a custom app to act on behalf of a user. Normally, the source app will direct the user to the target app to authorize the access, then return back to the source app to initiate the real communication. But in most cases I've…
-
Change this line to change how you define the "last sprint": return sprints.last().endDate //return the endDate of the sprint, the max will find the last one You can try sorting by "sequence" Then change the last line to define what you want to return from the last sprint. For example: sprints.last().name //return the…