You need to sign in to do that
Don't have an account?
rohitmarathe
Attaching file with the Leads record
Hi
Using .net API I am developing an application to insert leads records into the SalesForce account.With each record I want to give a user facility to upload a file from his local drive which will be stored into the salesforce in association with the lead record.
Is there any way to achieve this?
Thanks
Hi ,
I have found a complete solution for my problem on following link.You need to include partner WSDL to use this.I have a mdified version of this using asp file upload control.Feel free to contact me if you want that code
http://community.salesforce.com/sforce/board/message?board.id=NET_development&thread.id=1876&view=by_date_ascending&page=1
You can refer following code snippet which is nothing but the modified version of the code on above link.Here Resume_upload is asp file upload server control.The code is written in VB.NET
If Resume_upload.FileName <> "" Then
Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument
Dim any(3) As System.Xml.XmlElement
'We can do a similar thing for an attachment
Dim attach As sForcePartner.sObject = New sForcePartner.sObject
attach.type = "Attachment"
attach.Any = any
attach.Any(0) = xmlDoc.CreateElement("Name")
attach.Any(0).InnerText = Resume_upload.FileName
attach.Any(1) = xmlDoc.CreateElement("IsPrivate")
attach.Any(1).InnerText = "false"
attach.Any(2) = xmlDoc.CreateElement("ParentId")
attach.Any(2).InnerText = strRecordId
attach.Any(3) = xmlDoc.CreateElement("Body")
attach.Any(3).InnerText = Convert.ToBase64String(Resume_upload.FileBytes)
Dim sr As sForcePartner.SaveResult = binding.create(New sForcePartner.sObject() {attach})(0)
If (sr.success) Then
'success
Else
'error
End If
Else
'No attachment
End If
Message Edited by rohitmarathe on 04-02-2008 09:56 PM