Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

    • Add Custom Activity Fields
      • Name = Name of the field
      • Identifier = Value used to identify the field
      • Field Type = Data type of the field (date, string, etc.). Note, multi-picklist data types are not currently supported.
      • Required = Is the field required when the activity is called/logged?
  • In the example below, we're logging details of a customer's pizza order. When they order their pizza, the details of their order (price, size, delivery date, etc.) would be logged on their profile. We could easily add additional data points, such as Delivery Type (Takeout, Delivery), Crust (Thin, Deep Dish) in the activity by adding more Custom Activity Fields.

Calling Custom

...

Activities

Calling Custom Activities via JavaScript

The code example below is JavaScript that could be added to a page to invoke a custom activity. In this example, we're logging a custom activity when a pizza is ordered. The activity is logged when a button is clicked on the web page. Your activity could be logged in multiple ways (scroll, input, etc.). Work with your web programmer to invoke your custom activity. 

Code Block
themeEclipse
languagejs
titleCalling a Custom Activity from JavaScript
linenumberstrue
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="description" content="%%description%%" />
    <title>%%title%%</title>
    
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script>
      //The activity is logged on button click. 
      $(document).ready(function(){
        $('#my_activity_button').on ('click', function (){
        	
          //START: This is the code to log the custom activity
          ll_api.log_prospect_activity ({
              activity_identifier: 'ordered_pizza__c',
              activity_info: 'Ordered one stuffed crust pizza with extra cheese',
              activity_fields: {
                  price__c: '13.5',
                  size__c: 'Large',
                  delivery_date__c: '2016-11-20'
              }
          }, function (response){
              console.log (response) //{success: 1, message: "Success"}
          });
          //END: This is the code to log the custom activity
          
        })
      })
    </script>
  </head>
  <body>
    %%content%%
  </body>
</html>

Calling Custom Activities via API

The code example below is an API call in PHP used to invoke a custom activity. In this example, we're logging a custom activity when a phone call is received. 

Code Block
languagephp
titleCustom Activity: Phone Call Example
linenumberstrue
<?php
$request_parameters = array(
					"id" => "[PROSPECT_ID]", 
					//"email" => "[PROSPECT_EMAIL]",
					"activity_identifier" => "phone_call__c", //[ACTIVITY_IDENTIFIER]
					"activity_info" => "Phone call", //[ACTIVITY_INFO]
					"activity_fields_data" => array("number__c" => "(888)-895-3233", "duration__c" => "35m 45sec") //[ASSOCIATIVE ARRAY OF FIELD IDENTIFIERS AND VALUEs]
				);
$ch = curl_init ();
curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $ch, CURLOPT_VERBOSE, 1 );
curl_setopt ( $ch, CURLOPT_HEADER, 1 );
curl_setopt ( $ch, CURLOPT_USERAGENT, USER_AGENT );
curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
curl_setopt ( $ch, CURLOPT_POST, 1 );
curl_setopt ( $ch, CURLOPT_POSTFIELDS, json_encode ( $request_parameters ) );
$url = "https://api.leadliaison.com/v1.0/prospects/add_activity.json?api_key=[api-key]";
curl_setopt ( $ch, CURLOPT_URL, $url );
$response = curl_exec ( $ch );
$header_size = curl_getinfo ( $ch, CURLINFO_HEADER_SIZE );
$this->header = substr ( $response, 0, $header_size );
$body = substr ( $response, $header_size );
//echo $body;
curl_close ( $ch );
exit();
?>


Activities Logged on Prospect Profiles

...