Java API
From LongJump Support Wiki
The Java API is a set of built-in calls that are made to programmatically customize and extend the platform.
- Learn more: Java Code in the Developer Suite
The following platform elements provide the ability to make Java API calls from the user interface (UI):
- Learn more: Getting Started with Java API
- Standard Java classes, to create custom business logic that models your organization's environment
- Data policies, from the Execute Java Code Action
- Functions, which are reusable Java code
Contents |
Prerequisite
You must know the Java programming language to make the Java API calls. This includes knowing the basic elements of Java such as conditional structures (if statement), looping structures (while and for loop statements), variable declaration and assignment, use of operators, variable naming conventions, debugging techniques, and so on.
Classes, Objects and APIs
| Classes, Objects and APIs | Detail |
|---|---|
| Record Handling
Provides APIs to get, add, update, delete and search for Objects | |
| Email and Document Management | |
| Event and Task Management
Provides APIs to create Appointments, Tasks and to Log Activities | |
| Transaction Management
Provides the ability to Rollback transactions to a SavePoint | |
| Support Classes and Objects
Use these support classes and objects when you work with the Java API | |
| Utility
Provides APIs to perform general-purpose operations | |
| Customize
Provides the ability to access metadata in Fields and Objects |
Identifying Objects and Records
Many of the API record handling calls require an <object> element identifier. To find the Object Identifier:
The object identifier is a unique identifier for an object type, and is used to reference object identifiers in APIs. The object identifier format differs, depending whether the object is an Object or a System-Generated Object.
- Learn more:
- Session Identifier - session identifier
- Record Identifier - record identifier
Find the Object Identifier in Objects
To find the object identifier syntax for Objects:
- Click Setup | Customize | Objects | <object name>
- Click the Properties tab to see the object identifier
- Object Name is typically used in APIs, because it is more "readable", although Object Id can be used as well
Java API Library Reference
Learn more about web services and programming at these sites:
| Syntax | Description | Return | Category | API Detail |
|---|---|---|---|---|
| addEvent (String subject, String ownerID, Date startDate, int hour, int min, int duration [, Parameters params]) | Adds an event with values from params | Result object | Event and Task Management | addEvent |
| addRecord (String objectName, Params params) | Adds a new record of type objectId with values from params | Result object | Record Handling | addRecord |
| addSavePoint (String name) | Adds a Save Point with name | None | Utility | addSavePoint |
| addTask (String subject, Date dueDate, String ownerId [, Parameters params]) | Adds a task with values from params | Result object | Event and Task Management | addTask |
| debug (Object obj) | Puts a debug statement into the debug log for Object obj. obj can be a String also | None | Utility | debug |
| deleteEvent (String eventId) | Deletes the event for the eventId | Result object | Event and Task Management | deleteEvent |
| deleteRecord (String objectName, String recordId) | Deletes Record of type objectId where id is recordId | Result object | Record Handling | deleteRecord |
| deleteTask (String recordId) | Deletes a task for the taskId | Result object | Event and Task Management | deleteTask |
| doesSavePointExist (String name) | checks whether specified save point with name is exist or not | Boolean | Utility | doesSavePointExist |
| exec (String functionName, Parameters params) | Executes function functionName with params as input. Note that this params object is visible in functionName as functionParams | The return value is defined by the function | Utility | exec |
| generateDocument (String objectName, String recordId, String templateId, String format) | Generates document of templateId evaluated with params in format. If format is "PDF" it generates the document in PDF format, otherwise HTML format. It relates this generated document to object of type objectId and record with id recordId | Result object | Email and Document Management | generateDocument |
| getAllSavePoints() | Returns All Save Points | Set | Utility | getAllSavePoints |
| getEnv (String key) | Gets the environment variable value for the key | The value of the environment variable | Utility | getEnv |
| getParametersInstance() | Gets an instance of Parameters class | Utility | Parameters object | getParametersInstance |
| getRecord (String objectName, String fields, String recordId) | Gets the record of type objectId identified by recordId. fields is a comma separated list of fields that you want to fetch | Result object | Record Handling | getRecord |
| logActivity (String subject, String objectName, String id, String activityByID, Parameters params) | Logs an activity | Result object | Event and Task Management | logActivity |
| processWorkflowAction (String workflowName,String currentStateName,String recordId,String customObjectName,String workflowAction,String workflowComments) | Process Work flow Action | Result object | Record Handling | processWorkflowAction |
| removeSavePoint (String name) | removes save point with name from save point list | None | Utility | removeSavePoint |
| rollback() | Roll backs all the inserts and updates | None | Utility | rollback |
| rollbackToSavePoint (String name) | Rollback to specific save point with name | None | Utility | rollbackToSavePoint |
| searchRecords (String objectName, String fields, String criteria [, Parameters params]) | Search and retrieve the records, for object of type objectId. fields is a comma-separated list of fields that you want to fetch and criteria is expressed in filter language | Result object | Record Handling | searchRecords |
| sendEmail (String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList) | Sends an Email | Result object | Email and Document Management | sendEmail |
| sendEmailUsingTemplate (String objectName, String recordId, String to, String cc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList) | Sends an Email evaluating Template identified by bodyTemplateId as email body | Result object | Email and Document Management | sendEmailUsingTemplate |
| setTargetPage (String url) | Sets the target page | None | Utility | setTargetPage |
| showMessage (String message) | Displays message | None | Utility | showMessage |
| throwError (String message) | Throws error with the message | None | Utility | throwError |
| updateEvent (String eventId, Parameters params) | Updates an event with values in params | Result object | Event and Task Management | updateEvent |
| updateRecord (String objectName, String recordId, Params params) | Updates record of type objectId with values params. The Record is identified by recordId | Result object | Record Handling | updateRecord |
| updateTask (String taskId, Parameters params) | Updates a task with values in params | Result object | Event and Task Management | updateTask |
