Skip to content

Commit 45baf6f

Browse files
Merge pull request #22 from harshitav-docusign/Flow-391
Add GetEnvelopeDocumentFields custom method
2 parents 4bade51 + 6a1e357 commit 45baf6f

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

certified-connectors/DocuSignDemo/apiDefinition.swagger.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@
545545
"/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields": {
546546
"get": {
547547
"summary": "Get envelope document custom fields",
548-
"description": "Get envelope document custom fields.",
548+
"description": "Get custom document fields of envelope document.",
549549
"operationId": "GetEnvelopeDocumentFields",
550550
"parameters": [
551551
{

certified-connectors/DocuSignDemo/script.csx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1797,6 +1797,29 @@ public class Script : ScriptBase
17971797
body["workflowIds"] = workflowsArray;
17981798
response.Content = new StringContent(body.ToString(), Encoding.UTF8, "application/json");
17991799
}
1800+
1801+
if ("GetEnvelopeDocumentFields".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
1802+
{
1803+
var body = ParseContentAsJObject(await response.Content.ReadAsStringAsync().ConfigureAwait(false), false);
1804+
var query = HttpUtility.ParseQueryString(this.Context.Request.RequestUri.Query);
1805+
var newBody = new JObject();
1806+
JArray envelopeDocumentFields = new JArray();
1807+
1808+
foreach(JProperty documentFields in body.Properties())
1809+
{
1810+
foreach(var field in documentFields.Value)
1811+
{
1812+
envelopeDocumentFields.Add(new JObject()
1813+
{
1814+
["name"] = field["name"],
1815+
["value"] = field["value"]
1816+
});
1817+
}
1818+
}
1819+
1820+
newBody["envelopeDocumentFields"] = envelopeDocumentFields;
1821+
response.Content = new StringContent(newBody.ToString(), Encoding.UTF8, "application/json");
1822+
}
18001823

18011824
if ("GetEnvelopeDocumentTabs".Equals(this.Context.OperationId, StringComparison.OrdinalIgnoreCase))
18021825
{

0 commit comments

Comments
 (0)