I use a script to send mattermost notifications if new tasks are created. He works. But if the title/name of the task has this " " sign, the notification does not come..
import groovyx.net.http.ContentType
import groovyx.net.http.RESTClient import com.atlassian.jira.component.ComponentAccesso
def hookURL = "https://****/hooks/***"
def activitiRestClient = new RESTClient(hookURL)
def creator = issue.getCreator()
def creatorUsername = creator.getUsername()
def creatorName = creator.getDisplayName()
def issueKey = issue.getKey()
def issueSummary = issue.getSummary()
def priority = issue.getPriority().name
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def cFieldTeam = customFieldManager.getCustomFieldObjectByName("command")
def team = issue.getCustomFieldValue(cFieldTeam).toString()
def cFieldSeverity = customFieldManager.getCustomFieldObjectByName("Severity")
def severity = issue.getCustomFieldValue(cFieldSeverity).toString()
def cFieldWhereBugFound = customFieldManager.getCustomFieldObjectByName("where is the error")
def whereBugFound = issue.getCustomFieldValue(cFieldWhereBugFound).toString()
def teamMentionMap = [
"Bw2": "@bug_%s_b2c",
"wer": "@bug_%s_omni",
"vf": "@bug_%s_kpp",
"wed": "@bug_%s_oes",
"erf": "@bug_%s_core",
"edvf": "@bug_%s_wlk",
"not specified": "command not specified but %s!"
]
def scopeMap = [
"prod": "prod",
"test": "test"
]
def teamMention = String.format(teamMentionMap.get(team), scopeMap.get(whereBugFound));
def body = "{\"username\":\"New Bug\","
body += "\"icon_emoji\":\":ladybug:\","
body += "\"attachments\":[{\"color\":\"#FA5537\","
body += "\"text\": \"${issueSummary}\","
body += "\"title\": \"${issueKey}\","
body += "\"title_link\": \"https://***/jira/browse/${issueKey}\"}],"
body += "\"text\":\"${teamMention} new issue **${creatorName}** (@${creatorUsername})\n"
body += "Priority: **${priority}**, Severity: **${severity}**, where is the error?: **${whereBugFound}**\"}"
activitiRestClient.post(
contentType: "text/plain",
requestContentType: "application/json",
body: body,
)
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.