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
rumdumdumrumdumdum 

Mapping Attachments Back to URL Fields

Hi All,

 

Here's my case, I've got 5 URL fields for opportunity attachments in the Documentation section:

 

doc

 

 

When someone click the Add link they are take to the standard attachment upload page. When the document is attached an after insert trigger fires and updates the parent record(Opportunity) with the attachment link.

 

The problem i'm having is how to distinguish what type of document is uploaded so the appropriate URL field is updated.

 

Tried few workarounds without success.

 

Would appreciate your help and suggestion.

 

Thanks

Richard

Imran MohammedImran Mohammed

I am not sure what you mean with type of document here.

Did you try to query the contenttype field on Attachment object which stores the attachment type?

 

And the image you posted is not visible.

rumdumdumrumdumdum

i've change the image source.

 

By type i mean witch field should the document go to, is this a Contract or Order Document. I need to give the user an option to select what document he's uploading or do it in the background. Afterwards use a trigger to update the URL fields.

 

Thanks Imran for the reply.

Imran MohammedImran Mohammed

I feel you should give User an option to select what type of document he will upload.

Doing this will help you in further processing in your trigger.

rumdumdumrumdumdum

That's what i'm having trouble with, where to give user the ability to select what type of document he/she is uploading.

 

I don't want them to go in the edit screen, i was thinking about a formula field with 5 hyper links each with a different parameter, but how do i pass this parameter in to the after insert trigger when the user attaches a document.