1

I have an Apex logic that checks: On click of New button of Opportunity, if the logged-in user has permission to create records, reconstruct the PageReference with the default url like below:

https://myinstance.my.salesforce.com/006/e?retURL=%2F006%3Ffcf%3D00Ba0000009uqqV&_CONFIRMATIONTOKEN=VmpFPSxNakF4Tnkwd015MHlOMVF4TURveU5Eb3hNeTQzT1RSYSxiTm9LeV9XdEpKQVMtRUdzb3pHUVdZLE0yUTJPVFJs&common.udd.actions.ActionsUtilORIG_URI=%2F006%2Fe&RecordType=01230000000rrnN&ent=Opportunity

If I do it in Lightning I am able to redirect to land on new record opportunity page but I am getting an error: enter image description here

I know this is related to constructing the same using the URLEncoding appending in Aloha url

/one/one.app?source=aloha#/sObject/[recordId]/view?fv0={!Object__c.field}

But I am not able to figure out, how should I make and which part of the url has to be encoded. Please suggest.

  • Looks like a permission error.. Make sure your profiles have access to the record type listed in the URL (01230000000rrnN). – Ross Bassett Mar 27 '17 at 13:29
  • I think the record type id is not getting passed. as its working fine in classic. And the record type assignment is correct. – sanchit Mar 27 '17 at 16:33
1

Lightning data service (though still in developer preview and super involved) is meant to solve this

Loading a Record

  • Thanks for the answer but I am not asking in context of Lightning Components. I know it can be done via Visualforce without having the lightning tags involved anywhere. Please suggest. – sanchit Mar 30 '17 at 12:45
  • Can we develop a Lightning component to call the Visualforce which will perform the same task I want on click of "New" standard Button? – sanchit Mar 30 '17 at 16:38

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.