PodioItems filter not finding matches properly
AnsweredI'm having difficulty with the PHP SDK that I cannot seem to solve. We have a script that runs routinely via CRON job for one of our sites, and we decided to move the error reporting from email to a Podio app. The way this works is, I first attempt to find PodioItems using filters. If none are found, a new one is created. If a match is found, it is instead updated with a new timestamp. In tests, this seemed to be working. However, now that the script is running on our server, all 13 current errors are being recreated every 20 minutes. In other words, the check for existing PodioItems is not working. Items created using certain string values are not found by a filter using the exact same values ever again.
public function sendErrorToPodio($promailID, $orderID, $message){
$existingErrors = $this->findItemByInventoryIDAndVaeOrderID($promailID, $orderID, $message);
if(count($existingErrors) < 1){
$this->createNewItemInPodio($promailID, $orderID, $message);
} else {
$podioID = $existingErrors[0]->item_id;
$this->updateExistingItemInPodio($podioID, $promailID, $orderID, $message);
}
}
private function findItemByInventoryIDAndVaeOrderID($promailID, $orderID, $message){
$items = PodioItem::filter($this->appID, array('filters' => array(63816040 => $promailID, 63925250 => $orderID)));
return $items;
}
-
Both fields are single-line textfields, and the variables hold strings such as the following:
$promailID - 'AddOrder' or '40730 AddOrder'
$orderID - '13311' or 'Not Available'There are currently 13 errors which should be sent to the Podio App, and all of them are in the format described above.
-
We don't support filtering for text fields. You can see a list of the field types you can filter on at: https://developers.podio.com/doc/filters
Use the search interface if you need to find specific items based on text fields: https://developers.podio.com/doc/search
Please sign in to leave a comment.
Comments
4 comments