Hello, i’m getting some pretty weird results when trying to update a company custom field via the api. I’m using the newest version of the oAuth PHP SDK. In this particular example, it’s of type text area.
Here’s what my field value currently looks like in IS:
For debug purposes, I pull back the field directly from the DataFormField table to ensure i’m looking at the right field. Oddly enough, the “Values” field is empty. Here’s what that call and response looks like:
$custom_field_id = 10; $response = $infusionsoft->data()->query('DataFormField', 999, 0, array("Id" => $custom_field_id, array('Id', 'Label', 'Name', 'DataType', 'DefaultValue', 'FormId', 'GroupId', 'ListRows', 'Values'), 'Id', false);
response:
array(1) { [0]=> array(7) { ["Label"]=> string(17) "[ICB] Description" ["DataType"]=> int(16) ["ListRows"]=> int(0) ["Id"]=> int(10) ["FormId"]=> int(-6) ["Name"]=> string(14) "ICBDescription" ["GroupId"]=> int(2) } }
Ok so that’s weird, “Values” in the response is not present (because it’s empty), but there is a value shown in IS Admin.
So I try to update the custom field like so:
$values = ["Values" => "this is a new updated value"]; $response = $infusionsoft->updateCustomField($custom_field_id, $values);
response = true
Ok cool, it looks like it’s updated successfully… But it still has the old value when viewed in Infusionsoft? Weird, let’s use the query function above to see what the api gives us…
array(1) { [0]=> array(8) { ["Label"]=> string(17) "[ICB] Description" ["Values"]=> string(28) " this is a new updated value" ["DataType"]=> int(16) ["ListRows"]=> int(0) ["Id"]=> int(10) ["FormId"]=> int(-6) ["Name"]=> string(14) "ICBDescription" ["GroupId"]=> int(2) } }
What? Ok so the query() pulls back the field, showing our new value in “Values”… but when viewed in infusionsoft it still contains the old value. Also worth noting when I first queried the field (query()), “Values” was not return as if it was empty… This leads me to believe there is a unlisted field name I should be looking for? Really not sure what i’m missing at this point, though I concede it’s most likely user error.
Unrelated Side Note: I know it’s not possible to delete custom fields through the API, as the DataFormField table does not have delete permissions. However, in the event i’m wrong i’d love some clues on how to go about doing that.
Thank you for your time.
UPDATE: A friend pointed out that some of the functions in the new SDK rely on the new REST API’s endpoints. I managed to update the field successfully the old fashion way through update()
. This means the updateCustomField()
probably only supports the contact table at this point in time, but that’s just an assumption.
$infusionsoft->data()->update('Company', $companyID, array("_ICBDescription" => "My New Value" ));