Copy link to clipboard
Copied
Hello,
We have adobe sign templates set up. They work perfectly and are attached to the correct master object and record. Now, we would like to have the template populate with all files on that record that match a naming convention (ie. start with "APP-").
Adobe support gave me a base Apex code to start from, but I need help knowing what to change in order to have it add ALL files on that record that match the naming convention, and how to properly set it up in Salesforce.
Here's the code they provided:
public static Id AgrId;
AgrId = echosign_dev1.AgreementTemplateService.load('a2K5e000000bNXVEA2','a104X00000VBtWLQA1');
System.debug(AgrId);
ContentDocumentLink cDocLink = new ContentDocumentLink();
cDocLink.ContentDocumentId = '0694X00000MFKXlQAP';//Add ContentDocumentId
cDocLink.LinkedEntityId = AgrId;//Add attachment parentId
cDocLink.ShareType = 'V';//V – Viewer permission. C – Collaborator permission. I – Inferred permission.
cDocLink.Visibility = 'AllUsers';//AllUsers, InternalUsers, SharedUsers
Insert cDocLink;
Copy link to clipboard
Copied
Also, I'm thinking this might help: https://developer.salesforce.com/docs/atlas.en-us.238.0.object_reference.meta/object_reference/sforc......Maybe I need to replace the entire ContentDocumentLink section above with some kind of looping query? And then build a flow?
Or maybe I should just be building a flow, period, to locate the files and then somehow shove them into my template files list?
(sigh...I know just enough to be dangerous and not enough to make it work). Help?