Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Re: Dynamic Content in Attachment?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Dynamic Content in Attachment ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 12:57 AM
Hello people,
We have a requirement where we have to send email on submission of a form. The email should have an attachment which has dynamic content based on the record. I couldn't find any OOTB feature that will allow me to do so. But if I missed something here, please advice.
Coming to doing this using Apex, in my submit code (it's just a simple button click), I am inserting contacts and then using a visualforce page which is rendered as pdf to give me a blob which I'm then attaching to my email. The visualforce page has StandardController, so passing the id would give me record-specific data.
However, the issue I am facing here is that when the .getContent() method is called from my code, I get an "unable to retrieve object" error. Is it that since the record has just been inserted and immediately I'm using it's standard controller?
It is the same issue here too :
http://boards.developerforce.com/t5/Apex-Code-Deve
Any ideas/solutions?
Kudos a post if it helps, mark it as solution if it solves.
http://exploretheforce.blogspot.in
Re: Dynamic Content in Attachment ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 04:29 AM
Why not using a VF email template ?
You could have a PDF as attachment.
Re: Dynamic Content in Attachment ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-17-2012 11:20 PM
But I can have a single attachment for all emails, so it will not let me have dynamic data for each email
Kudos a post if it helps, mark it as solution if it solves.
http://exploretheforce.blogspot.in
Re: Dynamic Content in Attachment ?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-18-2012 01:19 AM
Hello,
With a VF email template, you have dynamic data, like a registration form populated as a PDF attachment.
You can also have the same file as attachment.

