Comments
-
I'll assume your custom field is a User Picker. First you get the component leads from your issue (there may be more than one) def leadKeys = issue.components*.lead Then get an ApplicationUser representing the lead, possibly using first if (leadKeys){ def leadUser = ComponentAccessor.userManager.getUserByKey(leadKeys[0]) }…
-
It writes to the same file... Here are 3 examples with the same 3 lines of code: log.info "info" log.debug "debug" log.error "error" In the console: [...] url:/rest/scriptrunner/latest/user/exec/ username:p6s INFO p6s 916x226878x1 1latest/user/exec/ [c.o.scriptrunner.runner.ScriptBindingsManager] info [...]…
-
HTTPBuilder already takes care of the Json parsing for you since you specified ContentType.JSON. You should not need JsonSlurper here. But like you said, if the API is giving you a single item, then you can get the id for that item like this: _userId = json[0].id
-
/me scratches his head I did some similar testing and found the same thing. So it's consistent at least. The one thing I found is that if you change the body to "unrendered" then the h2 tag is present. So something happens in the rendering phase of loading the body. Oh wow... spent some time in script runner ... totally…
-
My plan is to eventually convert all inline scripts that are more than 2/3 lines into script files. The advantage of inline scripts is that the script is stored in your database and embedded into workflow xml. So it is included in backup, db migration, workflow migration and it gets appropriately picked up by add-ons like…
-
You could create yourself a utility class or one for each script public class MyReusableMethods{ createUser(username){ //your code here } createNewApp(apppName){ //you code here } } Then in your postfunction, you can just import the utility and call the methods import MyReusableMethod if(test){…
-
Let me add, that if you want to try the microsoft driver, the connection will look like this instead: Connection conn = driver.connect("jdbc:jtds:sqlserver://df2v-catsql-p01.ebsi.corp:1433;domain=EBSI;useNTLMv2=true", props) From your earlier logs, that driver appeared available and the correct one to use, but you appeared…
-
I'm afraid I led your astray ... there were a couple of severe mistakes in the code I shared. Try this instead: import groovy.sql.Sql import java.sql.Driver import java.sql.Connection props = new Properties() props.setProperty("user", "svc_atlconf_sql") props.setProperty("password", "OUR PASSWORD")…
-
I was looking for the same information ... and after failing to find anything in the community, I figured a way to set the date value. I could not find how to use the createObjectAttributeBeanForObject(ObjeacBean objectBean, ObjectTypeAttributeBean ota, DateFormat dateFormat, DateFormat dateFormat, String value) signature,…
-
Without researching this, I wonder if that approach is even possible. I am not aware of any way to conditionally go to different status after transition. The best option is to use the FastTrack Transition option in scriptrunner. This lets the create transition go to the default status, then immediately perform the…
-
History item are associated with an issue object, not a custom field. The "fieldname" is just an attribute of a change item and has no direct link to that field. My recommendation is to no copy the history. The only thing I would be comfortable recommended with regards to the issue history is to insert a single history…
-
Ah! Took me a minute. Simple typo. It should be setCustomFieldValue not setCustomerFieldvalue
-
The JQL search are based on the index. So if you've updated the status of one issue, but the corresponding index was not refreshed, then the JQL search will be based on the old status. But if you get an issue object and actually validate the status, you should be able to find the correct/current status. The documentation…
-
Perhaps the issue is as simple as Jira not finding the correct user for "JIRA_Admins". The method where the author is specified as string is deprecated anyway. Try to fetch that user using userManager def adminUser = Componentaccessor.userManager.getUserByName('jira_admins') or use the jiraAuthentication Context (as…
-
Could the username be allowed to only connect from specific hosts? That would explain the ability to connect from confluence but not from Jira. Another thing you can try is to connect directly in the console: import groovy.sql.Sql import java.sql.Driver import java.sql.Connection props = new Properties()…
-
The only way to change this I think would be through making changes directly in the database and that's never recommended. But presumably, this means that you had a customfield called story points that you renamed "story points_obsolete" but you now also have the default "story points" field created by jira software. After…
-
The easiest way to accomplish this will depend on where you want to execute that script. For example, if a workflow Post Function, you just need to def cField2 = customFieldManager.getCustomFieldObjectByName('TestCustomField') issue.setCustomFieldValue(cField2, cFieldValue) This will work as long as the 2 fields are of the…
-
You have to put the serer-side script on the trigger field, not the target field. So in this case, add the script to 'Vrsta poizvedbe' def valuesToCauseHiding = ['Duplikat'] def fieldsToHide = ['customfield_12629'] def triggerField = getFieldById(getFieldChange()) def triggerValue = triggerField.value…
-
I don't think so. If you want to enable space admins on just 1 space, you have to leave the "All" box unchecked, then add all of the space where you want to restrict pemissions. Remember that SPACE ADMIN permission is required on a given space before this feature will be accessible. Generally, space admins have permissions…
-
Sure it's possible. But you probably need 2 workflow validators. One for each transition (to done and to closed). You can use a single script file and link it from both transitions. So in each of those transitions, add a validator and select "Simple Scripted Validator" then either paste or point to file with def isHigh =…
-
If required is still prompted when you submit, check your workflow validators and your project's field configuration. If it is required in either of those places, you can not make it not required using setRequired(false) Also, shortcut: linkid.setRequired( selectedOption != 'XXX') //instead of it/then/else
-
You can try the UserSearchService import com.atlassian.jira.component.ComponentAccessor def users = ComponentAccessor.userSearchService.findUsersByFullName('Peter-Dave Sheehan') if(users.size()>0){ return users.first() }
-
So something like this in JQL? status in ( Failed, Blocked) and issueFunction not in linkedIssuesOf("status != Closed") This should list all the Failed/Blocked issues that do not have any open linked issues. Then you should only have a single layer to deal with.
-
Yeah, just like any other scriptrunner script, you have full access to all the Jira api. So, using the componentAccessor we can get te issueManager. Something like this: String issueKey = queryParams.getFirst("issueKey") if(!issueKey){ return Response.serverError().entity([error: "Missing parameter: issueKey is…
-
Issue key appears to be retrieved from the query parameters. So that means you should be calling your endpoint with <jirabaseurl>/rest/scriptrunner/latest/custom/WriteToDocument?issueKey=ABC-123 I always add validation to my query parameters for custom rest endpoints: String issueKey = queryParams.getFirst("issueKey")…
-
I found that preview was not always reliable. For example, change the un/pw didn't cause a failure until I attempted to update the resource. You can keep an eye on your atlassian-jira.log file, it may show more detail/errors.
-
You probably did some cleanup on your code in order to post ... The relevant part of the error is this: java.lang.NullPointerException at Script75$_run_closure1.doCall(Script75.groovy:34) That means that on line 34 of your script (a in-line scripts get automatic names like Scriptxx.groovy), something returned a null value…
-
I don't think this is listed in the documentation, but the script editor's script info (the question mark icon) is your friend when it comes to understanding what variables are available If it's not listed, it is not available.
-
Where are you pointing to your generic script? If you put it in a "custom script condition", transientVars["actionId"] should be available. It's not available in "simple scripted condition". Then you can get the name of the target status:…
-
I got terribly confused while reading your code and trying to understand the relationship between issues and which issues you needed to transition and why. I suspect there is something weird happening in there. Can you explain those relationships and your requirements? * How are the issues linked. Which issues must have a…