docusign / docusign-esign-csharp-client

The Official Docusign C# Client Library used to interact with the eSignature REST API. Send, sign, and approve documents using this client.
https://developers.docusign.com/docs/esign-rest-api/sdks/csharp/
MIT License
129 stars 159 forks source link

Pre-filling multiple text tabs with the same label #93

Closed brbeaird closed 5 years ago

brbeaird commented 8 years ago

A little-known feature of DocuSign is you can actually use a single tab label to prefill multiple fields on the same document. For example, you may need to put a signer's phone number in multiple fields. You can do this by setting those fields to the same data label in the template. Then, when you set a value for that tab in the API, you need to prefix the tab label with "\*". However, this doesn't work with the current c# library because the functions end up trying to escape that string with an extra set of "\."

I submitted a pull request as a potential fix to this, although it feels like a hack to me to just un-escape the * tabs, so if someone else can figure out a cleaner way or else suggest another alternative for me, go for it.

Credit to: http://stackoverflow.com/questions/26320678/docusign-how-to-prefill-multiple-text-tabs-with-the-same-label-in-xml

MarsMayflower commented 8 years ago

Hey, thanks! Great info, I will give this a shot.

brbeaird commented 8 years ago

Oops - just noticed even my comment above got escaped unintentionally! I've fixed it. The key is to send two backslashes followed by an asterisk. When DocuSign sees that, it knows to use that merge value to fill in ALL instances of tabs that have that data label.

MarsMayflower commented 8 years ago

Yup, worked perfectly!!!! You just made my day. Huge thanks.

MarsMayflower commented 8 years ago

By the way, I had no issue prefixing the tabLabel property with "*" in the C# api. Worked like a charm.

MarsMayflower commented 8 years ago

and yea, it is also removing a slash in my post above..... "backslash-backslash-asterisk" should be the prefix

brbeaird commented 8 years ago

Oh interesting - so you just did something like:

TextTabs.TabLabel = "\\*MyLabel"

And that worked without you changing anything? Weird. Without my customized hack to the library code, that did not seem to work for me last week because it was sending four slashes.

MarsMayflower commented 8 years ago

Yes, I am concatenating it just like your example and it is working for me.

stivenariza commented 6 years ago

Thanks! @brbeaird it's work for me. Regards.

brbeaird commented 5 years ago

Finally circling back on this now that we're using the nuGet package instead of compiling our own version. I confirmed that I can use multiple fields with the same label if I prefix the label with a single blackslash and asterisk (not two backslashes like mentioned above). Two backslashes will result in four total when Newstonsoft escapes them while serializing the object.

I'll also remove my old pull request.