You need to sign in to do that
Don't have an account?
ramesh
how we can move notes and attachments from one account to another account through code? Kindly help me on this.
Hi All,
how we can move notes and attachments from one account to another account through code?
Kindly help me with this.
how we can move notes and attachments from one account to another account through code?
Kindly help me with this.
As per https://help.salesforce.com/s/articleView?id=000380667&type=1,
"In Lightning regardless of whether the feature is on or off, uploading a document in the Notes and Attachments related list will still result in the document being added as a Salesforce File."
This implies you need to transfer files between accounts. Files are stored in the ContentDocument Object .You can make use of below code to get started
Related: https://salesforce.stackexchange.com/questions/138860/how-to-query-a-file-uploaded-as-an-attachment-in-lightning-experience
https://theblogreaders.com/insert-files-using-salesforce-apex/
If this information helps, please mark the answer as best. Thank you
All Answers
You can try below code snippet and customize as per your requirement
Basically, the idea here is to Query the notes and attachments related to the source account and filter by the ParentId field. Then loop through the queried records and create new Note and Attachment records with the same information, but with the ParentId set to the Id of the target account. Then Insert the newly created records
Related:
https://ideas.salesforce.com/s/idea/a0B8W00000GdiJ0UAJ/transfer-notes-attachments-to-another-object
https://developer.salesforce.com/forums/?id=906F0000000DAEIIA4
If this information helps, please mark the answer as best. Thank you
Note that this code snippet does not delete the notes & attachments from your source account. But copies to target account. Thanks
i Query using same account Id as parent id its show null values
As per https://help.salesforce.com/s/articleView?id=000380667&type=1,
"In Lightning regardless of whether the feature is on or off, uploading a document in the Notes and Attachments related list will still result in the document being added as a Salesforce File."
This implies you need to transfer files between accounts. Files are stored in the ContentDocument Object .You can make use of below code to get started
Related: https://salesforce.stackexchange.com/questions/138860/how-to-query-a-file-uploaded-as-an-attachment-in-lightning-experience
https://theblogreaders.com/insert-files-using-salesforce-apex/
If this information helps, please mark the answer as best. Thank you