Comments
-
Something like this or derived from it should get you what you want (or close): import com.atlassian.jira.component.ComponentAccessor ComponentAccessor.globalPermissionManager.getAllGlobalPermissions().collect{gp-> def groups = ComponentAccessor.globalPermissionManager.getGroupNamesWithPermission(gp.globalPermissionKey)…
-
You can either escape the \ or change the type of groovy string. The dollar-slashy string is perfect for this use case: (also, I had an error in the script where I called the command string "cmd" but then tried to execute as if I had called it "command" Here it is fully corrected def cmd = $/curl --location --request POST…
-
This may help: https://docs.adaptavist.com/sr4js/6.29.0/get-help/frequently-asked-questions/script-roots-faqs
-
My apologies, I had a few errors in the code. But also, not all static type-checking errors are bad. Sometimes they can be ignored. Try this: import com.atlassian.jira.component.ComponentAccessor def issuePickerFld = getFieldById(fieldChanged) def issueSummaryFld = getFieldByName("Parent Issue Summary") // <-- adjust for…
-
Create a scriptrunner behaviour mapped to your project/issuetype. Add your issue picker field to the configuration. Then add a server-side script: import com.atlassian.jira.component.ComponentAccessor def issuePickerFld = getFieldById(fieldChanged) def issueSummaryFld = getFieldByName("Parent Issue Summary") // <-- adjust…
-
I'm expecting to have to do something similar soon... so I took some time to figure out how to do it. Base on the labelManager javadoc I can see that we need to specify a "labelable" opbject and a label. The Labelable javadoc shows that SpaceDescription is of of the implementing classes. And Space javadoc shows that it has…
-
Yeah, the simple scripted condition will hide the button completely. If you're looking to validate the input, then the simple scripted validator or the custom validator will give you what you're looking for. The simple scripted validator will only allow you to display a single message against a single field (or at the top…
-
We can address the static type checking error by importing the class ApplicationUser import com.atlassian.jira.user.ApplicationUser Then declaring the nextAssginee using that class instead of def ApplicationUser nextAssignee This highlighted something that I missed... when no issues are returned in the jql, we must still…
-
If you're looking to provide input to your REST endpoint and your script, then you will have to follow some of the instructions in that adaptavist documentation page under Dialogs (Advanced) section. Your dialog will include the form and input field you want the users to fill in. The form button will have to have some…
-
Your issue might be just with the "def myCustomField" line. If you look carefully, you will see that you are calling "getCustomFieldObjectsByName", the plural on "Objects" means that you can potentially get more than one custom field with this method. Even when you only have 1 custom field that matches that name, you will…
-
Hi You could execute the curl command as a shell command using the "execute()" method available on groovy strings. def cmd = """curl --location --request POST 'https://XXXX.XXXX.com:443/api/1/rest/slsched/feed/XXXXXXXXXX/projects/SXXXXXX%20xxxxx/JIRA-Access-TEST%20Task' \ --header 'Authorization: Bearer…
-
There are some examples here: https://docs.adaptavist.com/sr4js/6.24.0/features/script-fragments/custom-fragments/web-item
-
Yes, your button will have to be linked to a scriptrunner custom REST endpoint and that endpoint will run your code. The easiest option is to select "run code and show a flag" in your web item fragment, then your rest endpoint just has to return a flag map to show the result of running your script. Of course, you could…
-
The reason you are getting the error is that you are mixing ApplicationUser entities with Strings of usernames. So try to give you variable some names that indicate what they carry. Like: def userNames = ["user1","user2","user2","user3","user4","user5", "user6","user7","user8","user9","user10"] def nextAssignee…
-
If you want to stick within the world of scriptrunner, this is easy to accomplish with the scriptrunner simple-scripted condition (very similar to the jmwe) cfValues['Related Issue']?.status?.name == "Done" If your related issues allow multiple, then you would do it like this cfValues['Related…
-
It appears that LinkedIssue list is statically typed to a an List (java) rather than a Collection (groovy), so the groovy collection methods are not supported. So the solution is to transform the linkedIssue list into a goovy collection and then sort that: def allOutIssues =…
-
Sorry... my bad. I obviously didn't test it before posting. You just need to get the destination issue object before getting the sprint field value. Replace that failing line with: (linkedIssue.destinationObject.getCustomFieldValue(sprintCf) as ArrayList<Sprint>).last().startDate
-
If you are just trying to get the workflow name for a specific issue type, you can get that directly from the workflowSchemeManager wfSchemeManager.getWorkflowName(project, issuetype.id) Otherwise, to get the workflowScheme name for a project, you should be able to get that directly from the scheme object:…
-
You can try adding some debug messages to the "additional issue actions" and try to figure out why this wasn't working for you. Try with the code below and then look at the resulting logs: Note: This was initially posted before scriptunner started deprecating the built-in customFieldManager. The code before will should the…
-
I tend to just clear the groovy cache as I don't have the same JQL dependency you describe. But frequent change to a class file should only happen in a dev/test environment where you shouldn't care about this dependency, and only when doing the final deployment to prod would you need to rescan your JQL. Maybe someone has a…
-
Using the SDK, I installed 4.17.1and 4.18.0 and was able to replicate this. I tried to see if I could use import com.atlassian.sal.api.net.RequestFactory to generate a basic request, but I can't seem to correctly instantiate that from Insight Groovy. I have no problem in scriptrunner using the @PluginModule notation but I…
-
Hi @Vikrant Yadav fld.value.size() can be either 0, 1, or 2 * fld.value.size()==0 //this means both values are "none" * fld.value.size()==1 //this means only parent level is selected * fld.value.size()==2 //this mean both level are selected Then, you use [0] or [1] to access either the first or second value. But attempting…
-
If you are not actually setting default values in the same script, you don't need to bring in the optionsManager or anything after that. Here is a full script that shows how you can work with cascading select: def fld = getFieldById(fieldChanged) def parentValue = 'Something special' if(!fld.value){…
-
Thanks for the heads up... I'll be sure to check the impact in our environment. Have you tried using grapes to import the library in your environment? Add this to your insight groovy script: @Grapes( @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1') )
-
This seems like something you should report to productsupport.adaptavist.com/servicedesk But if you don't want to wait for a fix, you can create a simple scripted validator instead:
-
You can use the groovy sort method on any collection using a closure import com.onresolve.scriptrunner.runner.customisers.WithPlugin @WithPlugin("com.pyxis.greenhopper.jira") import com.atlassian.greenhopper.customfield.sprint.SprintCFType import com.atlassian.greenhopper.service.sprint.Sprint List<IssueLink>…
-
I don't think you need to worry about timestamp and calendar classes. Just use the built-in java dates. def dueDate = new Date()+dateToSet def dueDateTimestamp = dueDate.toTimestamp()
-
There are several issues with this script (or you didn't give us all of it)... it might be easier to start over. What's the trigger here? Are we talking about the workflow transition on the Epic itself? Or transition on all the issues in the epic? If it's the transition in the epic (e.g. prevent closing the epic if the…
-
Cascading select field is a single entity. It's not 2 field. From a data perspective, selecting a second-level value or not makes no difference... there is still data in the field. In fact, there are some very valid business case for requiring a first-level value only. I understand that the ability to have the "set…
-
I don't have a ready-to-test remote issue picker field but I would recommend you examine your browser developer tools for what the payload looks like when you create an issue that has such links in the web app. You should be able to use the same format when creating an issue with the Rest API.