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
ARJARJ 

Add attachments to Idea Base Theme VF page?

I have enabled Idea base theme in my org. I have configured it and have made few changes to IdeaPost VF page. Brought in custom fields from Idea object. Now as per my requirement, user should be able to attach a file which posting new idea. However, I am not able to use fields like AttachmentBody, AttachmentName, AttachmentContentType, AttachmentLength in idea Base Theme VF pages. 
The error message I see is "Error: Invalid field AttachmentContentType for SObject Idea". It seems, Base Theme VF pages do not recognize these fields (I think VF is a VF, be it on BT or plain VF, guess I am wrong????). Whereas I am using these fields in my plain (non Base themed) VF pages build in Idea Standard Controller correctly. 

Can anybody help? 
Andy BoettcherAndy Boettcher
No data object in Salesforce natively handles attachments.  You need to invoke the "Attachment" sObject to hold that information, then use Attachment.ParentId to associate that attachment record back to the Idea.  You will need to use a custom controller or extension for this.
ARJARJ
Thanks Andy for the response. However, I have already traversed that path. Attachment ParentID does not support Idea object. Only following objects are :
ID of the parent object of the attachment. The following objects are supported as parents of attachments:Account
Asset, Campaign, Case, Contact, Contract, Custom objects, EmailMessage, EmailTemplate, Event, Lead, Opportunity, Product2, Solution, Task.

Here is the link: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_attachment.htm

Any other option? Why despite Idea object having standard field named attachment, salesforce base theme do not recognize them? 
Andy BoettcherAndy Boettcher
Well heck - didn't know Idea was supported.  If that's the case, you're stuck that way unless you want to spin up a Custom Object with a Lookup to that idea, then attach the attachment to that linked custom object?
ARJARJ
That sounds like an option. Let me check if it gels well with my solution. Thanks for the input anyway.
ARJARJ
Dear all, using custom object definitely works good. However, is there any reason why standard idea Attachment field can not be used in this case?

 Standard Idea attachment field

Please let me know if anybody knows about it.