You need to sign in to do that
Don't have an account?
Ketan Solanki29
Apex class updated object field value not reflected in another apex class
Hi Team,
I am facing issue in Apex class. i have one class where i am updating custom Quote object field and then i am passing Object Id to other class where i quering recoid using ID but i am not getting updated value its retriving old value.
Can anybody tell, what causes this issue ?? why updated value not reflected in another apex class ??
Thanks in Advance,
I am facing issue in Apex class. i have one class where i am updating custom Quote object field and then i am passing Object Id to other class where i quering recoid using ID but i am not getting updated value its retriving old value.
Can anybody tell, what causes this issue ?? why updated value not reflected in another apex class ??
Thanks in Advance,
public class GenerateQuote{
public generateQuotePDF(){
String editedEmailTemplateHtmlText = '<h1> Hi This Is Testing Line 00001</h1>';
quote.Email_Template_Body__c = templateOutputHtml;
UPDATE quote;
system.debug('=======GenerateQuote================>>'+quote.Email_Template_Body__c);
PageReference pdf = Page.PdfGenerator;
pdf.getParameters().put('quoteId', quote.Id );
Blob pdfBody = pdf.getContent();
}
}
public class PdfGeneratorCont{
public PdfGeneratorCont (){
String templateOutputHtml;
String quoteId = ApexPages.CurrentPage().getParameters().get('quoteId');
Quote__c quote = [ SELECT Id,Name,Email_Template_Body__c FROM Quote__c WHERE Id =: quoteId ];
templateOutputHtml = quote.Email_Template_Body__c;
system.debug('=======PDF GENERATOR OUTPUT================>>'+templateOutputHtml);
}
}
After execution of code i am getting diffrent out put like below :
=======GenerateQuote================>><h1> Hi This Is Testing Line 00001</h1>
=======PDF GENERATOR OUTPUT================>><h1> THIS IS KETAN SOLANKI</h1>
Why my PdfGeneratorCont fetching old value from Quote object ???
Thanks,
Ketan Solanki
system.debug('=======GenerateQuote================>>'+quote.Email_Template_Body__c);
Output :
=======GenerateQuote================>><h1> Hi This Is Testing Line 00001</h1>