+ 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>