0

Object A is the parent object and object B is child object. object B has new button override with VF page. when I am clicking the new button of obj B from related list A I need Obj A's Id. For this I have added following lines in controller

String str = System.currentPageReference().getParameters().get('retURL').substring(1,16);
Id myId = (Id)str;

This works for classic view for lightning view am getting Error like

Invalid id: lightning/cb/re An unexpected error has occurred. Your development organization has been notified.

Anyone knows about how to solve this?

  • 1
    There are many methods to get ID. You need to change your URL parse approach in lightning or use other method to get the id. – Tushar Sharma Jan 17 at 9:51
  • String retUrl = ApexPages.currentPage().getUrl().substringAfter('lkid'); String parentId = String.isNOTBlank(retUrl) && retUrl.length() >= 16 ? retUrl.substring(1,16) : retUrl; we can get the parent Id in both classic and lightning experience by using this . – Kuppulakshmi A Jan 17 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.