I've a button on visualforce page. On click of that button I want to redirect the user to event/Task creation page. With salesforce, I would have achieved this using global action variable $Action.event.NewEvent. I observed that this do not work on mobile. Can anyone suggest me how to use sforce.one.CreateRecord method in my case.

4 Answers 4


From http://blogs.developerforce.com/developer-relations/2013/12/things-to-know-about-s1.html :

Custom navigation via JavaScript: One of the lesser known developer features in Salesforce1 is the ability to navigate users to different places in the app via JavaScript in your Visualforce page. You could for example have a Visualforce page with a ‘New’ button that has the following onClick code.

function createNew() {

Clicking the New button will then automatically display the default create/edit page for My_Custom_Object__c inside of Salesforce1. The magical sforce.one object contains a bunch of such navigation utility functions, including the ability to navigate to a record detail view, a user or record feed, an arbitrary URL and more.

A few more details here : http://blogs.developerforce.com/developer-relations/2013/12/salesforce1-cures-the-app-boogie-fever.html

and the video shortcut : http://www.youtube.com/watch?v=ZK0cb40f-G4&t=15m18s

  • Thanks for replying. I tried sforce.one.createRecord(Event) but, still that didn't work out. It simply refreshes the page instead of navigating to new event record creation page.
    – Adroit
    Dec 9, 2013 at 6:35

I've been using sforce.one.CreateRecord and as you guys commented it is not working. Also I've been in contact with SF support. At the moment they answer that they gave me is that the call only works when you specified both parameters. However I'm doing it and still not working. I'm thinking that might be is still not fully implemented , however I don't have confirmation on it, it is only a thought. I'm thinking this way because related to the other call : sforce.one.navigateToSObject, they communicated that will be ready for Summer '14 ( safe harbor). Will keep update my answer if I get any more info :)

Update: Hi @Androit, Just got an update from Salesforce and they informed that this feature is not fully implemented yet and it will be available after next summer release. (safe harbor)

Hope it helps :)


It has been significantly improved with Summer'17 and now you can even add default values. Plain and simple, you can use it like this one-liner:

    FirstName : "John",
    LastName : "Doe",  

From the Summer '17 Release Notes - Prepopulate Fields on a Record Create Panel

Speed up record creation with prepopulated field values. The sforce.one.createRecord function now includes defaultFieldValues (optional) so you can define fields on a record create panel, including fields not displayed on the panel. This change applies to Lightning Experience and the Salesforce1 mobile browser app.

Users must have create access to prepopulated fields. Errors during saving that are caused by field access limitations do not display error messages.

Caution 1:

The this feature from Summer'17 works only if you put your Visualforce Page to API v40.0 or higher.

Caution 2:

Objectnames and Fieldnames are CASE-SENSITiVE! So lastname is not LastName and only LastName is correct

See also:




Here is the updated document link for createRecord (in 2023)


Was able to prepopulate Lead Fields in SF UI.

enter image description here


You must log in to answer this question.

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