Im having this error when using IN statement in table Invoice with field name ProductSold

Im having this error when using IN statement in table Invoice with field name ProductSold

Warning: Invalid argument supplied for foreach() in directory\infusionsoft\mySDK.class.php on line 325

Kindly check my code:
$ProductSold = [600, 604];
$table = “Invoice”;
$query = array(‘ProductSold’ => $ProductSold);
$returnFields = array(‘AffiliateId’, ‘ContactId’, ‘CreditStatus’, ‘DateCreated’, ‘Description’, ‘Id’, ‘InvoiceTotal’, ‘InvoiceType’, ‘JobId’, ‘LastUpdated’, ‘LeadAffiliateId’, ‘PayPlanStatus’, ‘PayStatus’, ‘ProductSold’, ‘PromoCode’, ‘RefundStatus’, ‘Synced’, ‘TotalDue’, ‘TotalPaid’);
$result = $app->getObjects($table, $query, $returnFields);

Unfortunately it will not work in that column, even though it has ID numbers.
If multiple products are sold it comes back with a comma separated list.

I ran some tests, and it did not like my array either. It has to match whatever is outputted in the field.

1 Like

ProductSold is a String field, not an Id field, which would explain the behavior we’re seeing here.

1 Like