PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Update CM when editing an existing entry

  1. Hi Guys,

    I've seen this post (http://www.gravityhelp.com/forums/topic/will-a-campaign-monitor-feed-update-existing-entries-with-new-data) but I'm not sure it answers my question so I just wanted to confirm.

    I have a form which integrates with CM, it's a simple competition. When a winner is selected, the admin's update the form data in Wordpress by visiting "GF > Entries", select "winner", then hit Update. So my question is; for a form that is integrated with CM on submission, would the update be passed to CM as well?

    That doesn't seem to happen for me and I'd really like to make it work. If it's not a native function of GF, can you advise how I can hook into the form update action to do this?

    Thanks
    Andy

    Posted 6 years ago on Wednesday January 25, 2012 | Permalink
  2. Hi, squidgemann,

    Updating an entry does not send the changes to Campaign Monitor. To send an update, you would need to implement custom code. You could send an update in the "gform_save_field_value" hook (http://www.gravityhelp.com/documentation/page/Gform_save_field_value). This hook fires when changes are made to an entry. You would need to look at how to communicate with Campaign Monitor's API. You can take a look at the code used in the add-on to get an idea of how it is done. There is documentation on Campaign Monitor's site (http://www.campaignmonitor.com/api/) that will help.

    Below is an example on using the hook:

    add_filter("gform_save_field_value", "save_field_value", 10, 4);
    function save_field_value($value, $lead, $field, $form){
    	//do this only when in the admin, and specific campaign monitor form (form id)
    	if (is_admin() && $form["id"] == 14)
    	{
    		//this will fire for each changed value when saving the entry
    		//so target a single field (use the id of your field) that you care has changed - the winner field
    		if ($field["id"] == 2)
    		{
    			//put custom code here to send update to campaign monitor
    		}	
    
    	}
    	//return $value so the field changes are saved
        return $value;
    }
    Posted 6 years ago on Wednesday February 8, 2012 | Permalink
  3. Hi Dana, thanks for your update that's really helpful. I know my way around the CM API so that part is easy, finding the right GF hook was the difficult part for me. Really appreciate the response.

    All the best
    Andy

    Posted 6 years ago on Wednesday February 22, 2012 | Permalink

This topic has been resolved and has been closed to new replies.

Support Tickets

Open A New Support Ticket
 Open A New Priority Support Ticket *

* Developer license holders only