Skip to main content
Question

How to update Template's Custom Field via REST


Forum|alt.badge.img+2

Hi,

I’ve created a template and added a few custom fields on the template. I’ve applied a template on an empty envelope but I can’t seem to to able to update the custom fields on the envelope.

When I pull a list of custom fields on the envelope, all I’m getting is this. 

{
  "textCustomFields": [
    {
      "fieldId": "11074686122",
      "name": "templateUsageRestriction",
      "show": "false",
      "required": "false",
      "value": "allOptions"
    }
  ],
  "listCustomFields": []
}

Is it possible to update there custom fields before sending it to the end user?

 

Best regards,

Matt

4 replies

JohnSantos
Valued Contributor
Forum|alt.badge.img+18
  • Valued Contributor
  • 975 replies
  • May 27, 2024

@ShopBack - Yes, you can update the custom fields on an envelope before sending it to the end user.

You would use a PUT request to update the custom fields. Here is an example request:

PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/custom_fieldsContent-Type: application/json{  "textCustomFields": [    {      "fieldId": "11074686122",      "name": "templateUsageRestriction",      "show": "false",      "required": "false",      "value": "newValue"    }  ],  "listCustomFields": []}

Let me know if this addresses your question.

 


Forum|alt.badge.img+2
  • Author
  • Newcomer
  • 2 replies
  • May 28, 2024

Hi @JohnSantos thanks for the reply.

An example is as below. I created a template with 3 custom fields on the top and apply the template to an empty envelope. When I try to get a list of custom fields on the envelope, its only returning a single textCustomField not 3. Am I supposed to add the custom fields in?

{
  "textCustomFields": [
    {
      "fieldId": "11074686122",
      "name": "templateUsageRestriction",
      "show": "false",
      "required": "false",
      "value": "allOptions"
    }
  ],
  "listCustomFields": []
}


 

 


Forum|alt.badge.img+2
  • Author
  • Newcomer
  • 2 replies
  • May 28, 2024

Forgot to mention I also tried EnvelopeDocumentFields:list and its also returning []


JohnSantos
Valued Contributor
Forum|alt.badge.img+18
  • Valued Contributor
  • 975 replies
  • May 28, 2024

@ShopBack - You either create your envelope from a template or just use the API to create the envelope.  I think you are trying to do both on the same call.    Can you try something like this on your PUT request?

PUT /v2.1/accounts/{accountId}/envelopes/{envelopeId}/custom_fields
Content-Type: application/json

{
  "textCustomFields": [
    {
      "name": "CustomField1",
      "show": "false",
      "required": "false",
      "value": "Value1"
    },
    {
      "name": "CustomField2",
      "show": "false",
      "required": "false",
      "value": "Value2"
    },
    {
      "name": "CustomField3",
      "show": "false",
      "required": "false",
      "value": "Value3"
    }
  ]
}