I created an overwrite for the "new"-button on a custom object via a Lightning Component. On the desktop everything works fine but the Salesforce mobile app causes some issues.
The component contains the following:
<force:recordData aura:id="forceRecord"
recordId="{!v.recordId}"
targetFields="{!v.record}"
fields="Id, Name, Street__c, PostalCode__c, City__c, Country__c"
mode="EDIT" />
<lightning:button variant="brand" label="Submit" onclick="{!c.saveRecord}" />
Within the controller I execute a redirect to the created record with the following snippet:
var tempRec = component.find("forceRecord");
tempRec.saveRecord($A.getCallback(function(result) {
if (result.state === "SUCCESS") {
var navEvt = $A.get("e.force:navigateToSObject");
navEvt.setParams({
"recordId": result.recordId
});
navEvt.fire();
}
This works on desktop but not on Salesforce mobile app.
I also tried window.location.href = '/' + result.recordId;
without success.
Any ideas how I can make it work on mobile as well?
Thanks Chris