Comments
-
With query:true, the behavior will automatically append &query=[letters typed by user] to the rest API call. You can't change that name on the rest endpoint. So change def queryX = queryParams.getFirst("city") as String To def queryX = queryParams.getFirst("query") as String BUT, I have never tried to pass additional…
-
Additionally, what helps me in those cases, if I'm not sure what type of object a scriptrunner binding might contain (and it's hard to document as it will depend), is to examine the class name and look up the documentation or examine the full list of methods to see which might be appropriate. You can try some debug…
-
cfValues['Project Version'] will return an object of the type that corresponds to the type of field. For a single select, it would be an Option. But for a version picker, then it would be a Version And for version, the "getValue()" method is invalid. The reason why 'CURRENT' in cfValues['Project Version']*.name does work…
-
For one... let's start by simplifying Start by abstracting your field option from your action logic (think about being able to easily modify the fields or options. Then just iterate through and take the same action on each option. def fieldOptionMap= [ "SN (1)":["1","2","3","4","5","6","7","8","9","10"], "SN…
-
Yeah, sorry, I wrote it one way then changed some variable name to match your case and forgot one. This is what I meant to post (changed line 6 instead of 4): import com.atlassian.jira.component.ComponentAccessor def customFieldManager = ComponentAccessor.customFieldManager def checkBoxId = 123456 def checkBoxFieldObject =…
-
Checkbox fields are represented as an array of options. Just like a multi-select field. Each option represents a separate checkbox. So you can look for if a box is checked with: cfValues['Check box field name']*.value.contains('checkBox Value') If you want to access fields by their ID, then you can't use the cfValues (this…
-
With Scriptrunner behavior, you can display a red error message just below the checkbox field as soon as the checkbox is clicked. The tricky thing may be to decide how this script should behave (if at all) when an issue where it was previously checked is opened and the JQL query results now have a value. If you only need…
-
I don't see a mistake with this. Here is what I see when i do the same: * This is the target page: * This is the macro preview: * When you look a the code behind the preview (chrome developer panel):
-
Looks like the query parser doesn't like the JQL that we generate. Let's try to add some debug message. import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.issue.Issue def user =…
-
Not sure where to go from here... I copied your script exactly and all I changed was the project key in the jql... and that works for me.
-
Can you paste your full script? I have this working on 7.13.2 and 8.3.2 But I had to make a quick change, make sure the "def user=" line is above the "def jql=" line.
-
What version of Jira are you using?
-
Try def jql= "project = 123 and reporter = $issue.reporter.name and resolution is empty" BTW, if you want to include a more complex method with parens like "getEmailAddress()" you have to enclose the expression in curly brace. What happens is the that $simple.expression or ${complex.getExpression()} ins the Gstring will be…
-
This script should work for that: import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.jql.parser.JqlQueryParser def jql= "project = $issue.projectObject.key and reporter = $user.name and resolution is empty" def user =…
-
I see you've updated from the deprecated getCustomFieldObjectByName (singular) to use the new "getCustomFieldObjectsByName" (plural). This new method returns a list, not a single custom field. So maybe try: def parentLink = customFieldManager.getCustomFieldObjectsByName('Parent Link')[0] def customFieldValue =…
-
I've found 2 ways. 1) change to use com.atlassian.jira.bc.issue.search.SearchService instead of SearchProvider import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.bc.issue.search.SearchService import com.atlassian.jira.jql.parser.JqlQueryParser import com.atlassian.jira.web.bean.PagerFilter…
-
You have to do this from the Custom Field page in Jira. There is a shortcut from the scripted field list screen.
-
Sorry... not much experience yet with scriptrunner and JSD. No I have no idea here.
-
Are those two fields custom scripted fields? If so, just change the "searcher" for those custom fields to "Date Time Range Picker"
-
This shows that the error is on line 80 of your initialiser script. So not coming from what I gave you.
-
Static type checking errors are for information only. The true test is to look at the log when you run the code.
-
convertSingleSelect and setFormValue don't seem to be able to work on the same field. The only workaround I've found is to, instead of using ajaxOptions, you can either call your rest enpoint from the behavior script or gather the option values directly from groovy then add them to the converted field. In this case, the…
-
Yes, you will see this in the scriptrunner script editor because issueContext is dynamic and the editor can't determine the class for sure. But it will work when the code runs (only when the issue exists).
-
Can you share some sample code around how you are calling that GET method in the other API? But if you are just trying to make a string of names with OR as separators: "${resp.persons.collect{it.core.firstName}.join(' OR ')}"
-
I tried your script (minus the executorThread) in my environment script console with a test project (contains 1 issue) and it worked. Look in the Audit Log and see who the Author of the changes is. Then perhaps using the built-in script to change the active user to that user and try the built-in copy project script as that…
-
I re-created your json in a map object with only the pertinent information for testing def resp = [ noOfRecords:2, apiVersion:"3.0", persons:[ [core:[firstName:"name1"]], [core:[firstName:"name2"]] ] ] Then, I can get this correctly formatted output like this: def query = "2" //as an example search criteria entered by the…
-
In your behavior configuration, add (using the drop-down at the bottom) each of the fields you want your script to impact. You don't need to configure anything on each of those fields. When a field is listed like that, then the "inline edits" are disabled. If you click on the edit button for the field, the full edit screen…
-
I think you pretty much have to get the storage value and parse the XML and find the macro with <ac:structured-macro ac:name="section"> Then look at the text inside <ac:rich-text-body>
-
I am not sure if there is a way to find the version. But you could just grab the newer fork (https://http-builder-ng.github.io/http-builder-ng/) @Grab('io.github.http-builder-ng:http-builder-ng-core:1.0.4') @Grab('org.jsoup:jsoup:1.9.2') If you decide you don't like it, I think you'll need to run the built-in script "clear…
-
It would have helped to know which line threw the error. That's usually available in the stack trace. But the following (simpler script) works for me: import com.atlassian.jira.component.ComponentAccessor def dateFormat = "MM/dd/YYYY" if(issueContext.issueType.isSubTask()){ //only run behavior on sub-tasks def dueDateFld =…