addEvent
From LongJump Support Wiki
Revision as of 22:15, 20 December 2010 by imported>Aeric (Text replace - 'getParametersInstance(' to 'Functions.getParametersInstance(')
- Functions.addEvent(String subject, String ownerID, Date startDate, int hour, int min, int duration [, Parameters params])
- Adds an event with values from params.
The action performed by this API can be performed via the browser interface in New Appointment. The added appointment is displayed in Calendar object.
This API has two signatures:
- Quick Add event that includes these minimal parameters: subject, owner, startdate, starthour, startminute, duration
- Add Event which includes additional parameters: related objects, contact, calendar category, repeating information, users to invite to the event, email invitation information
- Learn more: Appointments
To associate an appointment with a record in any object, use the Parameters object and add the reference_id and reference_type as key-value pairs.
An appointment that is associated with a specific record in an object is displayed in the 'Open Activities' section of the record the event is related to.
In order to use this API with an 'Add' trigger, choose the 'After Triggering Actions' activation sequence, because the record is not available for association with the 'Before Triggering Actions' activation sequence.
Syntax
Result = Functions.addEvent(String subject, String ownerID, Date startDate, int startHour, int startMin, int duration) Result = Functions.addEvent(String subject, String ownerID, Date startDate, int startHour, int startMin, int duration, Parameters params)
Parameters
- subject
- The subject of the event
- ownerID
- The identifier of the owner of the event
- startDate
- The start date of the event
- Learn more: Start Date Functionality
- startHour
- The start hour of the event
- startMin
- The start minute of the event
- duration
- The length of the event
- params
- Other field-value pairs for the event
Return
- Example
- This example calls addEvent with seven parameters, adding an event for the leadName on the current date at 10 AM with duration of 1 hour.
String ownerID = ""; String leadName = ""; // Some code to populate the ownerID. // Some code to populate the leadName Result addEventResult = Functions.addEvent("Webinar for the lead " + leadName, getEnv(ENV.USER.ID), new Date(), 10, 00, 60); // Other business logic goes here
- Example
- This example creates an instance of Parameters, adds a key it it, and calls addEvent with eight parameters, adding an event for the leadName on the current date at 10 AM with duration of 1 hour.
String ownerID = ""; String leadName = ""; String leadContactID = ""; String leadID = ""; // Add code to populate the ownerID. // Add code to populate the leadName // Add code to populate leadContactID // Add code to populate the leadID Parameters params = Functions.getParametersInstance(); params.add("contact_id", getEnv(ENV.USER.ID)); params.add("reference_id", leadID); params.add("reference_type", "LEAD"); Result addEventResult = Functions.addEvent("Webinar for the lead " + leadName, getEnv(ENV.USER.ID), new Date(), 10, 00, 60, params); // Other business logic goes here //The Result object contains the ID of the appointment added using Functions.addEvent() API //Retrieve the ID of the appointment added using the getID() method of the Result class