Comments
-
Pretty sure that you'd need to use the Fisheye REST API to get the latest changeset for a given repository. There's a couple of ways you might go about accessing it in a post function. One is to use the Groovy HTTPBuilder library. It does a lot of things for you automatically, like parsing XML responses. The main problem…
-
Since you're setting the assigneeId, you need to use the user key, not a user object. issue.assigneeId = issue.componentObjects[0]?.lead?.key ...then in the next block issue.assigneeId = QEAssigneeValue.key
-
Version Picker fields will return a VersionImpl object when the getValue method is called. The name property has the text that appears in JIRA, the id has the numeric ID as a Long. Use them as appropriate. Calling toString on it will coerce it to its name as a string. By the way, for comparing two version numbers, there's…
-
Right now, you're comparing the custom field objects themselves. You'll want to use FoundIn.getValue(issue) and ExistsIn.getValue(issue) to get the actual value of those fields. After that, checking for your pre-determined version ID should be pretty straightforward.
-
From this answer: https://answers.atlassian.com/questions/18812102 You can set the story points of the subtask in Additional Actions using the custom field manager. def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Story Points'}issue.setCustomFieldValue(cf, null) In this context, issue refers to…
-
Are you sure you've updated your scripts? getComponents returns a Collection<ProjectComponent>, not a string, so that test for equality will always return false, which might explain why it says it is running successfully, but not actually executing the script.
-
It's the it that's causing this, you say? As in the it variable that exists inside of a Groovy closure? That's one of the known limitations of the static type checker. The types of Closure parameters cannot be inferred. See https://scriptrunner.adaptavist.com/latest/jira/#_static_type_checking.
-
I updated the script in my answer with those method names and imports. You shouldn't need to import the watcherManager since you're getting it via ComponentAccessor, unless you do a type declaration.
-
@Tarun Sapra is almost there, though I think I'd use the method signature that doesn't take a Context parameter. Assuming your current code works, you could reuse it almost verbatim. import com.atlassian.jira.component.ComponentAccessordef watcherManager = ComponentAccessor.getWatcherManager()def userManager =…
-
That's deliberate. ScriptRunner automatically disables inline editing for fields that are marked as part of behaviours. The reason for this is that a behaviour can be complex enough that inline editing becomes unhelpful, even harmful in many use cases. Since inline editing can't make dependent fields editable, there's no…
-
Well, attaching the behaviour to the description field will seemed to make your script work, so... probably that's better than an initializer, for your use case? The initializers only run once when the form is loaded.
-
Odd. That script actually works for me. What version of JIRA and ScriptRunner are you using? Here's some quick screenshots of how I configured it. Maybe you need to adjust the mapping? Screen Shot 2016-09-07 at 1.33.10 PM.pngScreen Shot 2016-09-07 at 1.33.17 PM.png
-
Yup, that's how I'd do it. Sharing an implementation would certainly be cool of you.
-
Most of the APIs for interacting with custom project properties are in the com.atlassian.core.ofbiz.util package. The OFBizPropertyUtils class has a getPropertySet method (and more preferred getCachingPropertySet method) that retrieves those sort of values. I've yet to find an example for getting the GenericValue argument…
-
Another couple of thoughts: 1) Note that the setFieldOptions method can take a simple List of options; you shouldn't need to call .collectEntries at all. See https://scriptrunner.adaptavist.com/latest/jira/recipes/behaviours/restricting-priority-and-resolution.html 2) Where are you implementing this? If it's in an…
-
You could do this with a Scripted FIeld. Most of the real work is just doing some date math using Groovy/Java APIs. Programmer's warning: Date math is hard. Groovy helps make it a little easier, but I'm still naively assuming there are no holidays, sick days, or other days off in the mix that need to be skipped over, which…
-
As discussed, the Epic Link is actually its own separate custom field, distinct from regular links. As such, you'll need to clear it separately from the checkLinks closure. You can do both (set checkLink and clear the Epic Link), or just do the one that suits you in the Additional Actions section of a post function. To…
-
Given that your code is trying to setup the event handler, but doesn't run when the event should be firing, you might try using some different contexts besides alt.general. You might also investigate the AJS object and make sure it has a dialog2 property when the script runs. If it doesn't exist when your script runs,…
-
I noticed that there's a colon in your field name. Perhaps that is the issue? ScriptRunner simply isn't finding your field because you're not asking for it by its name.
-
They're both custom fields, but custom fields have types. What type of field is QA Story points? If QA Story Points is a scripted field, then ScriptRunner will try to infer its type based on the searcher. JIRA Software's Story Points field is a Number field. What type is QASP? Screen Shot 2016-12-07 at 2.35.16 PM.png
-
In the body of your Confluence REST endpoint method, you can use any valid Java/Groovy methods to call any external REST API, including those in JIRA. The Groovy HttpBuilder library is particularly handy for making web requests, and has a RESTClient class that makes rest operations pretty simple. Note that in most of the…
-
So, Vasiliy is almost there. What you could do is create a condition on your post function to determine if any of the subtask objects have the issue type you're concerned about. You'll have to hard-code it, since, as Thanos noted, the value of the drop-down field won't be available to the condition at runtime (at least,…
-
It's pretty straightforward to set the description on an issue. In your case, after you create the newSubTask variable as an issue, just use the .setDescription method (or Groovier yet .description=): newSubTask.description = """My MultilineDescriptionhere""" Since you're iterating through a list of summaries, you may need…
-
To expand on @Vasiliy Zverev's answer a bit, you could get the results of a JQL query in a console script, then iterate through the list of values to update them. import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.event.type.EventDispatchOptionimport…
-
Often, you can just input the field's name, all lowercased and without spaces. For example, the Story Points field: issueFunction in aggregateExpression("storypoints.max()") You can also use the custom field's unique ID, like: issueFunction in aggregateExpression("customfield_10113.average()") The custom field must be a…
-
I was able to get it to work on a test JIRA instance with a simple Text Field. My original regular expression included fields where that field was empty, but the following got just the issue where the field was nothing but whitespace characters: issueFunction in issueFieldMatch("", "Emptyable field", "^\\s+$") You might…
-
Quite right! Should have doubled the backslash. "^\\s*$" should mean "start of line, any amount of whitespace characters (including zero), then end of line". https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_issuefieldmatch
-
You could get these results using ScriptRunner for JIRA's issueFieldExactMatch script JQL Function. issuetype = Defect and ("External ID" is EMPTY OR issueFunction in issueFieldMatch("", "External ID", "^\\s*$")) The above would find any issues where the contents of the field was only whitespace, or the field was empty.…
-
The WorkLogManager can help you get the individual worklog items for a particular issue. Here's a rough example; you can fill in the blanks to match your use case. import groovy.time.TimeCategory//Get the relevant date range- a bit kludgy, I'll admitCalendar c = Calendar.getInstance()c.set(Calendar.DAY_OF_MONTH, 1)def…
-
So, for cases where updating the issue attributes isn't working, it's a good idea to try using the IssueService to perform the update. Per the note in the ScriptRunner docs, you normally need to update issue attributes before it gets stored in the database. You can only use this method to update issue attributes if your…