• Paul Bénard
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi Guys,

I have a strange problem when I am attaching a Pdf to an object.

this is my code:

the id of the object relance in order to attach the pdf to this object :
                    Id parentId = relanceFromList.id;

Now I am creating the pdf:
                    PageReference pageRef =  page.VFP_PDFCreate;  //controller which create the page/pdf
                    pageRef.getParameters().put('id',parentId); //put the id of my object in order to do some operation in another controller

And I put in the attachment the pdf:
                    Attachment attach = new Attachment();
                    attach.ParentId = parentId;
                    Blob body;
                    try
                    {
                        body = pageRef.getContent();
                    }
                    catch (VisualforceException e)
                    {
                        body = Blob.valueOf('Error : ' + e);
                    }
                    attach.Body = body;
                    attach.Name = Datetime.now().format('yyyy-MM-dd HH:mm') + '-' + parentId + '.pdf';
                    attach.IsPrivate = false;
                    List_Attach.add(attach);

}
...
upsert(List_Attach);

The strange thing is that when I am putting an Id manually: Id parentId = '01pb0000003AfqY'  <= example
I can acces to the attachment from the page https://eu2.salesforce.com/01pb0000003AfqY in the related lists.

=>But If I am putting the Id of my object relance dynamically(how it is describe in this code) I can see the attachment in the related list of my object relance but when I click on the link the error "Failed to load the PDF files" appears.

If you have any idea, please inform me.
If  the given informationsare not sufficients, tell me also.

Thank you in advance

p.b.
Hi Guys,

I have a strange problem when I am attaching a Pdf to an object.

this is my code:

the id of the object relance in order to attach the pdf to this object :
                    Id parentId = relanceFromList.id;

Now I am creating the pdf:
                    PageReference pageRef =  page.VFP_PDFCreate;  //controller which create the page/pdf
                    pageRef.getParameters().put('id',parentId); //put the id of my object in order to do some operation in another controller

And I put in the attachment the pdf:
                    Attachment attach = new Attachment();
                    attach.ParentId = parentId;
                    Blob body;
                    try
                    {
                        body = pageRef.getContent();
                    }
                    catch (VisualforceException e)
                    {
                        body = Blob.valueOf('Error : ' + e);
                    }
                    attach.Body = body;
                    attach.Name = Datetime.now().format('yyyy-MM-dd HH:mm') + '-' + parentId + '.pdf';
                    attach.IsPrivate = false;
                    List_Attach.add(attach);

}
...
upsert(List_Attach);

The strange thing is that when I am putting an Id manually: Id parentId = '01pb0000003AfqY'  <= example
I can acces to the attachment from the page https://eu2.salesforce.com/01pb0000003AfqY in the related lists.

=>But If I am putting the Id of my object relance dynamically(how it is describe in this code) I can see the attachment in the related list of my object relance but when I click on the link the error "Failed to load the PDF files" appears.

If you have any idea, please inform me.
If  the given informationsare not sufficients, tell me also.

Thank you in advance

p.b.

I'm getting the attached error when attempting to install the latest Force.com IDE plugin on the latest Eclipse version with the latest JDK installed.  The error comes up after I click next on the "Available Software" selection screen of the "Install New Software" dialog.  How can I fix this problem?  Thank you!

 

 

Cannot complete the install because of a conflicting dependency.
  Software being installed: Force.com IDE 20.0.1.201011121559 (com.salesforce.ide.feature.feature.group 20.0.1.201011121559)
  Software currently installed: Shared profile 1.0.0.1284708747720 (SharedProfile_epp.package.java 1.0.0.1284708747720)
  Only one of the following can be installed at once: 
    Structured Source Editor 1.2.2.v201008232126 (org.eclipse.wst.sse.ui 1.2.2.v201008232126)
    Structured Source Editor 1.1.102.v200910200227 (org.eclipse.wst.sse.ui 1.1.102.v200910200227)
  Cannot satisfy dependency:
    From: Shared profile 1.0.0.1284708747720 (SharedProfile_epp.package.java 1.0.0.1284708747720)
    To: org.eclipse.wst.sse.ui [1.2.2.v201008232126]
  Cannot satisfy dependency:
    From: Force.com IDE 20.0.1.201011121559 (com.salesforce.ide.feature.feature.group 20.0.1.201011121559)
    To: org.eclipse.wst.html.ui [1.0.0,2.0.0)
  Cannot satisfy dependency:
    From: HTML UI Source Editor 1.0.401.v200908111935 (org.eclipse.wst.html.ui 1.0.401.v200908111935)
    To: bundle org.eclipse.wst.sse.ui [1.1.0,1.2.0)

 

 

  • February 03, 2011
  • Like
  • 0