Skip to content

Instantly share code, notes, and snippets.

@JiBrok
JiBrok / update message with priority(SD).js
Last active May 10, 2023 05:10
JiBrok, message field, JavaScript Example: update message with priority(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 on create(SD).js
Last active May 10, 2023 05:09
JiBrok, message field, JavaScript Example: update message on create(Service Desk).
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.js
Last active May 10, 2023 05:09
JiBrok, message field, JavaScript Example: 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 May 10, 2023 05:09
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
@JiBrok
JiBrok / Jira Cloud - timer property example.json
Created January 18, 2022 07:51
Jira Cloud - timer property example.json
{
"key": "TEST TIMER FIELD",
"value": {
"displayValue": "▶️ 108m -> 01/17/22 09:48 PM",
"created": "2022-01-17T19:48:01Z",
"dateNextUpdate": "2022-01-17T20:04:48Z",
"started": "2022-01-17T19:48:01Z",
"failed": "2022-01-17T21:48:01Z",
"state": "RUNNING",
"hoursValueTimeSpent": 0,
@JiBrok
JiBrok / demo Templates for field values.vm
Created February 12, 2021 13:19
Jira app Time in status - demo Templates for field values. jibrok.com/docs/time-in-status/templates-for-field-value/
<table class='aui'>
<tr>
<td>
real time
</td>
<td>
$timeFormatUtils.secondsToFormat($value.timeSpentRealTime, $timerFieldConfig.showFieldFormat)
</td>
</tr>
<tr>
@JiBrok
JiBrok / update message when change select field.vm
Last active January 25, 2021 13:51
Response for: OnChange Listener in Create Issue screen
#set($cfSelect = 10302)
#set($text = "[YOUR DOWNLOADLINK WILL BE SHOWN HERE AFTER SELECTING A MODULE]")
#set($href = "https://www.website")
#if($cfValues.getFromForm($cfSelect))
#set($text = "https://www.website/downloads/dokumente/" + $cfValues.getFromForm($cfSelect).value.replace(" ", "_").replace("/", "_"))
#set($href = "https://www.website/downloads/dokumente/" + $cfValues.getFromForm($cfSelect).value.replace(" ", "_").replace("/", "_"))
#end
<p1>Please download the following document:</p1>
@JiBrok
JiBrok / Notification that this is a production environment.js
Last active December 9, 2020 12:56
Jira announcement banner: Notification that this is a production environment and disabling plugin install
<script>
AJS.toInit(() => {
var baseUrl = "http://localhost:2990/jira"
var upmUrl = "/plugins/servlet/upm"
var worklfowUrl = "/secure/admin/workflows"
function isWorkingTime(){
return new Date().getHours() > 7 && new Date().getHours() < 22
}
@JiBrok
JiBrok / Hide message.groovy
Last active September 13, 2020 12:54
JiBrok, message field, ScriptRunner Behaviours Example: hide message
def field = getFieldById("customfield_10000")
field.setHidden(true)
@JiBrok
JiBrok / Set message as JSON.groovy
Last active September 13, 2020 12:50
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,