Java Code Data Policy Examples/Log Activity On Update Prospect Code Sample

Java Code Data Policy Examples/Log Activity On Update Prospect Code Sample

From LongJump Support Wiki

Java Code Data Policy Examples/Log Activity On Update Prospect Code Sample
Jump to: navigation, search

This code is intended for use as part of a Data Policy. It is a complex example of the use of Java code to take a series of actions, each based on the previous code section. For information on the use of this code sample, see: Log Activity On Update Prospect.

import com.platform.api.*;


public class DataPolicyExamples {

  public void LogProspectUpdate(Parameters requestParams) {

    //Create a parameter instance to pass information to logActivity call
    Parameters params = Functions.getParametersInstance();

    //Get record id of the prospect record for which
    //you want to record an activity
    String record_id = requestParams.get("id");
     
    //Get the user id of the user
    String user_id = Functions.getEnv(ENV.USER.ID);
    params.add("subject", "Subject : Adding log call via JAVA code");
    params.add("description",
               "This is a completed activity logged via logActivity API");
    params.add("sales_notes",
               "Make a note to check the Activity History section of the record.");
    params.add("action_type", "Email");
    //Make a call to logActivity function to add an activity to Prospect object
    Result result = Functions.logActivity("Made a phone call to Primary Contact.",
     "LEAD", record_id, user_id, params);

    //Add a debug message to the Debug Log to get result of logActivity
    Functions.debug("Result from logActivity:" + result.getMessage());
  } // end method
}// end class
Personal tools