You need to sign in to do that
Don't have an account?
Alessandro Patricelli 9
showToast on VisualForce Page isnt working? Help ;c
Hi All,
I am trying to make a VisualForce page that on Load it show a simple JS Toast..
But i am keeping getting the following error:
Uncaught ReferenceError: sforce is not defined
at showToast
This is my Visual Force Page, what i am doing wrong?:
<apex:page standardController="Account" lightningStylesheets="true" >
<script type="text/javascript">
window.onload = showToast();
function showToast() {
sforce.one.showToast({
"title": "Attenzione",
"message": "Test Message.",
"type": "warning"
});
}
</script>
</apex:page>
Thanks for help :) really apprecciated.
I am trying to make a VisualForce page that on Load it show a simple JS Toast..
But i am keeping getting the following error:
Uncaught ReferenceError: sforce is not defined
at showToast
This is my Visual Force Page, what i am doing wrong?:
<apex:page standardController="Account" lightningStylesheets="true" >
<script type="text/javascript">
window.onload = showToast();
function showToast() {
sforce.one.showToast({
"title": "Attenzione",
"message": "Test Message.",
"type": "warning"
});
}
</script>
</apex:page>
Thanks for help :) really apprecciated.
Your code is looking good but I think you have to follow some steps for showing toast on detail page or home page.
//Here is my code.
#1. Setup=>search Visualforce page and select your page edit it and check Available for Lightning Experience, Experience Builder sites, and the mobile app.
#2. go to home page or detail page => drag visualforce and select your page Name from right side of VisualforcePage Name Column.
#3. Now Save it and Check.
The toast would be there.
don't forget to mark it as best answer.
Thank you