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
SimmoSimmo 

Create a case and automatically attach a file?

I want to be able to create a Case and when the Case is created automatically link a File or Attachment.

I have a word document that I want attached to cases when they are created.

What is the best way to achieve this? Presumably it will require Apex code? Will I need to make a copy of the Word document from somewhere then create the required File records to attach it to the Case?
 
Best Answer chosen by Simmo
Dushyant SonwarDushyant Sonwar
You need to reference the body of the document i.e copy the body of document and then create new attachment (salesforce attachment objects)records.

Hope this helps!

All Answers

Dushyant SonwarDushyant Sonwar

First upload your word document in salesforce document object

You need to create a trigger on Case Object  and query that uploded document and create attachment records .

Example 
https://www.sfdc99.com/2013/05/12/example-how-to-write-a-simple-apex-trigger-2/ 

Hope this helps.

SimmoSimmo
Thanks for the response Dushyant.

If I reference the document in the trigger, will I need to make a copy of the document, then link the new document to the Case?

I want a new copy of the document attached to every new case.
 
Dushyant SonwarDushyant Sonwar
You need to reference the body of the document i.e copy the body of document and then create new attachment (salesforce attachment objects)records.

Hope this helps!
This was selected as the best answer
SimmoSimmo
Thanks Dushyant