I'm having difficulties in proceeding with a script. I scripted it with scriptrunner to improve the runtime of this automation. Basically what I need is for the script to do a check on a cascading jira cloud field and depending on option 1 AND option 2, I need the script to define a third field with one of the available options. This third field is a group picker field in jira cloud My difficulty is in line 18, on the put function, so far what i have is this:
import groovy.json.JsonSlurper
import java.util.logging.Logger
def key = issue.key
def epics = get("/rest/api/2/search").queryString('jql', "key = '${key}'").asObject(Map).body
def requests_brasil = epics["issues"]["fields"]["customfield_10830"]["value"]
def requests_child = epics["issues"]["fields"]["customfield_10830"]["child"]["value"][0]
def solver_group = ""
logger.info(requests_brasil)
logger.info(requests_child)
if (requests_brasil == "Active Directory Group" && request_child == "Create New Active Directory Group")
{
def result = put("/rest/api/2/issue/${issue.key}")
.header('Content-Type', 'application/json')
.body([
fields: [
"customfield_10583": {
name: "ServiceDesk-N1"
}
]
])
}
I don't have a knowledge of advancing in scriptrunner, so I believe my code is very simple in complexity, I'm open to suggestions for improvements too I would like to know how I can make this put function work on this group picker field
Thanks for the support guys
Hi Victoria,
I can confirm that we have the example located here which shows in lines 39 to 56 an example of how to set a group picker field.
I have tested this example and confirm this works and sets the field as expected when the syntax used in this example is used.
The way this works is by specifying an array in the variable named groupName which contains the group to be set and this is then passed into the body of the put request and the return type of the request is set to be a string.
I hope this example helps and acts as a guide to help you to solve your requirement.
Regards,
Kristian
ciao I'll try in this mode but not run, can you help me ? Please note that "Gruppo Assegnatario Precedente" is a Custom Field Type Group Picker Single Choice
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.