function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Becky Miller 15Becky Miller 15 

PageReference Conversion to Lightning

I am not 100% sure how to change this to be recognized in Lightning.  The Opportunity Name / ID is not being added to the Quote in Lightning.  Works just fine in Classic.  Any guidance would be great.

        if(theOpp.Account.RecordType.Name =='Prospect') {
            PageReference pref =  new PageReference('/0Q0/e?Name=' + EncodingUtil.urlEncode(theOpp.Name,'UTF-8')  + '&retURL=%2F' + theOpp.Id + '&oppid=' + theOpp.Id);
            return pref;
        }
        else {
            PageReference pref =  new PageReference('/0Q0/e?Name=' + EncodingUtil.urlEncode(theOpp.Name,'UTF-8') + '&BillingName=' + EncodingUtil.urlEncode(theOpp.Account.Name,'UTF-8') + '&retURL=%2F' + theOpp.Id + '&oppid=' + theOpp.Id);
            return pref;
        }
Best Answer chosen by Becky Miller 15
B KarthickeyanB Karthickeyan
Hi Becky Miller,
Yes, you are right it works fine in Classic because the Lightning URL Format is different, and the record ID is of 18 Digit, not the 15 digits. so if you want to works perfectly in lightning you have to convert the record ID.  
you can refer to the following link for ID conversion (https://www.sfdcpoint.com/salesforce/salesforce-id-15-digit-18-digit-conversion/).

Hope this helps you. 
Please make it the best answer if it helps you.