Toaster Message

From AgileApps Support Wiki
Revision as of 10:32, 23 August 2024 by Wikidevuser (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.

Scripts
For using this 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")


For using 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"
}
}));