8

I have a Lightning Component in my Home page that filter a list of Opportunities. On the title I have a link to the list on the Opportunity tab that works perfectly. enter image description here This is the code.

<a href="/one/one.app?#/sObject/Opportunity/list?filterName=00B28000000zx7MEAQ" target="_blank" class="slds-type-focus">
<span class="slds-section__title">My Policies due to Renewal</span></a> 

I tried to create a similar link on the Opportunity Name to open the record detail page with no success. My code is:

<a href="{!'/one/one.app?#/sObject/'+ opp.Id}" target="_blank">{! opp.Name }</a>

I got the error message

"This page isn't available in Salesforce Lightning Experience or Salesforce1". The address in the URL is : /one/one.app?#/sObject/006280000074WXdAAM and it should be : /one/one.app?#/sObject/006280000074WXdAAM/view?t=1478147610998

How can I get the view part?

15

Just append view text to the end of href of the anchor tag.

 <a href="{!'/one/one.app?#/sObject/'+ opp.Id + '/view'}" target="_blank">{! opp.Name }</a>
  • I would like to use as target "_blank", but it generates error to me. There is any alternative option to refresh the page and not to open a new tab? – Klodj_Tema Mar 9 '17 at 18:01
  • Can you open a new question and link to this answer with details of error you are getting? – Praveen Mar 10 '17 at 3:36
  • @Praveen Do you have any idea about link to a record edit page? I tried appending /edit. It works but when clicked on save it does not navigate to view instead to comes back to edit page. – snehakem Sep 8 '17 at 13:56
  • @snehakem Somewhere internally the return url is sent behind the scene.At the moment I don't have a solution for your problem. – Praveen Sep 11 '17 at 7:59
  • Thanks for you response @Praveen. I will figure out some other way. – snehakem Sep 12 '17 at 9:56

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.