Difference between revisions of "Java API"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Β 
(112 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>__NUMBEREDHEADINGS__</noinclude>The Java API is a set of built-in calls that are made to programmatically customize and extend the platform. Β 
<noinclude>__NUMBEREDHEADINGS__</noinclude>The Java API is a set of built-in calls that are made to programmatically customize and extend the platform. Β 
Β 
__TOC__
== About the Java API ==
The following platform elements provide the ability to make Java API calls from the user interface (UI):
The following platform elements provide the ability to make Java API calls from the user interface (UI):
:*Standard Java [[Classes|classes]], to create custom business logic that models your organization's environment
:*Standard Java [[Classes|classes]], to create custom business logic that models your organization's environment
:*[[Data Policy|Data policies]], by [[Data_Policy#Invoke_a_Java_Method_From_a_Data_Policy|Invoking a Java Method]]
:* JSP [[Pages]], which can invoke Java APIs
Β 
== Prerequisites ==
Β 
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.


:''Learn more: Β 
:''Learn more about the platform:''
::*''[[Getting Started with the Java API]]''
::* [[Getting Started with the Java API]]
::* [[Developer_Suite#Java_Code|Java Code in the Developer Suite]]''
::* [[Java Code Samples]]
::* [[Java API Cheatsheet]]
::* [[System Object Types]]
::* [[Developer_Suite#Java_Code|Java Code in the Developer Suite]]
::* Java API [{{DOCHOST}}/javadocs javadocs]


== Prerequisite ==
:''Learn more about web services and programming:''
::* [http://en.wikipedia.org/wiki/Java_programming_language Java Programming Language]
::* [http://java.sun.com/docs/books/tutorial/java/concepts/index.html Java Tutorial]


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==
This table lists the APIs and links to detail pages. For a quick synopsis of syntax, see the [[Java API Cheatsheet]].
Β 
===Record Handling===
====Objects====
:Handle records in standard [[Objects]]:
::* [[Java API:Record_Handling#addRecord|<tt>addRecord</tt>]]
::* [[Java API:Record_Handling#updateRecord|<tt>updateRecord</tt>]]
::* [[Java_API:Record_Handling#changeOwnerShipInfo|<tt>changeOwnerShipInfo</tt>]]
::* [[Java API:Record_Handling#deleteRecord|<tt>deleteRecord</tt>]]
::* [[Java API:Record_Handling#getRecord|<tt>getRecord</tt>]]
::* [[Java API:Record_Handling#getRecordCount|<tt>getRecordCount</tt>]]
::* [[Java API:Record_Handling#searchRecords|<tt>searchRecords</tt>]]
::* [[Java API:Record_Handling#replaceTemplateVariables|<tt>replaceTemplateVariables</tt>]]
::* [[Java API:Record_Handling#execSQL|<tt>execSQL</tt>]]
Β 
:''Learn more:'' [[Java_API:Record_Handling]]
Β 
====Composite Objects====
:Operate on records in [[Composite Object]]s:
::* [[Java API:Composite Objects#getRecordCount|<tt>getRecordCount</tt>]]
::* [[Java API:Composite Objects#getRecord|<tt>getRecord</tt>]]
::* [[Java API:Composite Objects#searchRecords|<tt>searchRecords</tt>]]
Β 
:''Learn more:'' [[Working with Composite Objects]]


==Classes, Objects and APIs==
====Tenant Data Sharing====
{| border="1" cellpadding="5" cellspacing="0"
:Handle records in Objects shared using [[Tenant Data Sharing Policies]]:
! Classes, Objects and APIs
::* [[Tenant_Data_Sharing_Policies#addRecord|<tt>addRecord</tt>]]
! Detail
::* [[Tenant_Data_Sharing_Policies#updateRecord|<tt>updateRecord</tt>]]
|-
::* [[Tenant_Data_Sharing_Policies#deleteRecord|<tt>deleteRecord</tt>]]
|[[Java_API:Record_Handling|Record Handling]]
To handle records in [[Objects]]
|
* [[Java API:Record_Handling#addRecord|<tt>addRecord</tt>]]
* [[Java API:Record_Handling#updateRecord|<tt>updateRecord</tt>]]
* [[Java_API:Record_Handling#changeOwnerShipInfo|<tt>changeOwnerShipInfo</tt>]]
* [[Java API:Record_Handling#deleteRecord|<tt>deleteRecord</tt>]]
<!--FUTURE
<!--FUTURE
* [[Java API:Record_Handling#getRecordCount|<tt>getRecordCount</tt>]]
::* [[Tenant_Data_Sharing_Policies#getRecordCount|<tt>getRecordCount</tt>]]
-->
-->
* [[Java API:Record_Handling#searchRecords|<tt>searchRecords</tt>]]
::* [[Tenant_Data_Sharing_Policies#searchRecords|<tt>searchRecords</tt>]]
* [[Java API:Record_Handling#getRecord|<tt>getRecord</tt>]]
::* [[Tenant_Data_Sharing_Policies#getRecord|<tt>getRecord</tt>]]
* [[Java API:Record_Handling#replaceTemplateVariables|<tt>replaceTemplateVariables</tt>]]


|-
:''Learn more:'' [[Tenant_Data_Sharing_Policies#Using the JAVA API to Access Shared Data]]
|Record Handling for [[Composite Object]]s
To operate on records in composite [[Object Relationships]]
|
* [[Java API:Composite Objects#getRecordCount|<tt>getRecordCount</tt>]]
* [[Java API:Composite Objects#getRecord|<tt>getRecord</tt>]]
* [[Java API:Composite Objects#searchRecords|<tt>searchRecords</tt>]]


|-
====Data Import====
|[[Java_API:Record_Handling#Workflow Record Handling|Workflow Record Handling]]
:Import CSV data into [[Object]]s
To manage [[Workflows]]
::* [[Java_API:Data Import#getMappingProfiles|<tt>getMappingProfiles</tt>]]
|
::* [[Java_API:Data Import#importData|<tt>importData</tt>]]
* [[Java API:Record_Handling#processWorkflowAction|<tt>processWorkflowAction</tt>]]
::* <tt>[[getImportStatus]]</tt>
* [[Java API:Record_Handling#getWorkflowActionList|<tt>getWorkflowActionList</tt>]]
* [[Java API:Record_Handling#getWFOwners|<tt>getWFOwners</tt>]]


|-
:''Learn more:'' [[Java_API:Data Import]]
|[[Tenant_Data_Sharing_Policies#Using the JAVA API to Access Shared Data | Record Handling for Tenant Data Sharing]]
Β 
To handle records in Objects shared using [[Tenant Data Sharing Policies]]
===Email===
|
:* [[Java API:Email#sendEmail|<tt>sendEmail</tt>]]
* [[Tenant_Data_Sharing_Policies#addRecord|<tt>addRecord</tt>]]
:* [[Java API:Email#sendEmailUsingTemplate|<tt>sendEmailUsingTemplate</tt>]]
* [[Tenant_Data_Sharing_Policies#updateRecord|<tt>updateRecord</tt>]]
* [[Tenant_Data_Sharing_Policies#deleteRecord|<tt>deleteRecord</tt>]]
<!--FUTURE
* [[Tenant_Data_Sharing_Policies#getRecordCount|<tt>getRecordCount</tt>]]
-->
* [[Tenant_Data_Sharing_Policies#searchRecords|<tt>searchRecords</tt>]]
* [[Tenant_Data_Sharing_Policies#getRecord|<tt>getRecord</tt>]]


|-
===Document Management===
|[[Java_API:Data Import|Data Import]]
:* [[Java API:Document Management#generateDocument|<tt>generateDocument</tt>]]
Import CSV data into [[Object]]s
:* [[Java API:Document Management#getDocument|<tt>getDocument</tt>]]
|
:* [[Java API:Document Management#Example: Generate an Attachment|Example: Generate an Attachment]]
* [[Java_API:Data Import#getMappingProfiles|<tt>getMappingProfiles</tt>]]
* [[Java_API:Data Import#importData|<tt>importData</tt>]]


|-
===Transaction Management===
|[[Java_API:Email_and_Document_Management|Email and Document Management]]
Provides APIs to manage [[Email]] and [[Documents]]
|
* [[Java API:Email_and_Document_Management#sendEmail|<tt>sendEmail</tt>]]
* [[Java API:Email_and_Document_Management#sendEmailUsingTemplate|<tt>sendEmailUsingTemplate</tt>]]
* [[Java API:Email_and_Document_Management#generateDocument|<tt>generateDocument</tt>]]
|-
|[[Java_API:Event_and_Task_Management|Event and Task Management]]
Provides APIs to create [[Appointments]], [[Tasks]] and to [[Log Activity|Log Activities]]
|
* [[Java_API:Event_and_Task_Management#addTask|<tt>addTask</tt>]]
* [[Java_API:Event_and_Task_Management#updateTask|<tt>updateTask</tt>]]
* [[Java_API:Event_and_Task_Management#deleteTask|<tt>deleteTask</tt>]]
* [[Java_API:Event_and_Task_Management#addEvent|<tt>addEvent</tt>]]
* [[Java_API:Event_and_Task_Management#updateEvent|<tt>updateEvent</tt>]]
* [[Java_API:Event_and_Task_Management#deleteEvent|<tt>deleteEvent</tt>]]
* [[Java_API:Event_and_Task_Management#logActivity|<tt>logActivity</tt>]]
|-
|[[Java_API:Transaction_Management|Transaction Management]]
Provides the ability to Rollback transactions to a SavePoint
Provides the ability to Rollback transactions to a SavePoint
|
:*[[Java_API:Transaction_Management#addSavePoint|<tt>addSavePoint</tt>]]
*[[Java_API:Transaction_Management#addSavePoint|<tt>addSavePoint</tt>]]
:*[[Java_API:Transaction_Management#doesSavePointExist|<tt>doesSavePointExist</tt>]]
*[[Java_API:Transaction_Management#rollbackToSavePoint|<tt>rollbackToSavePoint</tt>]]
:*[[Java_API:Transaction_Management#getAllSavePoints|<tt>getAllSavePoints</tt>]]
*[[Java_API:Transaction_Management#doesSavePointExist|<tt>doesSavePointExist</tt>]]
:*[[Java_API:Transaction_Management#rollback|<tt>rollback</tt>]]
*[[Java_API:Transaction_Management#rollback|<tt>rollback</tt>]]
:*[[Java_API:Transaction_Management#rollbackToSavePoint|<tt>rollbackToSavePoint</tt>]]
*[[Java_API:Transaction_Management#removeSavePoint|<tt>removeSavePoint</tt>]]
:*[[Java_API:Transaction_Management#removeSavePoint|<tt>removeSavePoint</tt>]]
*[[Java_API:Transaction_Management#getAllSavePoints|<tt>getAllSavePoints</tt>]]
Β 
|-
:''Learn more:'' [[Java_API:Transaction_Management]]
|[[Java_API:Support_Classes_and_Objects|Support Classes and Objects]]
Β 
Use these support classes and objects when you work with the Java API
===Support Classes and Objects===
|
Use these support classes and objects when you work with the Java API.
* [[Java_API:Support_Classes_and_Objects#HttpConnection_Class|<tt>HttpConnection</tt> class]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html Functions] class
* [[Java_API:Support_Classes_and_Objects#Parameters_Class|<tt>Parameters</tt> class]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Logger.html Logger] class
* [[Java_API:Support_Classes_and_Objects#ParametersIterator_Class|<tt>ParametersIterator</tt> class]]
::<hr width="200px">
* [[Java_API:Support_Classes_and_Objects#Result_Class|<tt>Result</tt> class]]
:* [[Java_API:Support_Classes_and_Objects#HttpConnection_Class|<tt>HttpConnection</tt> class]]
* [[Java_API:Support_Classes_and_Objects#SearchContext_Class|<tt>SearchContext</tt> class]]
:* [[Java_API:Support_Classes_and_Objects#Parameters_Class|<tt>Parameters</tt> class]]
<hr>
:* [[Java_API:Support_Classes_and_Objects#ParametersIterator_Class|<tt>ParametersIterator</tt> class]]
* [[Java_API:Support_Classes_and_Objects#functionParams_Object|<tt>functionParams</tt> object]]
:* [[Java_API:Support_Classes_and_Objects#Result_Class|<tt>Result</tt> class]]
* [[Java_API:Support_Classes_and_Objects#request_Object|<tt>request</tt> object]] - [[Page]]
:* [[Java_API:Support_Classes_and_Objects#SearchContext_Class|<tt>SearchContext</tt> class]]
* [[Java_API:Support_Classes_and_Objects#requestParams_Object|<tt>requestParams</tt> object]] - [[Data Policies|Data Policy]]
::<hr width="200px">
* [[Java_API:Support_Classes_and_Objects#TenantContext_Object|<tt>TenantContext Object</tt>]]
:* [[Java_API:Support_Classes_and_Objects#request_Object|<tt>request</tt> object]] - used in [[Pages]]
|-
:* [[Java_API:Support_Classes_and_Objects#TenantContext_Object|<tt>TenantContext Object</tt>]]
|[[Java API:Utility|Utility]]
Β 
Provides APIs to perform general-purpose operations
:''Learn more:'' [[Java_API:Support_Classes_and_Objects]]
|
Β 
* [[Java_API:Utility#debug|<tt>debug</tt>]]
===<span id="localization">Localization Functions</span>===
* [[Java_API:Utility#exec|<tt>exec</tt>]]
Use these functions to convert between [[Database Format]]s and localized [[User Format]]s.
* [[Java_API:Utility#getEnv|<tt>getEnv</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatCurrency(java.lang.String,%20int) <tt>formatCurrency</tt>]
* [[Java_API:Utility#getParametersInstance|<tt>getParametersInstance</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatDate(java.util.Date) <tt>formatDate</tt>]
* [[Java_API:Utility#getTimezonesUtility|<tt>getTimezonesUtility</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatDateTime(java.util.Date) <tt>formatDateTime</tt>]
* [[Java_API:Utility#getTimezoneUtility|<tt>getTimezoneUtility</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatNumber(java.lang.String,%20int) <tt>formatNumber</tt>]
* [[Java_API:Utility#getLoggedInUserInfo|<tt>getLoggedInUserInfo</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatPercent(java.lang.String,%20int) <tt>formatPercent</tt>]
* [[Java_API:Utility#setTargetPage |<tt>setTargetPage </tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatTime(java.util.Date) <tt>formatTime</tt>]
* [[Java_API:Utility#showMessage |<tt>showMessage </tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#parseCurrency(java.lang.String) <tt>parseCurrency</tt>]
* [[Java_API:Utility#throwError|<tt>throwError</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#parseNumber(java.lang.String) <tt>parseNumber</tt>]
* [[Java_API:Utility#translateToken|<tt>translateToken</tt>]]
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#parsePercent(java.lang.String) <tt>parsePercent</tt>]
|-
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#validateCurrency(java.lang.String) <tt>validateCurrency</tt>]
|'''GUI'''
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#validateNumber(java.lang.String) <tt>validateNumber</tt>]
APIs for GUI components
:* [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#validatePercent(java.lang.String) <tt>validatePercent</tt>]
|
Β 
*[[Java_API:Enumerated_Fields|Enumerated Fields]]
:''Learn more:'' [[Localization]]
**[[Java_API:Enumerated_Fields#Retrieving_Field_Metadata|Retrieving Field Metadata]]
**[[Java_API:Enumerated_Fields#Adding_a_Picklist|Adding a Picklist]]
**[[Java_API:Enumerated_Fields#Updating_a_Picklist|Updating a Picklist]]
**[[Java_API:Enumerated_Fields#Define_Mapping_for_a_Dependent_Picklist|Define Mapping for a Dependent Picklist]]
*[[Java_API:Global_Picklists|Global Picklists]]
**[[Java_API:Global_Picklists#|Adding a Global Picklist]]
**[[Java_API:Global_Picklists#|Searching for Global Picklists]]
**[[Java_API:Global_Picklists#|Getting a Global Picklist]]
**[[Java_API:Global_Picklists#|Updating a Global Picklist]]
**[[Java_API:Global_Picklists#|Deleting a Global Picklist]]


|-
===Utility Functions===
|[[Java_API:Customize|Customize]]
====Logger functions====
These [[Provisional]] APIs give you the ability to manage metadata for program entities.
:* [[Java_API:Utility functions#Logger functions|<tt>info</tt>]]
|
:* [[Java_API:Utility functions#Logger functions|<tt>warn</tt>]]
*[[Java_API:Customize#Object_Metadata|Object Metadata]]
:* [[Java_API:Utility functions#Logger functions|<tt>error</tt>]]
*[[Java_API:Customize#Field_Metadata|Field Metadata]] Β 
:* [[Java_API:Utility functions#Logger functions|<tt>fatal</tt>]]
*[[Java_API:Customize#Form_Metadata|Form Metadata]]
*[[Java_API:Customize#Package_Metadata|Package Metadata]]


|-
====Service Configuration Functions====
|[[getStatus|Status]]
:* [{{DOCHOST}}/javadocs/com/platform/api/utility/ServiceConfiguration.html#getServiceName()<tt>getServiceName</tt>]
API for checking status of scheduled jobs.
:* [{{DOCHOST}}/javadocs/com/platform/api/utility/ServiceConfiguration.html#getServiceDomainURL()<tt>getServiceDomainURL</tt>]
|
*[[getStatus]]


|}
====General Purpose Functions====
:* [[Java_API:Utility functions#getEnv|<tt>getEnv</tt>]]
:* [[Java_API:Utility functions#getLoggedInUserInfo|<tt>getLoggedInUserInfo</tt>]]
:* [[Java_API:Utility functions#getParametersInstance|<tt>getParametersInstance</tt>]]
:* [[Java_API:Utility functions#getTimezonesUtility|<tt>getTimezonesUtility</tt>]]
:* [[Java_API:Utility functions#getTimezoneUtility|<tt>getTimezoneUtility</tt>]]
:* [[Java_API:Utility functions#showMessage |<tt>showMessage</tt>]]
:* [[Java_API:Utility functions#sleep |<tt>sleep</tt>]]
:* [[Java_API:Utility functions#setTargetPage |<tt>setTargetPage </tt>]]
:* [[Java_API:Utility functions#throwError|<tt>throwError</tt>]]
:* [[Java_API:Utility functions#translateToken|<tt>translateToken</tt>]]


==Identifying Objects and Records ==
:''Learn more:'' [[Java API:Utility functions]]
Many of the API record handling calls require an <nowiki>{object}</nowiki> element identifier. To find the Object Type Identifier:


{{:Object Type Identifier}}
===Customization APIs===
Use these [[Provisional]] APIs give to manage metadata for program entities.
:*[[Java_API:Customize#Object_Metadata|Object Metadata]]
:*[[Java_API:Customize#Field_Metadata|Field Metadata]]
:*:*[[Java_API:Enumerated_Fields|Enumerated Fields]]
:*:*[[Java_API:Global_Picklists|Global Picklists]]
<!--:*[[Java_API:Customize#Form_Metadata|Form Metadata]]-->
Β 
:''Learn more:'' [[Java_API:Customize|Customize]]
Β 
===Status===
Check status of scheduled jobs.
:*[[getStatus]]


==Java API Library Reference==
:''Learn more:'' [[getStatus]]
Learn more about web services and programming at these sites:
*[http://en.wikipedia.org/wiki/Java_programming_language Java Programming Language]
*[http://java.sun.com/docs/books/tutorial/java/concepts/index.html Java Tutorial]


These APIs are defined in the [http://lj.platformatyourservice.com/lj80/download/javadocs/com/platform/api/Functions.html Functions] class.
==Finding Identifiers ==
===Object ID===
{{:Object Type Identifier}}
===Record ID===
Each record has a unique ID, needed to access and update data. The Record Identifier can appear as: <tt>id,Β  record_id, or recordId</tt>, depending on the tool. (Most often it appears as the <tt>id</tt> field to programmers.)


{| border="1" cellpadding="5" cellspacing="0"
:''Learn more:'' [[Record ID]]
!Syntax
!Description
!Return
!Category
!API Detail
|-width="150"
|<tt>addEvent (String subject, String ownerID, Date startDate, int hour, int min, int duration [, Parameters params])</tt>||Adds an event with values from params|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#addEvent|<tt>addEvent</tt>]]
|-
|<tt>addRecord (String objectName, Params params)</tt>||Adds a new record of type objectId with values from params|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#addRecord|<tt>addRecord</tt>]]
|-
|<tt>addSavePoint (String name)</tt>||Adds a Save Point with name|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#addSavePoint |<tt> addSavePoint </tt>]]
|-
|<tt>addTask (String subject, Date dueDate, String ownerId [, Parameters params])</tt>||Adds a task with values from params|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#addTask|<tt>addTask</tt>]]
|-
|<tt>changeOwnerShipInfo(String object_id, String record_id, String owner_id)</tt>||Changes the ownder of the designated record|| None|| [[Java_API:Record_Handling|Record Handling]] || [[Java_API:Record_Handling#changeOwnerShipInfo|changeOwnerShipInfo]]
|-
|<tt>debug (Object obj)</tt>||Puts a debug statement into the debug log for Object obj. obj can be a String also|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#debug |<tt> debug </tt>]]
|-
|<tt>deleteEvent (String eventId)</tt>||Deletes the event for the eventId|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#deleteEvent | <tt> deleteEvent </tt>]]
|-
|<tt>deleteRecord (String objectName, String recordId)</tt>||Deletes Record of type objectId where id is recordId|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#deleteRecord |<tt> deleteRecord </tt>]]
|-
|<tt>deleteTask (String recordId)</tt>||Deletes a task for the taskId|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#deleteTask |<tt> deleteTask</tt>]]
|-
|<tt>doesSavePointExist (String name)</tt>||checks whether specified save point with name is exist or not|| Boolean|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#doesSavePointExist |<tt> doesSavePointExist </tt>]]
|-
|<tt>exec (String functionName, Parameters params)</tt>||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|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#exec |<tt> exec </tt>]]
|-
|<tt>generateDocument (String objectName, String recordId, String templateId, String format)</tt>||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 Class|Result object]]|| [[Java_API:Email_and_Document_Management|Email and Document Management]]|| [[Java API:Email_and_Document_Management#generateDocument |<tt> generateDocument</tt>]]
|-
|<tt>getAllSavePoints()</tt>||Returns All Save Points|| Set|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#getAllSavePoints|<tt> getAllSavePoints</tt>]]
|-
|<tt>getEnv (String key)</tt>||Gets the environment variable value for the key|| The value of the environment variable || [[Java_API:Utility|Utility]] ||[[Java_API:Utility#getEnv |<tt> getEnv </tt>]]
|-
|<tt>Functions.getParametersInstance()</tt>||Gets an instance of Parameters class||[[Java_API:Utility|Utility]] ||[[Parameters Class|Parameters object]]||[[Java_API:Utility#getParametersInstance |<tt> getParametersInstance </tt>]]
|-
|<tt>getRecord (String objectName, String fields, String recordId)</tt>||Gets the record of type objectId identified by recordId. fields is a comma separated list of fields that you want to fetch|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#getRecord |<tt> getRecord </tt>]]
|-
|<tt>logActivity (String subject, String objectName, String id, String activityByID, Parameters params)</tt>||Logs an activity|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#logActivity |<tt> logActivity </tt>]]
|-
|<tt>processWorkflowAction (String workflowName,String currentStateName,String recordId,String customObjectName,String workflowAction,String workflowComments)</tt>||Process Work flow Action|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java_API:Record_Handling#processWorkflowAction |<tt> processWorkflowAction </tt>]]
|-
|<tt>removeSavePoint (String name)</tt>||removes save point with name from save point list|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#removeSavePoint |<tt> removeSavePoint </tt>]]
|-
|<tt>rollback ()</tt>||Roll backs all the inserts and updates|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#rollback |<tt> rollback </tt>]]
|-
|<tt>rollbackToSavePoint (String name)</tt>||Rollback to specific save point with name|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#rollbackToSavePoint |<tt> rollbackToSavePoint </tt>]]
|-
|<tt>searchRecords (String objectName, String fields, String criteria [, Parameters params])</tt>||Search and retrieve the records, for object of type <tt>objectId</tt>. <tt>fields</tt> is a comma-separated list of fields that you want to fetch and criteria is expressed in filter language|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#searchRecords |<tt> searchRecords </tt>]]
|-
|<tt>sendEmail (String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList)</tt>||Sends an Email|| [[Result Class|Result object]]|| [[Java_API:Email_and_Document_Management|Email and Document Management]]|| [[Java API:Email_and_Document_Management#sendEmail |<tt> sendEmail </tt>]]
|-
|<tt>sendEmailUsingTemplate (String objectName, String recordId, String to, String cc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList)</tt>||Sends an Email evaluating Template identified by bodyTemplateId as email body|| [[Result Class|Result object]]|| [[Java_API:Email_and_Document_Management|Email and Document Management]]|| [[Java API:Email_and_Document_Management#sendEmailUsingTemplate|<tt> sendEmailUsingTemplate </tt>]]
|-
|<tt>setTargetPage (String url)</tt>||Sets the target page|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#setTargetPage|<tt>setTargetPage </tt>]]
|-
|<tt>showMessage (long millisecs)</tt>||Displays message|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#showMessage|<tt>showMessage </tt>]]
|-
|<tt>sleep(String message)</tt>||Sleeps for the designated number of milliseconds.|| None || [[Java_API:Utility|Utility]]|| [[Java_API:Utility#sleep|<tt>sleep </tt>]]
|-
|<tt>throwError (String message)</tt>||Throws error with the message|| None|| [[Java_API:Utility|Utility]]|| [[Java_API:Utility#throwError|<tt>throwError </tt>]]
|-
|<tt>updateEvent (String eventId, Parameters params)</tt>||Updates an event with values in params|| [[Result Class|Result object]]|| [[Java API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#updateEvent|<tt>updateEvent </tt>]]
|-
|<tt>updateRecord (String objectName, String recordId, Params params)</tt>||Updates record of type objectId with values params. The Record is identified by recordId|| [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]|| [[Java API:Record_Handling#updateRecord |<tt> updateRecord </tt>]]
|-
|<tt>updateTask (String taskId, Parameters params)</tt>||Updates a task with values in params|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]|| [[Java_API:Event_and_Task_Management#updateTask |<tt> updateTask </tt>]]
|}


__FORCETOC__
===Session ID===
{{:Session Identifier}}
===Commonly Used Constants===
{{:Commonly Used Constants}}
<noinclude>
<noinclude>


[[Category:Java API|1 (Intro & Overview)]]
[[Category:Java API|1 (Intro & Overview)]]
</noinclude>
</noinclude>

Latest revision as of 20:41, 3 October 2014

The Java API is a set of built-in calls that are made to programmatically customize and extend the platform.

1 About the Java API

The following platform elements provide the ability to make Java API calls from the user interface (UI):

  • Standard Java classes, to create custom business logic that models your organization's environment
  • JSP Pages, which can invoke Java APIs

2 Prerequisites

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.

Learn more about the platform:
Learn more about web services and programming:

3 Classes, Objects, and APIs

This table lists the APIs and links to detail pages. For a quick synopsis of syntax, see the Java API Cheatsheet.

3.1 Record Handling

3.1.1 Objects

Handle records in standard Objects:
Learn more: Java_API:Record_Handling

3.1.2 Composite Objects

Operate on records in Composite Objects:
Learn more: Working with Composite Objects

3.1.3 Tenant Data Sharing

Handle records in Objects shared using Tenant Data Sharing Policies:
Learn more: Tenant_Data_Sharing_Policies#Using the JAVA API to Access Shared Data

3.1.4 Data Import

Import CSV data into Objects
Learn more: Java_API:Data Import

3.2 Email

3.3 Document Management

3.4 Transaction Management

Provides the ability to Rollback transactions to a SavePoint

Learn more: Java_API:Transaction_Management

3.5 Support Classes and Objects

Use these support classes and objects when you work with the Java API.



Learn more: Java_API:Support_Classes_and_Objects

3.6 Localization Functions

Use these functions to convert between Database Formats and localized User Formats.

Learn more: Localization

3.7 Utility Functions

3.7.1 Logger functions

3.7.2 Service Configuration Functions

3.7.3 General Purpose Functions

Learn more: Java API:Utility functions

3.8 Customization APIs

Use these Provisional APIs give to manage metadata for program entities.

Learn more: Customize

3.9 Status

Check status of scheduled jobs.

Learn more: getStatus

4 Finding Identifiers

4.1 Object ID

An object type identifier uniquely identifies an object type. It is used to specify object types in APIs.

There are two kinds of type identifiers:

  • objectName: This identifier is a human-readable name for both System Objects and Custom Objects.
  • objectID: This identifier is a human-readable name for System Objects (e.g. "cases"), but for Custom Objects, it is a computer-generated string with no humanly-interpretable semantic value (e.g. 123qwe456rty).
See also:

To find an object type identifier:

  1. Click GearIcon.png > Customization > Objects
  2. In the Display Title column, find the object you're looking for.
  3. The Object Name column has the identifier you need.

Alternatively:

  1. Go to GearIcon.png > Customization > Objects > {object}
  2. Click Properties
  3. The object name appears at the top of the page

Notepad.png

Note:

4.2 Record ID

Each record has a unique ID, needed to access and update data. The Record Identifier can appear as: id, record_id, or recordId, depending on the tool. (Most often it appears as the id field to programmers.)

Learn more: Record ID

4.3 Session ID

The Session Identifier (session_id or sessionId) is used in HTTP communications to identify a series of related message exchanges, or "sessions".

Learn more: session identifier

4.4 Commonly Used Constants

Constants are defined in the CONSTANTS class. On that page, follow the links in the Nested Class Summary for a complete guide to AgileApps Cloud platform constants. For convenience, some of the more common constants used in the Java APIs are listed here.

Notepad.png

Note:

  • Constants have all-uppercase names, and are listed as static in the Field Summary. For example: static String CONTAINS
  • Some of the classes have nested classes of their own. Keep drilling down until you find the constant you need.

4.4.1 Documents

Constant Name Description Used in function
CONSTANTS.DOCUMENT.HTML HTML format generateDocument
CONSTANTS.DOCUMENT.PDF PDF format generateDocument

4.4.2 Search

Constant Name Description Used in function
CONSTANTS.SEARCH.SORT_ASCENDING Ascending order searchRecords
CONSTANTS.SEARCH.SORT_DESCENDING Descending order searchRecords

4.4.3 HttpConnection

Constant Name Description Used in function
CONSTANTS.HTTP. METHOD.GET HTTP GET request HttpConnection Constructor
CONSTANTS.HTTP. METHOD.POST HTTP POST request HttpConnection Constructor

4.4.4 Request Parameter

Constant Name Description Used in
... ... ...
CONSTANTS.SEARCH.SEARCH_RESULTS Retrieve search results