Don't work for message type - "Show as is"
It doesn't work if you select the message type in the field settings message type - "Show as is" |
{baseUrl}/secure/jibrokMessageFieldsConfig!default.jspa
or gg + “message field settings"
Scripts in behavior can be very complex and run "not instantly", but for a second or more. In order for the plugin(message field) to wait for the result of script, in the plugin settings must set a timeout for waiting for a response from ScripRunner. If the "behavior" execution time exceeds the timeout, the plugin will not be able to display the received message. If the script is not large, it is usually enough to wait around 1 second. The 1000ms timeout is also almost invisible to users. If you need to set a longer waiting time, there is an option to display the default message from the field settings while waiting for the behavior script to execute. When "behavior" completes its execution, the message will be replaced with a new one.
During this time, the "Message field" field will wait for the result of Script Runner execution. As soon as the result is received(before the timeout expires) the message will be updated immediately.
For example, you can set the message "Loading" in the field settings. It will be displayed until "behavior" is performed and the new message from script is set.
def field = getFieldById("customfield_10000") field.setHidden(true) |
In the field settings must be set "Title" or "Body" - (default value)
def field = getFieldById("customfield_10000") field.setFormValue(""" MESSAGE1 <b>test</b><br> MESSAGE2 <b>test</b> """) |
2.2 Set message as JSON textmessageType 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)
|
def field = getFieldById("customfield_10000") field.setFormValue("{\"title\":\"Test title\", \"body\":\"Test body\", \"messageType\":\"success\"}") |
In the field settings must be set "Title" or "Body" - (default value)
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)
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)) |
For Message field v2.4.0+
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)) |