2

For our use case scenario, we had to have an intermediate page and based on record type of Case , we need to redirect to the standard edit page or another VF page. We created a page and overrode standard 'New' and 'Edit' buttons with the same

We are doing something like this on page load (based on Record Type being R1 or not):

//check if page is loaded in SF1 
    var recordType = '{!caseRecordType}';
if ( (typeof sforce != 'undefined') && (sforce != null) ) {
    if(recordType != 'R1'){
        var caseId = '{!c.Id}';
          if(caseId == '' || caseId == null)
            sforce.one.createRecord("Case",recTypeId);
          else{
            //wanna go to standard edit mobile page
            /*this still obeys over-riding rules and goes to back to this page and the whole thing goes in a loop */
            sforce.one.editRecord(caseId);
            }
    }

Question is Is there an alternative for the above edit mode ?

URLString like '/50063000002xSLPAA2/e?retURL=https%3A%2F%2Ftbct--devsandbox--c.cs43.visual.force.com%2F50063000002xSLPAA2&nooverride=1' and using : sforce.one.navigateToURL(URLString);

is not working either :(

Any workarounds would be greatly appreciated ! We finally want a way to navigate to standard edit screen on mobile through JS script or anything!

Thanks guys !

1

enter image description here

This what it shows when i do the : sforce.one.navigateToURL('salesforce1://sObject/'+caseId+'/home'); in my case I did :

sforce.one.navigateToURL('salesforce1://50063000002xSLP/home');

Although documentation says this: Navigate to Object Home Use this URL scheme to navigate to the home page of an object. sObject//home The following example URL navigates the user to the edit detail page of an Opportunity: salesforce1://sObject/006R0000001r7Rq/home

0

Try using:

sforce.one.navigateToURL('salesforce1://sObject/'+caseId+'/home');

It should take the user to the edit mode for the case.

You can find more details about "salesforce1://" schema here.

Hope it helped..

Update:

I've managed to find a different and a working solution. It's a bit hacky solution but it works:

Use this function:

function goToObject(caseId) {
        //generates a timestamp
        var now = new Date().getTime();
        //navigates to the edit page
        sforce.one.navigateToURL('one/one.app#/sObject/'+caseId+'/edit?t='+now);
}

I've tested it and it work great!

(the only downside is when the user will hit back he will return to the visualforce page he was redirected from..)

Please mark my answer if it helped you.

--

Edit:

To avoid the above mentioned problem you can just add 'true' to the end of the call, like this:

sforce.one.navigateToURL('one/one.app#/sObject/'+eventId+'/edit?t='+now, true);

--

This is according to the sforce.one object documentation here (in the navigateToURL function description):

isredirect is optional and defaults to false. Set it to true to indicate that the new URL should replace the current one in the navigation history.

  • when i try the same, it takes me to a weird screen that says Search null Recent null – peevesy Aug 5 '16 at 4:43
  • I posted the screen shot as answer so I can attach image , can you check? Documentation is confusing it says home page and then in the example it says edit detail, but any case it looks like it attempted to take me to home page – peevesy Aug 5 '16 at 5:06
  • 1
    @peevesy , Plz check the updated solution.. – Yonatan Goriachnick Aug 7 '16 at 12:59

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.