AgileApps Support Wiki Pre Release

Toaster Message

From AgileApps Support Wiki

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