I am writing a script on ScriptRunner to update the fields once an issue is created, but I receive the following:
error code: status: 403 - Forbidden
I saw on some posts mentioning that might be due to the scope object in atlassian-connect.json not including 'write'.
Can anyone tell me how to add the write scope to atlassian-connect.json?
Thank you.
@Chun Ho Ng Welcome to the community!
To add 'write' scope to atlassian-connect.json file you need to add something like this.
{
"key": "YOUR_ADDON_KEU",
"name": "ADDON_NAME",
"description": "ADDON_DESCRIPTION",
"scopes": ["READ", "WRITE"], # HERE I HAVE ADDED A WRITE SCOPE
"modules": {
...
}
}
But, I don't think with ScriptRunner you need to do this. ScriptRunner itself is addon and you don't need to write 'atlassian-connect.json' file for this.
You might be getting error because of permission issues with field. So please validate this first.
I was able to change the fields through sending the following PUT request on Postman:
/rest/api/2/issue/[issueKey]
body:
{
"fields": {
"customfield_10039": "US",
"customfield_10040": "NF",
"customfield_10041": "KP"
}
}
But it failed when I used ScriptRunner
put("/rest/api/2/issue/${issue.key}")
.header("Content-Type", "application/json")
.header("Accept", "application/json")
.body([
fields: [
customfield_10039: region,
customfield_10040: mainProgram,
customfield_10041: subProgram
]
]).asString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.