cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
NordKapp
Level: Powered On

View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Hi,

I’m working on a flow using the DocuSign: When an envelope status changes (Connect) trigger. My goal is to file a completed document on SharePoint, after pulling the custom fields in the envelope and assigning them as metadata fields. I’ve unit tested all parts of the flow, except I’m unable to recognize custom fields. I’m following the provided example (page 4).

 

Here's what my flow looks like:a.png

 

My Docusign Template has multiple custom fields, but they are not being returned when the flow triggers:

b.PNG

 

Oddly enough, the custom fields are showing up in the trigger output for RecipientStatus > "TabStatuses":

"TabStatuses": {
      "TabStatus": [
        {
          "TabType": "FullName",
          "Status": "Signed",
          "XPosition": "144",
          "YPosition": "1192",
          "TabLabel": "Name bcd3ee67-8ff1-47b6-9b09-26e4cd59bbe1",
          "TabName": "FullName",
          "TabValue": "test",
          "DocumentID": "1",
          "PageNumber": "2"
        },
        {
          "TabType": "Title",
          "Status": "Signed",
          "XPosition": "144",
          "YPosition": "1275",
          "TabLabel": "Title 184a7b62-ebdf-4ff2-bcbd-510331c6f5de",
          "TabName": null,
          "TabValue": "test",
          "DocumentID": "1",
          "PageNumber": "2"
        },
        {
          "TabType": "Custom",
          "Status": "Signed",
          "XPosition": "146",
          "YPosition": "1533",
          "TabLabel": "NDAType",
          "TabName": "MNDA;UNDA",
          "TabValue": "MNDA",
          "DocumentID": "1",
          "PageNumber": "2",
          "OriginalValue": "MNDA",
          "ListValues": "MNDA;UNDA",
          "ListSelectedValue": "MNDA",
          "CustomTabType": "List"
        },

 I was able to pull the fields from RecipientStatus using something like: 

triggerBody()?['DocuSignEnvelopeInformation']?['EnvelopeStatus']?['RecipientStatuses']?['RecipientStatus'][0]['status']

The issue is that the trigger fires every time an envelope is completed, and the arrays aren't always in the same order and I'd need to implement some extensive error checking or lookup, which isn't easy to do in Flow...

 

Has anyone successfully used the custom fields functionality of this trigger before? If I could pull the fields in the way shown by the docusign example (linked above), this flow would be way more reliable.

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
NordKapp
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Would you please post the expression in the initiailze variable step?

Also, they gave me two options for calling the custom fields, see full ticket text below:

 

The trigger output expression ['customFields'] refers to Envelope Custom Fields rather than Document Custom Fields. Document Custom Fields are typically referred to as "tabs" rather than "custom fields" in both DocuSign Connect and the DocuSign API. You're headed in the right direction with the RecipientStatus section. Our scope of support for Flow is limited to the out-of-the-box triggers and actions, so we wouldn't typically be able to provide guidance on how to set up the trigger output expressions. That being said, I'd be happy to share the details of two methods we've identified for pulling the information.


Method 1: Uses the “tabs” section of the event notification 
Works only with text fields, Full Name, and Date Signed
x = recipient position in the Connect message, starting at 0
your_tab_name = field data label

triggerOutputs() .body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatus.RecipientStatus[x]['tabs']['your_tab_name'] 

Method 2: Uses the "FormData" section of the event notification.
Works with all field types
You can specify the field data to be retrieved either with the tab label or with its position (as a numeric value) in the FormData section of the event notification-- this example uses the tab label
x = recipient position in the Connect message, starting at 0
your_tab_name = field data label

triggerOutputs() .body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatus.RecipientStatus[x]['FormData']['xfdf']['fields']['field’]['your_tab_name']['value’]



Note: I went about this successfully using a slightly modified version of method 2

 

Capture.PNG

 

First I initialized two arrays with the following expressions:

Array 1 (Recip1Fields Array):
triggerOutputs().body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatuses.RecipientStatus[0]['FormData']['xfdf']['fields']['field']
 
Array 2 (Recip2Fields Array):
triggerOutputs().body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatuses.RecipientStatus[1]['FormData']['xfdf']['fields']['field']
 
This is because we have two senders in our template. Note that the RecipientStatus starts at zero.


Next, I initialized string variables for each of the custom fields I intended to pull out of the two arrays.

Finally, I parsed the JSON in a loop:

Capture2.PNGNDAType was my hidden ID field which I used to identify the template and decide whether to run the flow. I look for it in the Recip2Fields array and continue to run the flow if it's found.

Capture3.PNG

 

Next I repeat the process to locate all the other custom fields I care about in the Recip1Fields Array, using nested conditions:

 Capture4.PNG

 

Note: The parse JSON Steps both used the same sample payload:

{
    "type": "object",
    "properties": {
        "@@name": {
            "type": "string"
        },
        "value": {
            "type": "string"
        }
    }
}

 

Now you have all your string variables set and you can do any error checking you need to or finish your flow.

 

Hope this helps. If you still have questions, the Docusign folks are very good.

View solution in original post

7 REPLIES 7
Community Support Team
Community Support Team

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Hi @NordKapp,

 

Thanks for feedback.

The issue could be reproduced by me.

It seems that the custom field could not return a value using the function @triggerBody()?['customFields'][Region] as suggested in the doc.

I will help confirm it on my side and back to you later.

 

Best regards,

Mabel

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
NordKapp
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Mabel (@v-yamao-msft)

Thank you for looking into this issue! I'm looking forward to hearing more. I've also submitted a ticket with DocuSign support and am waiting to hear back from them.

 

Best,

NordKapp

Alva
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Any updates?

NordKapp
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

I have a temporary workaround that involves pulling the xml data from the trigger, parsing it, and extracting the custom properties based on that. I'm still building it into my solution and will post when i've got it all figured out. Here's a short summary of the temporary workaround:

1. Add an invisible custom field to your template that has some kind of unique identifier for your flow.

 

2. In Flow, pull data from trigger using: Initialize variable (array) - custom expression: triggerOutputs().body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatuses.RecipientStatus[0]['FormData']['xfdf']['fields']['field']

This pulls all of the custom fields for the first recipient into an array.

3. repeat for each docusign recipient incrementing the bolded [0]

4. Parse JSON for each array using this schema:

{
   "type": "object",
   "properties": {
   "@@name": {
   "type": "string"
   },
      "value": {
      "type": "
 
5. Use switch case, or conditional statatements to find your unique custom field from step 1 and decide whether to run the flow.
 
6. Extract your other custom fields into variables from the parsed JSON
 
Sorry for the brevity. I'll post screenshots when my final flow is working correctly. I had to pause this project and I'm hoping to complete it by early February.
Alva
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Thanks for the response! 

I'll give this a shot and let you know how it goes. 

Alva
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

I seem to constantly be getting this error 

 

1.PNG

NordKapp
Level: Powered On

Re: View custom fields with DocuSign: When an envelope status changes (Connect) Trigger

Would you please post the expression in the initiailze variable step?

Also, they gave me two options for calling the custom fields, see full ticket text below:

 

The trigger output expression ['customFields'] refers to Envelope Custom Fields rather than Document Custom Fields. Document Custom Fields are typically referred to as "tabs" rather than "custom fields" in both DocuSign Connect and the DocuSign API. You're headed in the right direction with the RecipientStatus section. Our scope of support for Flow is limited to the out-of-the-box triggers and actions, so we wouldn't typically be able to provide guidance on how to set up the trigger output expressions. That being said, I'd be happy to share the details of two methods we've identified for pulling the information.


Method 1: Uses the “tabs” section of the event notification 
Works only with text fields, Full Name, and Date Signed
x = recipient position in the Connect message, starting at 0
your_tab_name = field data label

triggerOutputs() .body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatus.RecipientStatus[x]['tabs']['your_tab_name'] 

Method 2: Uses the "FormData" section of the event notification.
Works with all field types
You can specify the field data to be retrieved either with the tab label or with its position (as a numeric value) in the FormData section of the event notification-- this example uses the tab label
x = recipient position in the Connect message, starting at 0
your_tab_name = field data label

triggerOutputs() .body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatus.RecipientStatus[x]['FormData']['xfdf']['fields']['field’]['your_tab_name']['value’]



Note: I went about this successfully using a slightly modified version of method 2

 

Capture.PNG

 

First I initialized two arrays with the following expressions:

Array 1 (Recip1Fields Array):
triggerOutputs().body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatuses.RecipientStatus[0]['FormData']['xfdf']['fields']['field']
 
Array 2 (Recip2Fields Array):
triggerOutputs().body.DocuSignEnvelopeInformation.EnvelopeStatus.RecipientStatuses.RecipientStatus[1]['FormData']['xfdf']['fields']['field']
 
This is because we have two senders in our template. Note that the RecipientStatus starts at zero.


Next, I initialized string variables for each of the custom fields I intended to pull out of the two arrays.

Finally, I parsed the JSON in a loop:

Capture2.PNGNDAType was my hidden ID field which I used to identify the template and decide whether to run the flow. I look for it in the Recip2Fields array and continue to run the flow if it's found.

Capture3.PNG

 

Next I repeat the process to locate all the other custom fields I care about in the Recip1Fields Array, using nested conditions:

 Capture4.PNG

 

Note: The parse JSON Steps both used the same sample payload:

{
    "type": "object",
    "properties": {
        "@@name": {
            "type": "string"
        },
        "value": {
            "type": "string"
        }
    }
}

 

Now you have all your string variables set and you can do any error checking you need to or finish your flow.

 

Hope this helps. If you still have questions, the Docusign folks are very good.

View solution in original post

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 241 members 5,908 guests
Please welcome our newest community members: