Skip to content

Instantly share code, notes, and snippets.

@JiBrok
Last active September 13, 2020 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiBrok/1259e91b68b1475fd97941bf9420a16b to your computer and use it in GitHub Desktop.
Save JiBrok/1259e91b68b1475fd97941bf9420a16b to your computer and use it in GitHub Desktop.
Update message from ScriptRunner Behaviours
/*
messageType values: success, info, warning, error, change (Type "Change" works only for "Show as flag - No" and Jira 8.4.0+), SIMPLE_VIEW
viewVersion: v1 (standard), v2 (big)
{
"title": "Test title",
"body": "test body",
"messageType": "info",
"asFlag": true,
"viewVersion": "v1"
}
*/
def field = getFieldById("customfield_10000")
field.setFormValue("{\"title\":\"Test title\", \"body\":\"Test body\", \"messageType\":\"success\"}")
import groovy.json.JsonOutput
def field = getFieldById("customfield_10109")
def message = [:]
message << [messageType: "warning"]
message << [title: "Test title2"]
message << [body: "<a>Test body2</a>"]
message << [asFlag: false]
message << [jibrokMessageKey: true]//REQUIRED
field.setFormValue(JsonOutput.toJson(message))
import groovy.json.JsonOutput
def field = getFieldById("customfield_10000")
def message = [:]
message << [messageType: "warning"]
message << [title: "Test title2"]
message << [body: "<a>Test body2</a>"]
field.setFormValue(JsonOutput.toJson(message))
def field = getFieldById("customfield_10000")
field.setFormValue("""
MESSAGE1 <b>test</b><br>
MESSAGE2 <b>test</b>
""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment