• Andreas Maly
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hi everyone,

 

I am fairly new to Visualforce development, so please forgive me if I am asking something obvious here. Somehow I got the feeling I do, because what I am trying to achieve does not seem far-fetched to me or out-of-the-common in any way.

 

So here we go:

I basically need to recreate the default Task Edit page. That's no problem, and I can successfully edit all desired Task fields within my custom edit task page.

However, I am struggling very much with adding the "Attachments" related list, because whenever I edit a task, I also want to be able to add attachments to that task. That by the way is exactly the behavior I find within the standard task edit page: Editing a task allows me to add attachments.

 

In my case however, whenever I turn to my edit task page, I see the list of related attachments, but the button "Add Attachment" does not appear on the list. And I can't seem to figure out what I am doing wrong or even better, how to do it right.

 

So you can better relate to my problem, here's some sample code that visualizes my problem:

 

<apex:page standardController="Task">
    <apex:form>
        <apex:pageblock mode="edit" title="Edit Task">
            <apex:pageblockbuttons>
                <apex:commandbutton value="Save" action="{!Save}"/>
                <apex:commandbutton value="Cancel" action="{!Cancel}"/>
            </apex:pageblockbuttons>
            <apex:outputpanel >
                <apex:pageblocksection showheader="false">
                    <apex:inputfield value="{!Task.Subject}" required="true"/>
                </apex:pageblocksection>
            </apex:outputpanel>
        </apex:pageblock>
    </apex:form>
    <apex:relatedList list="Attachments"  subject="{!$CurrentPage.parameters.id}" />
</apex:page>

 

Using this page as the system-wide task edit page, it allows me to edit the task's Subject (I removed all other fields for brevity of code), but it does not allow me to add attachments to the related list integrated into the edit page.

 

I already tried a few different variations of where to place the apex:relatedList within that Visualforce code, but I can't find the solution. And I would be very thankful if anybody out there could point me into the right direction or point out any obvious mistakes I am making.

 

 

Thank you all for reading, and already thank you for any feedback,

 

        Andy