You need to sign in to do that
Don't have an account?
Becky 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;
}
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;
}
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.