Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

form_field_groups is malformed when creating an embedded signature request #141

Open
ggggbbybby opened this issue Oct 13, 2022 · 0 comments

Comments

@ggggbbybby
Copy link

When I tried to send form_field_groups with my signature request, it would always throw this cryptic error:

{"error":{"error_msg":"'form_field_group' must have fields in 'form_fields_per_document'","error_path":"form_field_groups","error_name":"bad_request"}})

I wrote to apisupport@hellosign (support ticket #19005626) and they pointed out that the request payload was not formatted correctly.
I was passing this to create_embedded_signature_request

        [
          {
            group_id: "group_collections",
            group_label: "Collections",
            requirement: "require_1"
          },
          {
            group_id: "group_insurance",
            group_label: "Insurance",
            requirement: "require_1"
          },
          {
            group_id: "group_paymentplan",
            group_label: "PaymentPlan",
            requirement: "require_1"
          }
        ]

and this is how it was transformed to json

"form_field_groups": {
	"group_collections": [],
	"1": {
		"group_label": "C*** REDACTED [11 char]"
	},
	"2": {
		"requirement": "require_1"
	},
	"group_insurance": [],
	"4": {
		"group_label": "I*** REDACTED [9 char]"
	},
	"5": {
		"requirement": "require_1"
	},
	"group_paymentplan": [],
	"7": {
		"group_label": "P*** REDACTED [12 char]"
	},
	"8": {
		"requirement": "require_1"
	}
},

My fix was to wrap the array in MultiJson.dump(...) because that's how the other fields were transformed (prepare_signers etc). I realize that this is a legacy issue and easy to work around, but I wanted to make it visible for other people who might be running into the same issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant