I recently implemented the Adobe Sign integration with Dynamics CE and encountered a new use case. I needed to add a document to an Agreement Template from inside Dynamics CE but the existing Adobe Sign Agreement Template functionality wasn’t suitable for my needs. Instead, I needed to utilize a file generated from a specific Dynamics CE record as part of my business process. Fortunately, I found a simple set of Flow steps that allowed me to achieve this.
The key thing to understand is the structure of the Agreement Document table used by the Adobe Sign integration.
After testing the standard Adobe Sign integration functionality and doing some trial and error, I found that the actual file is stored in a Note with the ‘Regarding’ field set to the Agreement. The Agreement Document subgrid on the form links to that note by storing the Primary Key of the Note in the Agreement Document record’s ‘Name’ field.
My Flow is triggered when an Agreement is added.
Get your File
I then get my file, which was stored in SharePoint via the standard SharePoint Integration with Dynamics CE. If you stored your file as a Note, then you could get that Note through a simpler process that doesn’t deal with the SharePoint integration. Since this blog isn’t about the SharePoint integration I won’t go into too much detail on this portion of the process, but the key callout is to get the file you need to add.
To get my file, I first do a Get a row by ID step on the Project record associated with my Agreement.
I then do a List Records step on the Document Locations table to get the single Document Location record specific to my Project record.
Next I do a Get files (properties only) step to find the SharePoint file associated with that Document Location.
Then I finally get my file content using a Get file content using path step and utilizing the properties from the prior step.
Add your File to Agreement
Once you have the file you need, create it as a new Note using an Add a new row step. Basing my Note on the Notes that are normally generated by the Adobe Sign integration, I kept the Title blank by setting it to null. I uploaded my file into the Note by setting Is Document to Yes and setting the Document field as base64(outputs(‘Get_file_content_using_path’)?[‘body’]). I set the file name from my prior step as body(‘Get_files’)?[‘value’][0][‘{FilenameWithExtension}’]. And I set the file as regarding the Agreement record that triggered the flow.
The last step is to create the Agreement Document record that will associate the Note with the Agreement in the way that the Adobe Sign integration uses. To do that, add another Add a new row step on Agreement Document. Then populate the Name column with the Primary Key of the Note record you just created. Populate the Agreement field with the trigger Agreement and set the filename with the same value used on the Note; body(‘Get_files’)?[‘value’][0][‘{FilenameWithExtension}’].
Your flow will now automatically add your file to new Agreements! Full flow steps below.