+ Start a Discussion
SMasterSMaster 

How to add a custom field in an Attachment???

Hi,

 

I have created a visualforce page to upload an attachment for a custom object. Now I simply want to create a new field "Type of Attachment" (Drop Down Field) with that attachment .. just to make my user understand that what kind of attachment it is.... and that Field ofcourse should get visible inside Notes and Attachment related list......

 

Can it be done....

Best Answer chosen by Admin (Salesforce Developers) 
Pradeep_NavatarPradeep_Navatar

Notes and Attachement list are not customizable so we can not create a custom field in notes and attachment. Goto account page layout then you will see "the list is not customizable."  for notes and attachement.

All Answers

_Prasu__Prasu_

That is not possible. You cannot create any custom fields on Attachment object.

 

--

Prasanna

SMasterSMaster

Sir,

 

If..this is not possible.. can i create a Drop Down field on the visualforce page with some values prepopulated....

 

and as i select any of those and click save button that should get displayed on the Visulaforce page....

 

please suggest how can i do that....

Pradeep_NavatarPradeep_Navatar

Notes and Attachement list are not customizable so we can not create a custom field in notes and attachment. Goto account page layout then you will see "the list is not customizable."  for notes and attachement.

This was selected as the best answer
SMasterSMaster

Hello Sir,

 

I understood the point you have made...

 

But sir.. please let me know is there any way to create the visualfoce page all together.. to display all the notes and attachment..... with some custom fields inside it...

 

In that case i'll not be using the standard Notes and Attachment... rather i'll create the New visualforce page to upload an attachment and display an attachments on another or same visualforce page....however i should also be able to download an attachment frm that visualforce page...

 

can it be done... sir??

RGardnerRGardner

You can display all the notes and attachments in a visualforce page, but no custom fields on the attachment object. What I've done on a similar page is made an attachment wrapper class in Apex. Basically, the class consists of an attachment object and some custom fields. Those fields aren't saved anywhere in the database, but I use them in the code to figure out some business rules about what do with the attachments.

 

You can also make an "in between" object to store some data. We use an object called Opportunity Attachments to save some custom information about certain attachments as they relate to the opportunity.

 

Here's an example of my wrapper class:

/* Attachment Wrapper class */
public class attachmentWrapper{
	public Boolean selected {get; set;}
        public String attachmentType {get; set;}
public Attachment att {get; set;} public attachmentWrapper(Attachment a){ att = a; selected = true; } }

 

I know this is post is almost a year old, but hopefully this will help if anyone still has questions.

Brad BarrowesBrad Barrowes
You can attach files to custom objects by going to the page layout of the custom object you are trying to attach things to, click edit, under Publisher Actions click "Override Global Publisher Actions," and now you can attach files--like pictures--from Salesforce1!

Thanks!  Here's a file that helped me figure it out--specifically step 8:

http://ccoenraets.github.io/salesforce1-app-tutorial/chatter-feed.html

Brad
Brad BarrowesBrad Barrowes
Also, don't forget to enable Chatter Feed Tracking on your custom object, and make sure you have the Notes and Attachments related list on your custom object's page layout.

To enable Chatter Feed Tracking, from setup, go Customize, Chatter Feed Tracking, select your custom object, and click the "Enable Feed Tracking" checkbox.

Attaching things from your phone won't work if you don't do these things.

Thanks guys!

Brad