Skip to content

Instantly share code, notes, and snippets.

@JiBrok
JiBrok / hide banner if all fields are empty(View issue).js
Last active Jul 10, 2020
JiBrok, message field, JavaScript Example: The script will check the custom fields on the view issue screen. If all fields are empty, the message banner will be hidden.
View hide banner if all fields are empty(View issue).js
function checkFieldsAreEmptyAndHideMessage(fieldIds, messageFieldId){
AJS.$.ajax({
url: AJS.contextPath() + '/rest/api/2/issue/' + JIRA.Issue.getIssueId() + "?fields=" + fieldIds.join(),
type: "GET",
async: false,
success: function(issue) {
if(areAllFieldsEmpty(issue, fieldIds)){
hideMessage(messageFieldId)
}
}
@JiBrok
JiBrok / update and hide message with 2 conditions by select fields.js
Created Oct 31, 2019
JiBrok, message field, JavaScript Example: update and hide message with 2 conditions by select fields
View update and hide message with 2 conditions by select fields.js
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;
@JiBrok
JiBrok / update and hide message with 2 conditions by select fields(Service Desk).js
Last active Apr 2, 2020
JiBrok, message field, JavaScript Example: update and hide message with 2 conditions by select fields(Service Desk)
View update and hide message with 2 conditions by select fields(Service Desk).js
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
}
@JiBrok
JiBrok / update message with priority and select field(SD).js
Created Oct 23, 2019
JiBrok, message field, JavaScript Example: update message with priority and select field(Service Desk)
View update message with priority and select field(SD).js
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
}
@JiBrok
JiBrok / update message with priority(SD).js
Created Oct 23, 2019
JiBrok, message field, JavaScript Example: update message with priority(Service Desk).js
View update message with priority(SD).js
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
}
@JiBrok
JiBrok / update message on create(SD).js
Created Oct 23, 2019
JiBrok, message field, JavaScript Example: update message on create(Service Desk).
View update message on create(SD).js
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
}
@JiBrok
JiBrok / update message with priority and select field.js
Created Oct 23, 2019
JiBrok, message field, JavaScript Example: update message with priority and select field
View update message with priority and select field.js
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
@JiBrok
JiBrok / update message with priority.js
Last active Oct 23, 2019
JiBrok, message field, JavaScript Example: update message with priority.js
View update message with priority.js
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
@JiBrok
JiBrok / update message on create.js
Last active Oct 23, 2019
JiBrok, message field, JavaScript Example: update message on create.
View update message on create.js
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
You can’t perform that action at this time.