Comments
-
In scriptrunner for jira server/datacenter, the scriptrunner console has access to the underlying operating system. With that, you can access files directly, and issue any os commands. That's what the "string".execute() method does. It rune the string command by the OS. In cloud, that's not possible for various security…
-
What repositories have you defined in your pom? I have: <repository> <id>adaptavist-external</id> <url>https://nexus.adaptavist.com/content/repositories/external</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> <checksumPolicy>fail</checksumPolicy> </releases> </repository>…
-
It is still not possible to set permissions on a per-object basis. You can grant edit access to an entire Object Type (all records/objects in that object type are editable) or an entire Schema (all object types). The workaround that people usually employ is to create an issue type that's linked to the object type you want…
-
I forgot to include the link to the GroupWithAttributes Javadoc. In all cases I shared, you define the properties/attributes you want to store yourself. These are completely custom. I find the best way to explore what properties have already been defined by the system or by other plugins is to use the database. In the case…
-
I think this shows all the attributes across all object types in the current schemas. But only the first 5 items (alphabetically) are displayed. If your IQL points to another schema, you might be out of luck and will need to raise a support issue.
-
I think there are 3 choices. I'm most familiar with OfBizPropertyUtils: that stores values in propertyentry and propertytext tables (at least for jira): import com.atlassian.jira.component.ComponentAccessor import com.atlassian.core.ofbiz.util.OFBizPropertyUtils import groovy.json.JsonBuilder import groovy.json.JsonSlurper…
-
fieldChanged is a string that already represents the fieldId. So you can use it like this: getFieldById(fieldChanged). Then, you cna use the resulting formField object and access it's fieldId property. But you can't access fieldChanged.fieldId since fieldChanged is a string and it won't have any properties to access. You…
-
Does the missing issue appear in the filter if you re-index the project? If so, it means you have some automation somewhere that is not correctly re-indexing the issue after making a change. Since you posted this in the "Adaptavist" topic I'm guessing it would be a groovy script that uses the IssueManager to create or…
-
I've been hesitant to share my experience here in case others would choose to skip reviewing questions with at least one answer. I've tried long and hard to find this answer as well. I searched through all the insight javadocs for some way to instantiate a CustomFieldCOnnectBean without any luck. I've also tried to get at…
-
Here is a shortcut you might appreciate to filter based on event type rather than getting and using the eventTypeManager import com.atlassian.jira.event.type.EventType if( event.eventTypeId == EventType.ISSUE_CREATED_ID && event.issue.dueDate){ // Skip this listener if the due date is set on creation return } You still get…
-
Have a look at this script that combines both concepts along with an additional trick of only running when the change contains an actual update to the sprint field. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.issue.IssueEvent import com.atlassian.greenhopper.service.sprint.Sprint…
-
That script is for Server/Datacenter. OP is looking for cloud version. @Nikola Nedoklanov FYI, not sure if you'd seen the original post.
-
I haven't tested but perhaps combining the two into one using some simple logic gates to not create new comment if the triggering comment starts with text we recognize might work: import com.atlassian.jira.component.ComponentAccessor def commentManager = ComponentAccessor.commentManager def PREFIX_SUBTASK = "Comment from…
-
Here is the new method for getting and executing a built-in script: import com.onresolve.scriptrunner.canned.jira.admin.JiraClearCaches import com.onresolve.scriptrunner.runner.ScriptRunnerImpl def clearCaches = ScriptRunnerImpl.scriptRunner.createBean(JiraClearCaches) clearCaches.doScript(["FIELD_WHICH_CACHE":"gcl"])
-
I don't think it's possible to access a nested class that is nested inside a script. The nested class would only be available from inside the script itself. So if you want your nested class to be available to other scripts, then it must be nested inside a proper groovy glass.
-
That's an interesting validation that I wasn't aware could happen. Then the next solution is retire the issueService for that script and instead user issueManager.updateIssue() followed by re-indexing step. This will still give your the issue history.
-
Try to see if there is anything in this answer that helps: https://community.atlassian.com/t5/Jira-Software-questions/ScriptRunner-Script-Roots/qaq-p/1860856
-
You can trigger anything that has some web API with Scriptrunner. But I'm not familiar with azure pipeline releases. There is probably a similar community forum for that project where you can ask how the APIs work. But from the Scriptrunner's point of view, you will have to identify what you want your jira trigger will be.…
-
Could your project context fall into more than one behavior mappings? Check for "All Projects" or "All Request Types" in addition to any that are specific to your project/request type. When you have more than one behaviour mapping and both touch the same field, there is no guarantee of which one will win. If that's the…
-
I agree, it doesn't make much sense for the update to fail because the reporter is no longer active. But looking at the script, I wonder how it ever worked. I'm assuming this script is in the "Additional Actions" in an Escalation Job configuration? Is there a transition selected in the configuration? It's possible that…
-
Just to confirm: Sales Request Type => only show "Purchase" and "Return" component in the list All other request type => Hide "Purchase" and "Return" components from the list You could just add all your other request types here: Map validComponentNamesByRequestType = [ "Sales": ["Purchase", "Return"], "Tech Support":…
-
The script will not work in the Script Console. In a simple scripted validator script editor window, there will be some built-in variables and objects (you can see which by clicking the question mark below the editor). issue and cfValues is two of those variables. These variable are not available in the console since it's…
-
If you want to import a class into another script, the script file has to match the class name. So try to rename update.groovy to Generator.groovy Then you will be able to import sidebar.Generator Generator gen = new Generator() gen.collectData(...) I see that your collectData method is static, this means you don't need to…
-
Here is a similar script for copying comments from the parent to each subtasks: import com.atlassian.jira.component.ComponentAccessor def commentManager = ComponentAccessor.commentManager if(event.issue.subTaskObjects && event.comment){ event.issue.subTaskObjects.each { subtask -> def newCommnet = commentManager.create(…
-
If you change the Status name from inside the workflow editor it will change that status EVERYWHERE including any other workflows that use this status. Existing filters and dashboards that point to x will break until you manually rewrite them to point to y. Do this VERY carefully. In most cases in a large instance with…
-
* Where is "comps" on the line "for (c in comps)" coming from? That variable is not defined anywhere. * Suff appears to be surrounded by invalid quotes. Maybe this happened when you copied here. Or maybe this happened because you edited the script in a word processor rather than a code editor. Make sure you use either ' or…
-
There is no built-in clear form option in scriptrunner. You have to either hard code each field to clear, or you can clear every field systematically with a loop: I haven't tried, but something like this might work: def agreementFld = getFieldByName('Agreement') if (agreementFld.value == 'New') { fieldScreen.tabs.each {…
-
The link you posted appears to be for Cloud version. The server/datacenter version of the same page appears to be https://confluence.atlassian.com/servicemanagementserver/post-functions-1044784443.html In this one, there is no mention of allowing multiple. You can attempt comma-separated values. If that doesn't work,…
-
If you want to have a groovy code running on an environment to make a request to itself (i.e. same server/instance), you can use the "TrustedRequestFactory" Here is a sample script that makes use of that: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.config.properties.APKeys import…
-
What version of Jira/JSM do you have? I think this option was released in 4.19.x