Skip to content

Instantly share code, notes, and snippets.

@ksnider
Created December 5, 2013 18:38
Show Gist options
  • Select an option

  • Save ksnider/7810832 to your computer and use it in GitHub Desktop.

Select an option

Save ksnider/7810832 to your computer and use it in GitHub Desktop.
This script adds today's date and increments a counter in an Infusionsoft contact record
<?php
/* **************
FUTURE- if $counter = 5, for example, add a tag for Videos Viewed = 5 and then have tag get picked up in CB to send email.
******************* */
require("isdk.php");
$myApp = new iSDK;
$myApp->cfgCon("connectionName");
// Get Contact ID from POST variable
//$conId = $_POST['Id'];
$conId = 19309;
//echo $conId."<br/>";
// Set Video Last View Date to Today (_LastViewDate )
$infusionDate = date("Ymd\TH:i:s");
$data = array('_LastViewDate' => $infusionDate);
$update = $myApp->dsUpdate("Contact", $conId, $data);
// Increment Video Watched Counter By One (_VideoWatchedCounter )
// Load current value then add new value
$returnFields = array('_VideoWatchedCounter');
$conDat = $myApp->dsLoad("Contact", $conId, $returnFields);
$counter = $conDat['_VideoWatchedCounter'];
//echo "Counter is ".$counter."<br/>";
$counter++;
//echo "Now counter is ".$counter."<br/>";
$data = array('_VideoWatchedCounter' => $counter);
$update = $myApp->dsUpdate("Contact", $conId, $data);
echo $update . " updated successfully";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment