Difference between revisions of "Toaster Message"

From AgileApps Support Wiki
(Created page with "'''What is a Toaster Message?'''<br> Add a generic description. Users can pass a custom toaster using JavaScript. You can use the invocation steps mentioned in the below secti...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
'''What is a Toaster Message?'''<br>
==What is a Toaster Message?==
Add a generic description. Users can pass a custom toaster using JavaScript. You can use the invocation steps mentioned in the below section to pass the custom toaster messages.<br>
A toaster message is a brief pop-up notification that provides real-time feedback or alerts to users. It typically informs users about the success, errors, or warnings related to their actions without interrupting their workflow. Users can pass a custom toaster using JavaScript. You can use the invocation steps mentioned in the below section to pass the custom toaster message.<br>


'''Scripts'''<br>
==Scripts==
For using this script as a function:
Use the following script as a function:
<pre>
<pre>
function custToast(type, message) {
function custToast(type, message) {
Line 23: Line 23:
</pre>
</pre>
<br>
<br>
For using individually in [[Form Scripts]]/[[Field Scripts]]/Browser Console:
Use the following script individually in [[Form Scripts]]/[[Field Scripts]]/Browser Console:
<pre>
<pre>
const cancelButton = document.querySelectorAll('#createNewRecordButton')[0];
const cancelButton = document.querySelectorAll('#createNewRecordButton')[0];

Latest revision as of 10:39, 23 August 2024

What is a Toaster Message?

A toaster message is a brief pop-up notification that provides real-time feedback or alerts to users. It typically informs users about the success, errors, or warnings related to their actions without interrupting their workflow. Users can pass a custom toaster using JavaScript. You can use the invocation steps mentioned in the below section to pass the custom toaster message.

Scripts

Use the following script as a function:

function custToast(type, message) {
const cancelButton = document.querySelectorAll('#createNewRecordButton')[0];
cancelButton.dispatchEvent(new CustomEvent("toasterEvent", {
bubbles: false,
detail: {
toasterType: type(danger/success/warning),
description: message(Enter the custom message)
}
}));
}

setTimeout(()=>{ custToast("success","This is a Success Toast")},3000) ==> To use this function with 3 sec timout

custToast("danger","This is a Error Toast")

custToast("warning","This is a warning Toast")


Use the following script individually in Form Scripts/Field Scripts/Browser Console:

const cancelButton = document.querySelectorAll('#createNewRecordButton')[0];
cancelButton.dispatchEvent(new CustomEvent("toasterEvent", {
   bubbles: false,
   detail: {
       toasterType: "danger",
description: "Toast Danger message"
}
}));