1

I have overridden the standard new button by calling the VF Page which takes me to the edit layout for a specific record type.

For ex: The controller on the VF page constructs a pagereference and returns. new Pagereference('/'+Label.Object_Id+'/e?RecordType='+Label.RecordType_Id);

I have also set the NoOverride parameter to true.

When I try testing it from the Salesforce1 app, it lauches the app again on click of the overridden button.

Any thoughts on how the functionality be achieved in Salesforce1

1 Answer 1

2

Avoid using Pagereference methods in salesforce1 and usually i would prefer using @Remote action method to implement logic

Lets take a quick look with sample code below on how to achieve this

function actioninvoke(){
   if( (typeof sforce != 'undefined') && (sforce != null) ) {
   // Salesforce1 Remote Action method built in controller

   }
   else {
   //Action Function of normal App
   }
 }

Visualforce Code

 <apex:CommandButton value="Next" onclick="actioninvoke();" id="cmdNext" />

The advantages of remote action will be ability to callback and in callback we can use navigation specific function of salesforce1 like sforce.one

navigateToSObject(recordId,view)    //Navigates to an sObject record, specified by recordId.view is optional, and specifies the view within record home to select—chatter, related, or   detail.
5
  • We are planning to hide the new button on the S1 app. I have raised another query on whether we can hide the button on SF1 app or not. Any ideas? Feb 19, 2014 at 13:36
  • Can you share the complete code with us? Mar 12, 2014 at 0:15
  • Why should we avoid using PageReference methods in Salesforce1? Aug 12, 2014 at 19:08
  • It will cause page redirect.Typically for mobile apps we manipulate DOM on fly not refresh the page.The action function with reRender can be used but again all that will have view state- Aug 12, 2014 at 19:55
  • I'm having same issue, if we can't use Redirect then is there any way we can bypass Link Override page in Salesforce1?
    – VarunC
    Jan 3, 2015 at 8:53

You must log in to answer this question.

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