Skip to content

Instantly share code, notes, and snippets.

@JiBrok
Last active May 10, 2023 05:09
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/bb8f6775509b8155c3b77cfcc69e931a to your computer and use it in GitHub Desktop.
Save JiBrok/bb8f6775509b8155c3b77cfcc69e931a to your computer and use it in GitHub Desktop.
JiBrok, message field, JavaScript Example: update message on create.
require(['jquery'], function($) {
function setCFValue(customfield_id, value){
$('#' + customfield_id).val(value).trigger('change')
}
function setMessage(title, body, messageType){
var jsonMessage = {}
jsonMessage.title = title
jsonMessage.body = body
jsonMessage.messageType = messageType
setCFValue(CF_ID_MESSAGE, JSON.stringify(jsonMessage))
}
//EDIT HERE
var CF_ID_MESSAGE = 'customfield_10200'
setMessage('New title',
'Loooong <br>'+
'Loooong<br>'+
'Loooong<br>'+
'message',
'error')//info, success, warning, error, change, SIMPLE_VIEW
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment