I have a mobile app with two Objects which are linked via Master-Detail. I have overwritten the new page for creating an child record with an custom visualforce page.

This page should create an record with user entered data, and (after saving it) redirect to the parent Object.

I can't use the standard save action because of architectual reasons. So instead I use a save-button executing a "doSave" action in the controller extension and, on completion, redirecting with the "sforce.one" object to the parent object.

This works fine on "edit" but on the "new"-action the parent-Id parameter is missing.

Child__c = child Object

mdr_Parent__c = master-detail field on child

form = visualforce markup element to rerender

This is the Visualforce markup:

<!--BUTTON--> <apex:outputPanel> <center> <apex:commandButton value="Save" action="{!doSave}" oncomplete="sforce.one.navigateToSObject('{!Child__c.mdr_Parent__c}');" rerender="form"/>
</center> </apex:outputPanel>

And these are the controller extension constructor and method:

public Child__c child {get; private set;}
private ApexPages.StandardController stdCtrl;


public ExpenseCtrlExt(ApexPages.StandardController standardController) {
    stdCtrl = standardController;
    child = (Child__c) stdCtrl.getRecord();

public void doSave() {
    try {
        upsert child;
    catch(Exception ignored){}

The button saves the record but does not redirect to the Parent record.

Thanks for helping.


2 Answers 2


According to the docs:


oncomplete only fires once an Ajax request is completed, whereas yours is a regular form postback. You'll need to add a rerender attribute to turn it into an Ajax request.

  • Sorry I had the rerender attribute in the button. Somehow I did not copy it in the browser. I'll change this. Still since I always had this attribute in the button, this can't be the reason why it's not working. After doing some debugging we found out that this "Parent Id" parameter is simply not transmitted to the VF page if you're using S1 on a mobile device. On the Desktop it's working fine. Aug 1, 2014 at 10:28
  • Ah - are you relying on the parent id coming on the URL? You are correct, that isn't supported in SF1. Aug 1, 2014 at 11:27
  • any idea where this information is provided? If I hit save, the child record is saved to the correct parent, so somehow the id must be transmitted. Aug 1, 2014 at 11:52
  • 1
    I don't I'm afraid - just something I learned along the way. As you have the parent in the controller, can you not just make that available as a property? Aug 1, 2014 at 12:05
  • Sorry what do you mean by "you have the parent in the controller"? I'm using the Standard controller for Child__c. So I'm only able to get the child via StandardController.getRecord(). I could query the parent but I would need the parent id again. Aug 1, 2014 at 12:36

Well after some years i got curious and recreated the situation. Seems like Salesforce must have fixed something. The exact code from above works fine now in S1 Desktop Simulators aswell as in actual Smartphone S1.

You must log in to answer this question.

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