I am having a issue subscribing to publisher events such as publisher.showPanel and publisher.post within SF1 when I fire a sforce.one.createRecord modal.

gist of sample code: https://gist.github.com/mtetlow/80789a679efe8e18465e

I get no console logging whatsoever when the createRecord modal fires. Essentially I am looking to fire a refresh of client side data when a new record is added via my ui. Does anyone have any idea if the publisher. events fire from the sforce.one.createRecord modal?

To recreate: create VF page with sample code, check available in SF1 on VF page, create tab for VF page, add tab to Setup -> Mobile Navigation. Then navigate to /one/one.app and click on your tab from the left side / hamburger menu. If you click the "Create Account" anchor, I would expect console logging to occur.

1 Answer 1


As far as I'm aware the only time the publisher.post event is fired is when the Submit button is clicked within a Salesforce1 custom publisher action.

There is currently no way to subscribe to sforce.one methods as they don't fire the publisher events, nor do they offer the facility to provide a callback method.

An alternative is to use Visualforce Remote Objects, AJAX Toolkit or JavaScript Remoting. All of which allow you to define callback functions.

Here are some examples (taken from the documentation linked above):

Visualforce Remote Objects

var ctDetails = { FirstName: 'Marc', LastName: 'Benioff' };
var ct = new RemoteObjectModel.Contact();
ct.create(ctDetails, function(err) {
    if(err) { 
    else {
        // this is the contact
        console.log(ct.log());     // Dump contact to log
        console.log(ct.get('Id')); // Id is set when create completes

AJAX Toolkit

var account = new sforce.SObject("Account");
account.Name = "my new account";

sforce.connection.create([account], {onSuccess : success, onFailure : failed});

function success(result) {
    if (result[0].getBoolean("success")) {
        log("new account created with id " + result[0].id);
    } else {
        log("failed to create account " + result[0]);

function failed(error) {
    log("An error has occurred " + error);

JavaScript Remoting

var accountName = document.getElementById('acctSearch').value;

     function(result, event){
          if (event.status) {
               document.getElementById('acctId').innerHTML = result.Id
               document.getElementById('acctName').innerHTML = result.Name;
          } else if (event.type === 'exception') {
               document.getElementById("responseErrors").innerHTML = 
               event.message + "<br/>\n<pre>" + event.where + "</pre>";
          } else {
               document.getElementById("responseErrors").innerHTML = event.message;
  • Yeah, I was looking to use the standard object create actions within SF1, then figure out how to refresh my UI. I would rather not rebuild that entry screen if I could help it. I will continue looking to see if I can find any workarounds. Thanks for looking at it! May 27, 2014 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .