Skip to main content

Hello DocuSign Community,

I am currently creating an envelope with multiple merge fields positioned using anchor tags. The client edits these merge fields before completing the document, and the values are then written back to Salesforce. In another process, I want to send this document to another recipient using the Apex Toolkit and a trigger, which works well.

However, I need the previously used merge fields to be read-only in this new context. I'm encountering challenges in recognizing these merge fields through anchor tags in Apex and setting them as read-only.

Here’s a snippet of my code for context:

dfsle.Recipient customer = dfsle.Recipient.fromSource(
'*****',
'********',
null,
s.roleName,
new dfsle.Entity('*****')
).withTabs(new List<dfsle.Tab> {
new dfsle.TextTab()
.withMergeField(myMergeField2) // Associate this tab with the mergeField
.withReadOnly(true) // true = read only or locked
.withAnchor(new dfsle.Tab.Anchor('\\test_1_text\\', false, false, null, false, false, 'pixels', 80, -50))
.withDataLabel('Opp Name')
});

 

Hi Tom!

Your code snippet looks correct and should create a new Tab in the appropriate location relative to the text “\\test_1_text\\”.

However, you need to check if myMergeField2 is linked to the appropriate Salesforce object and if it’s set to allow writeback, so that you can use its value in the other process. 

You can check an example here:

https://www.docusign.com/blog/developers/sending-merge-fields-using-the-apex-toolkit

 


Hi @Lucas.Machado ,

thanks for your reply. Actually that is not exactly what i am looking for. The merge fields are placed automatically without any configuration in my apex code. What i am trying to archive is to mark them as readOnly. I am not able to update the merge field in the docusign configuration, because i only want to send the read only field via apex. Unfortunately i am not able to configure merge fields for each template separately. 


Reply