• S RAHMATHULLA
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 1
    Replies
this is my first map
 Map < string,List < Id > > finalEmailSoinvIdMap = new Map < string,List < Id > >();
Map < Id,rstk__soconpbill__c > contractPeriodcBillingRecord = new Map < Id,rstk__soconpbill__c >([SELECT Id,rstk__soconpbill_soinv__c FROM rstk__soconpbill__c WHERE rstk__soconpbill_soinv__c IN:finalEmailSoinvIdMap.values()]);

what is wrong in this? Please help
Errror:Invalid bind expression type of List<Id> for column of type Id

Hi All,

I built a VF page with custom controller which calls another VF page that returns a PDF. The PDF is is extracted via getContent(), and attached to an email. It all works fine in the sandbox through the UI, but the test method fails, unfortunately without detailed log information.

 

I already found these two threads but none really points to an explanation why it fails in test methods while working fine in the UI:

http://community.salesforce.com/t5/Apex-Code-Development/error-quot-System-VisualforceException-quot-at-getContent/td-p/173307?view=by_date_ascending

 

http://community.salesforce.com/t5/Apex-Code-Development/RageReference-getContent-failing-on-Spring-10-release/td-p/168272

 

Here is the relevant code from the action method:

 

    public PageReference send(){

        for (string address:CCAddresses)
        {
        	if(!address.endsWith('@symmetricom.com')) address += '.full';
        }
        
        PageReference pdfPage = Page.quotePDF;
        pdfPage.getParameters().put('id',theQuote.ID);
        //pdfPage.setRedirect(true);
        System.Debug('pdfPage::::::::::::::::::::::::::::::::::::::: ' + pdfPage);
        transient Blob theBlob;
        theBlob = pdfPage.getContent();
        
        transient Attachment a = new Attachment (
            parentID = theQuote.ID,
            name = 'SymmQuote ' + theQuote.Name + '.pdf',
            body = theBlob);
        

 It fails at the line theBlob = pdfPage.getContent(); when called from the test method, otherwise it works fine. Error message is:

System.VisualforceException: List has no rows for assignment to SObject

The quotePDF page uses the same controller and I was wondering if that causes the issue. Maybe the test cannot handle another instance of the same controller? The PageReference for the pdfPage is created correctly

 

here is the test method:

 

		PageReference pageRef2 = Page.quoteSend;
		Test.setCurrentPage(pageRef2);
		ApexPages.currentPage().getParameters().put('id',quote1.Id);
		quoteLineEdit_v1 editController2 = new quoteLineEdit_v1();
		
		editController2.send();