Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is possible to show a custom toast from Javascript?

Renan Gomes May 18, 2018

I would like to show a custom message from a Javascript file. Like this:

example-image.png

But with a custom message. There's any "trigger" for this?

 

function something(){
JIRA.trigger(JIRA.Events.REFRESH_ISSUE_PAGE, [JIRA.Issue.getIssueId()]);
// show a custom message here.
}

 

2 answers

1 vote
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 18, 2018

You can show a custom message like this:

AJS.messages.info("#a-custom-context", {
title: 'This is a title in a default message.',
body: '<p> And this is just content in a Default message.</p>'
});

You can read more info here:

https://docs.atlassian.com/aui/7.8.0/docs/messages.html

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2018

From the link I gave you:

There are a few ways to implement messages: using HTML (or Soy to generate the HTML) or using JavaScript.

1. using HTML

<div class="aui-message aui-message-error">
<p class="title">
<strong>Error!</strong>
</p>
<p>And this is just content in a Default message.</p>
</div>

All you need to insert this div into html code and hide it. Then when needed you can show it

2. Use Java Script. You do not need to create a div. You just call this Java Script code:

AJS.messages.info({
title: 'This is a title in a default message.',
body: '<p> And this is just content in a Default message.</p>'
});

Renan Gomes May 22, 2018

I tried, but nothing happens.
I need to install anything on my JIRA application?

AJS.messages.info({
title: 'Testing.',
body: '<p>Testing, testing, testing...</p>'
});
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2018

Where did you put the code?

0 votes
Renan Gomes May 21, 2018

I think I understand.

First, i need to insert a html element (a div, for example).
And then, use this "div" to create the message?

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, confluence, loom, atlassian intelligence, ai notes, ai-powered meeting notes, atlassian community events, ace, confluence ai, loom ai integration, ai note-taking, atlassian ai features, team '25, atlassian live learning, confluence automation

Unlock AI-powered meeting notes: Join our live learning session! 📹

Did you catch the news at Team ‘25? With Loom, Confluence, Atlassian Intelligence, & even Jira 👀, you won’t have to worry about taking meeting notes again… unless you want to. Join us to explore the beta & discover a new way to boost meeting productivity.

Register today!
AUG Leaders

Atlassian Community Events