1

I wrote a lightning component that searches(queries) Account and shows results in the form of clickable links:

'a href="{! '#/sObject/' + account.Id + '/view'}"'

(https://i.imgsafe.org/21d7bd409b.png)

These links open a URL inside the Salesforce1 app. When I try to deploy the same approach for Lightning version of S1 instead of opening the links inside S1, it opens them in an external Web browser(Safari).

I tested it on Salesforce Classic and Lightning on Android and Iphone. Android works perfectly and opens the links inside the app in both versions. Iphone works fine on Classic version but opens links externally on Lightning.

I tried to use deep URI links i.e { com.salesforce.salesforce1://entity/view?entityId={!record.id} } didnt work. Including just {salesforce1://entity/view?entityId={!record.id}}.

Also, I tried to use Navigation i.e sforce.one.navigateToSObject (\'' + Account.Id + '\') and put it into but it doesn't navigate to the record as well.

How to make it open links(navigate to a record) internally in Lightning version on IOS?

1
  • I tried the following methods: 1) <a href="{! '/sObject/' + account.Id + '/view'}"> 2) <a href="" onclick="return !c.navToPage();"> 3)navToPage: function(){ if(typeof sforce !== "undefined" && sforce !== null) { // Salesforce1 navigation sforce.one.navigateToSObject('0015800000W7qoqAAB'); //System.debug('Mobile'); } else { // Desktop navigation System.debug('Desktop'); window.open('/'+ '0015800000W7qoqAAB', '_self'); } } Oct 28, 2016 at 15:42

1 Answer 1

0

You should use the force:navigateToSObject event. The documentation is at https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToSObject.htm. This will work in LEX (desktop), S1 Android, and S1 iOS.

1
  • It solved the problem, I put the function in the controller and invoked it from component page <a onclick="{!c.createRecord}" > <p id="{!account.Id}">{!account.Name}</p> </a> Thanks Kevin! Nov 1, 2016 at 14:24

You must log in to answer this question.

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