Activity Forums Salesforce® Discussions How to display toast in Salesforce visualforce page?

  • Yogesh

    Member
    October 9, 2019 at 11:29 am

    Hello,

    Toast messages can be sent using “showToast” method which is the latest member in sforce.one object. Which means, these messages can only be displayed in Salesforce Mobile app and would not be supported in desktop experience. The change applies to Lightning Experience, Lightning communities, and all versions of the mobile app.

    for an example:-

    <apex:page >

    <script type=”text/javascript”>

    window.onload = setupPage;

    function setupPage() {

    //function contains all code to execute after page is rendered

    //Showing a toast message

    sforce.one.showToast({

    “title”: “Hello There!!”,

    “message”: “I am a toast message being fired from visualforce page”,

    “type”: “success” //supported types are error, success, info, warning

    });

    }

    </script>

     

    <div> Toast Message Demo </div>

    </apex:page>

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos