1

I've a Visualforce Page with a Save and Cancel button. When used in Salesforce1 the button "Cancel" needs to redirect user to the Custom Object Tab list view in Salesforce1. Now I have deduced that the URL for custom Tabs Lists in Salesforce is in this format:

/one/one.app#/sObject/MyObject__c/home

But when I try to use this in sForce.one library i get error that page cannot be shown as it is not mobile supported a general error from S1 when a VF page or interface is not ready for mobile. But all I'm trying to redirect user is to the same URL from where the user came across in S1 app.

I've tried URL Encoded as well as direct URL value for redirect, and I get same message always:

sforce.one.navigateToURL("%2Fone%2Fone.app%23%2FsObject%2FMyObject__c%2Fhome");

sforce.one.navigateToURL("/one/one.app#/sObject/MyObject__c/home");

Can someone guide me how to guide user to a List View url in Salesforce1?

1

To send users to the home tab of a custom object the format is this:

sforce.one.navigateToURL('#/sObject/Custom_object__c/home');
  • Yes, but it doesn't redirect to set url like this via code. – VarunC Oct 20 '15 at 5:06
  • correction for above, It works, I was mistyping and not putting '#' in navigateToURL() function call. Thanks. – VarunC Oct 20 '15 at 9:14
0

You cant use URL hacks in SF1 :)

Are you talking abouot "Save" and "cancel" button that are on VF page by default in SF1? Then in my openion they are not customizable. But if these are your own custom button (as I assume they would be) the use the following function:

navigateToList(​listViewId​, listViewName, scope)

eg. sforce.one.navigateToList('001XSSSSSZXSSS', 'MyAccounts', 'Account');

Navigates to the list view that’s specified by the listViewId, which is the ID of the list view to be displayed.listViewName sets the title for the list view. It doesn’t need to match the actual name that’s saved for the list view. To use the saved name, set listViewName to null.Set scope to the name of the sObject in the view, for example, “Account” or “MyObject__c”.

  • Yeah .. I recall that function and for that is there someway to be able to go back to the last View opened in Salesforce1? – VarunC Jun 25 '15 at 18:39
  • Use sforce.one.back();************** back(​[refresh])************** Navigates to the previous state that’s saved in the sforce.one history. It’s equivalent to clicking a browser’s Back button. refresh is optional. By default, the page doesn’t refresh. Pass true to refresh the page if possible. – Lx123 Jun 25 '15 at 19:33

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.