cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Property was found but is not permitted at this location. #customfields

SOLVED
Member

Re: Property was found but is not permitted at this location. #customfields

If I am using the basic API v2 PHP example, addOrUpdateContact.php and I want to add the value of a radio input to a custom field named CustomField1, can I not just post like so?

 

            $contact = new Contact();
            $contact->addEmail($_POST['email']);
            $contact->addList($_POST['list']);
            $contact->first_name = $_POST['first_name'];
            $contact->last_name = $_POST['last_name'];
            $contact->CustomField1 = $_POST['CustomField1'];

When I try that, I receive the error.

How do I post to CustomField1?

I have limited knowledge of PHP and/or this API but this seems too simple to not work.

1 REPLY
Moderator

Re: Property was found but is not permitted at this location. #customfields

Hello,

 

Thank you for reaching out to Constant Contact developer support.

 

There is a custom field array that then contains each custom field within it as a sub-object. This is the same way that lists work on contact objects. See below:

$contact->custom_fields = [
[
"name"=>"CustomField1",
"Value"=>$_POST['CustomField1']
],
[
"name"=>"CustomField2",
"Value"=>$_POST['CustomField2']
]
];


Regards,
David B.
Tier II API Support Engineer

Still need help?
You can post a new message in the Community or find us on Twitter Mon-Fri 8am - 8pm ET. We've got real people waiting to help you out. Click below to start a conversation!