Post

2 followers Follow
1
Avatar

Create Item with a "contact" type field

Hi,

I wanted to create a item in a particular app with a "contact" type field. Here is how i tried.

$response = $api->item->create($app_id, array('fields' => array( array('external_id'=>$externalid, 'values'=>array('value'=>array('name'=>$username, 'mail'=>array($sender)))))));

Bun in my log, it says

Invalid field 16135717 ('value'): Invalid value {u'mail': [u'sriyan.31@gmail.com'], u'name': u'Sriyan Sampath'}: Must be Integral

 

I think this is regarding the format of a "contact" type field.

Can any one help me to fix this.

Thank you.

Sriyan Sampath Answered

Please sign in to leave a comment.

2 comments

0
Avatar

I get the same error with .NET apis,. Did you manage to resolve it by any chance?

Shivakumar Krishnamurthy 0 votes
Comment actions Permalink
0
Avatar

The issue here is that you are trying to create the contact along with the item. That won't work. You have to create the contact first. That will give you a profile_id. You then pass that profile_id along as the value for the item field when creating the item.

/Andreas

Andreas Haugstrup Pedersen 0 votes
Comment actions Permalink