Duplicate attachment to another record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abidoss
    Senior Member
    • Mar 2023
    • 252

    #1

    Duplicate attachment to another record

    How can I copy (duplicate) an attachment via a flowchart or workflow, without keeping the same ID when copying it to another record?
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 9465

    #2
    You need to create a new Attachment record with 'sourceId' set to the sourceId of the Attachment record you copy or the id of the sourceId is empty.

    Code:
    $sourceId = $attachmentAttributes['sourceId'] ?? $attachmentAttributes['id'];
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • abidoss
      Senior Member
      • Mar 2023
      • 252

      #3
      I didn’t quite understand how this works — is it possible through a formula or a script before launching the BPM?

      Comment

      Working...