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
Etienne GenelotEtienne Genelot 

Create a link for my attachment in Account 

Hi all,
I m stuck to create a link for my attachment in Account 

<apex:outputlink value="/servlet/servlet.FileDownload?file={!Attachment.id}" target="_blank">View</apex:outputlink>

Could you please help me ? 
​​​​​​​Thanks
Balu_SFDCBalu_SFDC
HI,

Please pass your ORG Full URL and see..
<apex:outputlink value="https://<yourDomain>.content.force.com/servlet/servlet.FileDownload?file={!Attachment.id}" target="_blank">View</apex:outputlink>

And make sure the the {!Attachemnt.Id} has value means the Id exist or not from the APEX.

Let me know if this helps for you.
Etienne GenelotEtienne Genelot
Thank you for your reply Balu,
I think Attachement.Id do'nt exist because I have 1 problem : Unknown property 'AccountStandardController.Attachment'
I need to create an Apex triger ?
 
Raj VakatiRaj Vakati
Can you give the code ?? 

If you dnt have Attachemnt Id then dnt render the link 

 
Raj VakatiRaj Vakati
Can you give the code ?? 

If you dnt have Attachemnt Id then dnt render the link 

Etienne GenelotEtienne Genelot
Hi Raj,
This is my code : 
<apex:page standardController="Account" >
    
<apex:pageBlock title="Account Details">
    <apex:pageBlockSection >
        <apex:outputField value="{! Account.Name }"/>
        <apex:outputField value="{! Account.Phone }"/>
        <apex:outputField value="{! Account.Industry }"/>
        <apex:outputField value="{! Account.AnnualRevenue }"/>
        <apex:outputLink value="https://google.fr" id="theLink">Lien</apex:outputLink>
        
     
    </apex:pageBlockSection>
</apex:pageBlock>
    
  <apex:pageBlock title="NotesAndAttachments">
   <apex:pageBlockTable value="{!Account.CombinedAttachments}" var="note">
<apex:column value="{!note.title}"/>
       <apex:outputlink value="https://cunning-raccoon-173152-dev-ed--c.eu10.content.force.com/servlet/servlet.FileDownload?file={!Attachment.id}" target="_blank">View</apex:outputlink>
 
      
      </apex:pageBlockTable>
</apex:pageBlock>
     
 
   
   
 

</apex:page>

and I have an attachment :https://i.imgur.com/aRPi800.png

Thank you