I have a custom list of Products which appear in Salesforce in both mobile and desktop.
When the user clicks on the button in the list:
<lightning:button label="{!r.Name}" value="{!r.Id}" onclick="{! c.navigateToProduct }" variant="base" />
It calls this JavaScript controller method:
navigateToProduct: function (cmp, event, helper) {
let recordId = event.getSource().get("v.value");
var navEvent = $A.get("e.force:navigateToSObject");
navEvent.setParams({
"recordId": recordId,
"slideDevName": "related"
});
navEvent.fire();
}
But when clicked from mobile (Salesforce1 or web) the Product page fails to load:
But when I try from a desktop computer it loads fine.
I have also tried using a plain anchor tag, which did not work:
<a href="{!r.url}">{!r.Name}</a>
And I've tried using window.location.href
, which did not work.
What am I doing wrong? How can I link to a product in a way that works on mobile?