I am a newbie to study Visualforce mobile in Salesforce1, and I have studies the chapter 3 - Implementing Global Actions with Visualforce Pages. (url: https://developer.salesforce.com/trailhead/visualforce_mobile_salesforce1/visualforce_mobile_salesforce1_actions_global)

In the chapter, it is ok to do "Quick account" creation.

And, I found something interesting and it seems to be about the toast message technique. However, I can find no way to set the message of the toast body.

Does anyone know how to set the message of toast body? Ps. It is not a practice about lightning component, but it is visualforce mobile.

Create account

// When the submit button is pressed, create an account, and close the panel
Sfdc.canvas.publisher.subscribe({ name: "publisher.post", onData: function(e) {
  // Create the account using the Remote Object
  var accountName = document.getElementById("accountName").value;
  var account = new SObjectModel.Account();
  account.create({Name: accountName}, function(error, records) {
    if (error) {
    } else {
      //  Close the publisher panel
      Sfdc.canvas.publisher.publish({name: "publisher.close", payload: {refresh:"true"}});

Screen 1 - Click "Save" button

enter image description here

Next screen - A grey message block displays and then is hidden and no message

enter image description here

The block seems to be a "toastBody" element, and I am looking a way to set the message of the toast element?

enter image description here

Here is another simplifed sample code and screens.

Visualforce code

<apex:page >
    <meta charset="UTF-8" />
    <apex:includeScript value="/canvas/sdk/js/publisher.js" />
        function closeAction() {
            Sfdc.canvas.publisher.publish({ name : "publisher.close", payload : { refresh:"false" }});

    <h1>Sample Page</h1>
    <button onclick="closeAction()">Close Action</button>

Screen 1 - click "Close Action" button

enter image description here

Screen 2 - next screen has a toast without any message at all!! How to set the message?

enter image description here

Thank for any help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.