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
dev perdev per 

Attachment URL contiains a different domain name

Hi,

I have an attachment in Notes & Attachment for a custom object(Cust A). On Cus A object, I created a formula field(see formula below) to generate URL for the latest attachment.

When I click on the formula field URL,  it throws this error "Insufficient Privileges.You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary."

But it works fine I click on the  view link from the note & attachment relatedlist.

On comparing both URL, below is how it looks

Url on Notes & Attachment view:
https://xxxx--stage--c.cs28.content.force.com/servlet/servlet.FileDownload?file=00Pxxxxxxxxxx

Url on the formula field view:
https://xxxx--stage.cs28.my.salesforce.com/servlet/servlet.FileDownload?file=00Pxxxxxxxxxxx

Formula -- 

The only difference I see is the namespace "--c". How do I handle this in Formula?

IF (NOT(ISBLANK(AttachmentId__c)),HYPERLINK('/servlet/servlet.FileDownload?file=' + AttachmentId__c, $Label.View, '_blank'),NULL)