0
response = requests.post('https://%s.salesforce.com/services/data/v29.0/sobjects/Attachment/' % instance,
    headers = { 'Content-Type': 'application/json', 'Authorization': 'Bearer %s' % sessionId },
    data = json.dumps({
        'ParentId': '*******',
        'Name': 'rest_test.txt',
        'body': body
    })
)

This is the code I'm using to upload it. I get a successful response,however, the attachment isn't below the Account. I'm giving the id of the account to the ParentId key as a value.

  • 2
    Most likely you are looking at the wrong Related List. Attached files in Lightning are ContentDocument/ContentVersion, not Attachment. You can run SOQL queries to confirm that your Attachment is bring created. – David Reed Jun 22 at 23:41
0

Navigate to salesforce setup Then to Object Manager -> (the object you want the attachment to be uploaded to) so for me I chose contact Then to page layouts -> (Object i.e contact) layouts finally drag notes & attachments

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.