Email, Phone and Number Type Podio item field showing blank after creation of item by api in php-ThrowExceptions

Exception or error:

I am creating Item by api in php. Item is creating but email, phone and number type field not storing value. It is showing blank in podio account. here is my code:

// !!! this is an example, it depends form fields in your form
//$num = 4301.00;
$first = $form_fields[ 1 ][ 'value' ];
$last = $form_fields[ 2 ][ 'value' ];
//$email = $form_fields[ 3 ][ 'value' ];
//$phone = $form_fields[ 4 ][ 'value' ];

$fields = new PodioItemFieldCollection(array(
new PodioTextItemField(array("external_id" => "name", "values" => $first)),
new PodioTextItemField(array("external_id" => "efternavn", "values" => $last))
));

// Create the item object with fields
// Be sure to add an app or podio-php won't know where to create the item
$item = new PodioItem(array(
'app' => new PodioApp(23258136), // Attach to app with app_id=123
'fields' => $fields
));

$number_field_id = 'lead-nummer';
$email_field_id = 'email-address';
$phone_field_id = 'phone-number';

$item->fields[$number_field_id]->values = "4301.00";
$item->fields[$email_field_id]->values = array('value'=>"i@oooo.com",'type'=>'work');
$item->fields[$phone_field_id]->values = array('value'=>"7044636740",'type'=>'work');

// Save the new item
$item->save();
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *