+ Start a Discussion
Haystack CertifiedHaystack Certified 

VF page to start off a new record in mobile

This help page has an example of using a canvas navigation call to start a new record in mobile.

The page is: http://www.salesforce.com/us/developer/docs/platform_connect/Content/canvas_apps_salesforce1_navigation_methods.htm
The example is: var event = {name:"s1.createRecord", payload: {entityName: "Account", recordTypeId: "00h300000001234"}};

Could someone show me what method to use to leverage the "event" variable in the example.  This would be for a VF page embedded as part of a publisher action.  My understanding is that canvas publisher methods can be used without actually creating a full blown canvas app.

Thanks.
Gaurav KheterpalGaurav Kheterpal
I didn't really understand what you mean by 'without actually creating a full blown canvas app'.

This (http://www.salesforce.com/us/developer/docs/platform_connect/Content/canvas_app_vf_publish_code_example.htm) link has an example for how to publish a event from a Visualforce page.
 
// Target all canvas apps.
    Sfdc.canvas.controller.publish({name : 'mynamespace.myevent',
                                    payload : {}});
The following code example shows how to call the publish method to publish an event to a specified canvas app from the Visualforce page.

If an event is published to specific canvas apps, even if other canvas apps on a Visualforce page are subscribed to it, only the canvas apps specified will receive that event. Using this code example, if the Visualforce page contained canvas apps app1, app2, and app3, and they all subscribed to myevent, only app1 would receive the event.

 
    // Target a specific canvas app
    // where "app1" is the canvasId specified in the canvas component.
    // For example: <apex:canvasApp canvasId="app1">
    Sfdc.canvas.controller.publish({name : 'mynamespace.myevent',
                                    payload : {}, 
                                    target : {canvas : 'app1'}});
Is this what you are looking for?