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
Jim BoudreauxJim Boudreaux 

Use Javascript to Create Attachment

How does one use javascript to create a salesforce object, like an attachment, fill some fields and insert the object?

Pradeep_NavatarPradeep_Navatar

Go through the sample code given below :

 

<script type = "text/javascript">

          var __sfdcSessionId = '{!GETSESSIONID()}';

 </script>

 <script src="../../soap/ajax/19.0/connection.js" type = "text/javascript"></script>

 <script>

          var Attachment  = new sforce.SObject("Attachment");

         Attachment.Title = "Att-1";

         // Assign all medotery fields for the Attachment record

         var result = sforce.connection.create([Attachment]);

  </script>