Hello I am trying to modify a custom body field on a sales order. The customfields are custbody_order_status(a dropdown) and custbody_move_confirmed(a checkbox). How would i check the checkbox via the API?
When I run this script I get UPDATE SUCCESS, id 114467, but the fields are not changed in the record. Is there something wrong with my code?
PHP Code:
$customStringFieldList = new StringCustomFieldRef();
$customStringFieldList->internalId = “custbody_order_status”;
$customStringFieldList->value = utf8_encode(“Cancelled”);
$customSelectFieldList = new SelectCustomFieldRef();
$customSelectFieldList->value = new ListOrRecordRef();
$customSelectFieldList->value->internalId = 49;
$customSelectFieldList->internalId = ‘custbody_move_confirmed’;
$basicCustomRecord = new SalesOrder();
$basicCustomRecord->internalId = “114467”; // internal id of the custom record you want to update
$basicCustomRecord->recType = new RecordRef();
$basicCustomRecord->customFieldList = new CustomFieldList();
$basicCustomRecord->customFieldList->customField = array($customStringFieldList,$customSelectFieldList);
$updateRequest = new UpdateRequest();
$updateRequest->record = $basicCustomRecord;
$updateResponse = $service->update($updateRequest);
var_dump($updateResponse);
if (!$updateResponse->writeResponse->status->isSuccess)
{
echo “UPDATE ERROR”; exit();
}
else {
echo “UPDATE SUCCESS, id ” . $updateResponse->writeResponse->baseRef->internalId;
}
This is a cached copy. Click here to see the original post.