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
DILIP KUMAR MISTRYDILIP KUMAR MISTRY 

Record is not facthed after insertion

Hi to all,

 

I have stucked in a weired problem. 

 

I have large numbers of accounts and want to send an email to a contact about all the account information in pdf format. For this i am making a temporary object [Temp_Obj__c] which has fields like [key__c and value__c].

 

I fill the key with a unique number so that will not be replicated in any case and  filling the value__c with the comma separated account-ids. I pass this key to the another page as a parameter and use this key to get the account ids using the temp object.

 

To get the pdf content i have an another page that display the information by getting the accounts from the temporary object's value__c field. It is accessing the right key from the parameter. But when i query salesforce for the temp records that have the same key it fatches no records.

 

 

This whole thing is done to send ids of account from one page to another.

 

 

Please give me a quick solution. Even if you have some other ideas to achieve the same functionality then please post them also.

 

 

 

Thanks in advanced. 

 

 

 

prageethprageeth

Hello DILIP__MISTRY;

It is difficult to say something about your problem without seeing your code. Sometimes you may not saving the data properly in to the database.

 

If your purpose is only to pass comma seperated id values from one page to another page, you can send them as an URL parameter as below.

 

 

In the controller of first page:public void setParameters() { String myIdString = '001xxxxxxxx,001xxxxxxxx,001xxxxxxxxx'; ApexPages.currentPage().getParameters().put('ids', myIdString);}In the controller of second page:public void retrieveParameters() { String idsFromUrl = ''; idsFromUrl = ApexPages.currentPage().getParameters().get('ids');}

  

 Or if you are using the same controller in both pages you can directly access the myIdString variable

DILIP KUMAR MISTRYDILIP KUMAR MISTRY

Thank you prageeth for your quick response

 

 

I also did thought the same like passing the comma-separated values as query parameter. But in my case there can be a large number of id can be in thousands. So i dont consider this a good solution to pass them as a query param.

 

 

My flow of code is like below:

 

 SendEmailController.class

=======================================

sendEmail() {

 // prepare an email

 

// insert a temp object using key (unique string) and value (comma- separated account ids)

 

// get the page reference of the pdf page [say it pageRef]

// set the key parameter for pdf page

 

// add an attachment in email using  pageRef.getContentAsPdf()

 

// sending email at this point

 

 

PdfPage.controller.class

======================== 

PdfPage.controller {

// get the key parameter from current page

  // Here i m getting the right key but using query for the key in Temp object i retrieves no record.

 

// get all accounts info using the value from temp object with the same key

 

// displays account info on the page

 

 

 

Please suggest on this or any compaible solution.

 

Thank you once again. 

prageethprageeth
Hello DILIP__MISTRY;
If you are sending a large amount of data using an url parameter, in Salesforce the normal get method is converted in to the post method automatically. Therefore I don't see an disadvantage(except security issues) of using this way.