I need to pass the event date through to Infusionsoft, I’ve managed to get this working perfectly for attendee custom fields, but despite staring at documentation for hours I can’t seem to work out how to pull the Event Date.
Here’s the working plugin for the custom fields, could somebody please modify it to push through the Event Date.
function ee_infusionsoft_save_my_custom_questions( $is_contact_data, $ee_attendee ) {
if( $ee_attendee instanceof EE_Attendee ) {
//get the last answer this attendee provided to the question with admin label 'custom_question'
$custom_question_answer = EEM_Answer::instance()->get_one(
array(
array(
'Registration.ATT_ID' => $ee_attendee->ID(),
// change custom_question on the next line to match the admin label in EE > Registration Forms > Questions
'Question.QST_admin_label' => 'TestQuestionForAPI'
),
'order' => 'DESC'
)
);
if( $custom_question_answer ){
// change _CustomQuestion on the next line to match the Infusionsoft custom field
$is_contact_data[ '_EventStartDateText' ] = $custom_question_answer->pretty_value();
}
}else{
EE_Error::add_error(
sprintf(
__(
'ee_infusionsoft_save_my_custom_questions was not called with an EE_Attendee but a %s', 'event_espresso'
), gettype( $ee_attendee )
),
__FILE__, __FUNCTION__, __LINE__
);
}
return $is_contact_data;
}
add_filter(
'FHEE__EED_Infusionsoft__save_infusionsoft_attendee__extra_attendee_data',
'ee_infusionsoft_save_my_custom_questions',
10,
2
);
Please note: It appears that the Infusionsoft API doesn’t accept an incoming custom field if it’s a date type field. I tried formatting the date exactly the same way as the date type field and it didn’t work. What you can do though is make a text field in Infusionsoft for the custom event date field and the API will accept it.
Hi Josh,
I’ve copied your code into the plugin and modified the two variables for event date and event name.
However now nothing comes through, ie even the custom field mapping using Infusionsoft EE Plugin also fails to transfer. If we disable the plugin you’ve made, it works, if we re-enable it, none of the custom fields or event date & Name transfer.
You should probably remove the first function because both functions are attached to the same filter hook, it’s not clear if the first function is correct, and there’s a UI for mapping custom questions in Event Espresso to Infusionsoft. So more than likely the one function is overriding the other, especially if that first one is also sending to the same custom field (like in the first example you shared).
In other words, in the first function you shared, you have this: $is_contact_data[ '_EventStartDateText' ] = $custom_question_answer->pretty_value();
Then in the second function you have: $is_contact_data[ '_EventStartDateText' ] = $startdate;
Also, you’ll need to make sure your custom field in Infusionsoft matches the custom field in the code. When you go to your Infusionsoft custom fields admin, you’ll see a link that opens a modal, “View the field database names (for the API)”. That’s where you’ll get the field database name to use in your code. https://slack-files.com/T02SY781D-FQ13T6G5U-9a409069be
Viewing 5 reply threads
The support post ‘Passing Event Date to Infusionsoft’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.