Last active
May 10, 2023 05:10
-
-
Save JiBrok/f3d6930ad91565ab539a5c8d30c5994d to your computer and use it in GitHub Desktop.
JiBrok, message field, JavaScript Example: update message with priority(Service Desk).js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(['jquery'], function($) { | |
function setMessage(title, body, messageType){ | |
var jsonMessage = {} | |
jsonMessage.title = title | |
jsonMessage.body = body | |
jsonMessage.messageType = messageType | |
jsonMessage.jibrokMessageKey = true //Require for Service Desk | |
$('#' + CF_ID_MESSAGE).text(JSON.stringify(jsonMessage)).trigger('change')//Service Desk create request | |
} | |
//EDIT HERE | |
var CF_ID_MESSAGE = 'customfield_10200' | |
$('#priority').on('change', function(){ | |
if($(this).val() == 1){//1 - priority id | |
setMessage('New title', | |
'Blocker<br>' + | |
'priority', | |
'error')//info, success, warning, error, change, SIMPLE_VIEW | |
} else { | |
setMessage('Just info', | |
'not blocker', | |
'info')//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