Skip to content

Instantly share code, notes, and snippets.

@anghene
Last active June 7, 2019 15:48
Show Gist options
  • Save anghene/504733a81ff6dc1438985044a2e840d5 to your computer and use it in GitHub Desktop.
Save anghene/504733a81ff6dc1438985044a2e840d5 to your computer and use it in GitHub Desktop.
values-tried

What they use to update a custom field's value internally - instead of passing on text value, they pass on the value value:

{
    // CustomFieldId: 5593ba71-f212-457a-b5dd-b75e52c07782
  "options": [
    { "text": "man", "value": "cfaf83f0-52d2-49fb-84ad-4a9af72d9ad5" },
    { "text": "woman", "value": "cae4a570-ea13-45e0-9b1b-daf5a0082a8c" },
    { "text": "child", "value": "579ff2ec-67c1-4f3f-99cd-d299fd5bcb5e" }
  ],
}

They generate a random alfa-numeric UUID for each custom field so that no two custom fields are alike, even if they have literally the same value and id and text. This is to prevent name collisions with what I'm guessing is a really large nosql database meant for the entirety of their customers.

Back to the testing.. I tried passing this for switching from man to child: (i got this on their frontend when i did it manually, so I imagined it would work in cURL for setting a new enquiry. I guessed wrong, this only works when UPDATING a customfieldJson and only on their portal, not from outside.

CustomFieldJsonData: [{"CustomFieldId":"5593ba71-f212-457a-b5dd-b75e52c07782","CustomFieldValueId":"00000000-0000-0000-0000-000000000000","Value":"74bf900d-e01d-4d26-8448-5bd576b6c5d2"}]

Another try:

 CustomFieldId: "5593ba71-f212-457a-b5dd-b75e52c07782"
 TypeData: {"options":[{"text":"alfa","value":"5bdc8aab-5740-444f-a814-5ac6ac53487e"},{"text":"beta","value":"74bf900d-e01d-4d26-8448-5bd576b6c5d2"},{"text":"gama","value":"9ffef9a3-5ff5-4249-89be-20304eae75d7"}]}

I even tried passing all the fieds with the middle one being marked as 1, maybe it would be set to second option:woman.

    "CustomFieldJsonData":
    [
    {
        "CustomFieldName": "man",
        "CustomFieldValue": 0
    }
    {
        "CustomFieldName": "woman",
        "CustomFieldValue": 1
    }
    {
        "CustomFieldName": "child",
        "CustomFieldValue": 0
    }
    ]
}

More tries:

customFields : [{"customFieldName":"businessType"}{"customFieldValue":"woman"}]
customFields : [{"fieldName":"businessType"},{"fieldValue":"woman"}]

(this one is url encoded because at this point....)

customFields%3A%5B%7B%22fieldName%22%3A%22businessType%22%7D%2C%7B%22fieldValue%22%3A%22woman%22%7D%5D%0A
"CustomFields":[{"fieldName":"businesstype","fieldValue":"man"}]

Anyway, no luck. For reference, this is how a CustomField looks like internally on their server. You get this when you get the details of a custom field when you've just created it successfully.

[
    {"CustomFieldModel":
        {"CustomFieldId":"5593ba71-f212-457a-b5dd-b75e52c07782",
            "Name":"businesstype",
            "CustomFieldType":6,
            "DisplayOrder":1,
            "DisplayColumn":0,
            "DisplaySection":1,
            "EntityType":16,
            "Required":true,
            "RequiredMessage":"Business Type",
            "Archived":false,
            "TypeData":"{\"options\":[{\"text\":\"alfa\",\"value\":\"5bdc8aab-5740-444f-a814-5ac6ac53487e\"},{\"text\":\"beta\",\"value\":\"74bf900d-e01d-4d26-8448-5bd576b6c5d2\"},{\"text\":\"gama\",\"value\":\"9ffef9a3-5ff5-4249-89be-20304eae75d7\"}]}"},
            "Value":"",
            "CustomFieldValueId":"00000000-0000-0000-0000-000000000000",
            "CustomFieldId":"5593ba71-f212-457a-b5dd-b75e52c07782",
            "ValidationMessage":null,
            "HasError":false}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment