Updating Custom Fields via API

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);

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" ));

The Value should be blank for a Text Area field as the value would be for field types of dropdown or List box etc. A text area just gives the option to name the value. Are you sure that you are looking at a text area and it has a default value on the front end?

Hi All,

Please can anyone help us or let us know how to update the customfield values in order we have tried the dsupdate() and also the updatecustomfield() function but are unsuccessfully. When we create the order using the blankorder functionality that we need to send more details in the same order. Please can someone advise.

Hi @Wsware_Scissor, it looks like you’re using the old iSDK. I would recommend updating to the newer Infusionsoft PHP SDK if possible.

If you need to set an order’s custom field, you will need to do something like this:

$order = array('_NewCustomField' => 'Some Value');
$result = $app->dsUpdate("Job", 58, $order);

Adding to what @Nicholas_Trecina has provided. The custom field specified after the underscore must be named by the database name in IS (which is not always the same as the field name)