Podio API PHP update an item relationship type. When is empty does not work

157 Views Asked by At

I have been struggled with my PHP script, I need to update a relationship type item in a app with Podio API php. Whe the field is "blank", does no work, I mean does not update the field, when it has a value it works, the item is modified with the new value, here is part of my code:

     $item = PodioItem::get_basic($itemId);
    $field_id = 'last-action-by';
    $item->fields[$field_id]->values = array('item_id' => $contacto);
    $item->save();

Any idea please?

2

There are 2 best solutions below

0
On BEST ANSWER

Finally I found the solution.- the problem was that I was passing in $contacto variable and email, and it should be the contact_id as an integer, so with that I resolve the problem, thank you for you comments!

0
On

You have to pass an empty array to "blank" a field,

$item->fields[$field_id]->values = array();