Hello everyone,
I am migration our server instance to the cloud and I am having issues with setting up the service management project correctly.
The goal is, that the script runner script should set the organsiation based on the email domain.
I know that this already works with automation, but from my point of view it is not fully thought out and not usable for us as we have customers working with different domains.
So I created a script with this function
public void setOrganisationToIssue(String issueKey, String organisationID) {
def builder = new JsonBuilder()
def root = builder {
fields {
customfield_10002([id: organisationID])
}
}
def jsonString = builder.toPrettyString()
def correctedJson = [fields: [customfield_10002: [[id: 156]]]]
def correctedJsonString = new JsonBuilder(correctedJson).toPrettyString()
logger.info(correctedJsonString)
def resp = put("/rest/api/2/issue/SD-104801")
.header('Content-Type', 'application/json')
.body(correctedJsonString)
.asString()
}
With this example the result of the json looks like this
{ "fields": { "customfield_10002": [ { "id": 156 } ] } }
But I get this error message
body: {"errorMessages":[],"errors":{"customfield_10002":"Die Organisations-ID muss eine Zahl sein."}}
That means, that the organisation ID must be a number.
I tried a bunch of different things without any luck. Also I wasn't able to use the json builder, because he removed the arrays and I got a message, that setting the organisation needs to use an array.
Its seems like, that the json needs to look like this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.