Java Code Data Policy Examples/Send an Email Message to Request a Contract Renewal Code Sample

Java Code Data Policy Examples/Send an Email Message to Request a Contract Renewal Code Sample

From LongJump Support Wiki

Java Code Data Policy Examples/Send an Email Message to Request a Contract Renewal 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: Send an Email Message to Request a Contract Renewal.

import com.platform.api.*;


public class DataPolicyExamples {

  public void sendEmailToRequestContractRenewal(Parameters requestParams) {
    //Both these strings need to be created manually by copying the templateID
    //strings from the UI. Check the sendEmail function definition for details.
    String attachmentIdList = "";
    String attachmentTemplateId = "";
    Functions.debug("Going to send email to remind a group about CONTRACT expiry.");

    // Some code to populate contactID
    String contractID = requestParams.get("contract_id");
    Functions.debug("ID of contract object" + contractID);

    // Some code to populate attachmentIdList
    Result result = Functions.sendEmail("CONTRACT", contractID,
       "support@serviceprovider1.com", "support@serviceprovider2.com",
       "Testing sendEmail",
       "Hello, This email has been sent to remind you of your contract expiry",
        attachmentTemplateId, attachmentIdList);
    if(result.getCode() != -1)
    {  
       Functions.debug("Sent email to remind of CONTRACT expiry.");
    }
    else
    {
       String msg = "Error sending reminder email from CONTRACT record";
       Functions.debug(msg+":\n" + result.getMessage());  // Log details
       Functions.throwError(msg + ".\n");                 // Error dialog
    }
  } // end method
}// end class
Personal tools