- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
11-04-2010 04:38 AM - edited 11-04-2010 05:21 AM
Here's my case, I've got 5 URL fields for opportunity attachments in the Documentation section:
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.
11-04-2010 05:05 AM - edited 11-04-2010 05:05 AM
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.
11-04-2010 05:24 AM - edited 11-04-2010 05:25 AM
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.
11-04-2010 05:31 AM
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.
11-04-2010 05:38 AM
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.