Difference between revisions of "Java API Cheatsheet"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Β 
(101 intermediate revisions by the same user not shown)
Line 2: Line 2:
__TOC__
__TOC__
=== Record Handling ===
=== Record Handling ===
{| border="1" cellpadding="5" cellspacing="0"
====Standard Objects====
[[Java_API:Record_Handling|Record Handling APIs]]
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
!Return
!Return
!Category


|-width="150"
|-width="150"
|<tt>[[Java API:Record_Handling#addRecord|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]] Β 
|<tt>[[Java API:Record_Handling#addRecord|addRecord]](String objectName, Params params)</tt>||Adds a new record of type objectId with values from params|| [[Result Class|Result object]] Β 


|-
|-
|<tt>[[Java_API:Record_Handling#updateRecord|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]]
|<tt>[[Java_API:Record_Handling#updateRecord|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]]


|-
|-
|<tt>[[Java_API:Record_Handling#changeOwnerShipInfo|changeOwnerShipInfo]](String object_id, String record_id, String owner_id)</tt>||Changes the owner of the designated record|| None|| [[Java_API:Record_Handling|Record Handling]]
|<tt>[[Java_API:Record_Handling#changeOwnerShipInfo|changeOwnerShipInfo]](String object_id, String record_id, String owner_id)</tt>||Changes the owner of the designated record|| None


|-
|-
|<tt>[[Java API:Record_Handling#deleteRecord |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]] Β 
|<tt>[[Java API:Record_Handling#deleteRecord |deleteRecord]](String objectName, String recordId)</tt>||Deletes Record of type objectId where id is recordId|| [[Result Class|Result object]]


|-
|-
|<tt>[[Java API:Record_Handling#getRecord|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]]
|<tt>[[Java API:Record_Handling#getRecord|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]]


|-
|-
|<tt>[[Java API:Record_Handling#getRecordCount|getRecordCount]](String objectName, String criteria)</tt>|| Returns the number of records in the object || int || [[Java_API:Record_Handling|Record Handling]]
|<tt>[[Java API:Record_Handling#getRecordCount|getRecordCount]](String objectName, String criteria)</tt>|| Returns the number of records in the object || int Β 


|-
|-
|<tt>[[Java_API:Record_Handling#searchRecords|searchRecords]](String objectName, String fields, String criteria [, Parameters params])</tt>||Search and retrieve the records for an object. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]
|<tt>[[Java_API:Record_Handling#searchRecords|searchRecords]](String objectName, String fields, String criteria [, Parameters params])</tt>||Search and retrieve the records for an object. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]


|-
|-
|<tt>[[Java_API:Record_Handling#searchRecords|searchRecords]](String objectName, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params])</tt>||Search and retrieve records for an object. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]|| [[Java_API:Record_Handling|Record Handling]]
|<tt>[[Java_API:Record_Handling#searchRecords|searchRecords]](String objectName, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params])</tt>||Search and retrieve records for an object. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]


|- Β 
|-
| colspan="4"Β  bgcolor="Azure" style="height:7px" | <!-- SPACER ROW -->
|<tt>[[Java_API:Record_Handling#execSQL |execSQL]](String query)</tt>||Execute a SQL query|| [[Result Class|Result object]]
|}


|-
|<tt>[[Java API:Composite_Objects#getRecord|getRecord]](String compositeObject, String fields, String recordId)</tt>||Get a [{Composite Object]] record, with specified fields. || [[Result Class|Result object]]|| [[Java_API:Composite_Objects|Composite Objects]]


====Composite Objects====
[[Java_API:Composite_Objects|Composite Object APIs]]
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Description
!Return
|-
|-
|<tt>[[Java API:Composite_Objects#getRecordCount|getRecordCount]](String compositeObject, String criteria)</tt>|| Gets a count of records in a [[Composite Object]] that match specified filtering criteria. || int || [[Java_API:Composite_Objects|Composite Objects]]
|<tt>[[Java API:Composite_Objects#getRecord|getRecord]](String compositeObject, String fields, String recordId)</tt>||Get a [[Composite Object]] record, with specified fields. || [[Result Class|Result object]]


|-
|-
|<tt>[[Java_API:Composite_Objects#searchRecords|searchRecords]](String compositeObject, String fields, String criteria [, Parameters params])</tt>||Search and retrieve [[Composite Object]] records. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]|| [[Java_API:Composite_Objects|Composite Objects]]
|<tt>[[Java API:Composite_Objects#getRecordCount|getRecordCount]](String compositeObject, String criteria)</tt>|| Gets a count of records in a [[Composite Object]] that match specified filtering criteria. || int


|-
|-
|<tt>[[Java_API:Composite_Objects#searchRecords|searchRecords]](String compositeObject, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params])</tt>||Search and retrieve [[Composite Object]] records. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]|| [[Java_API:Composite_Objects|Composite Objects]]
|<tt>[[Java_API:Composite_Objects#searchRecords|searchRecords]](String compositeObject, String fields, String criteria [, Parameters params])</tt>||Search and retrieve [[Composite Object]] records. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]
Β 
|-
| colspan="4"Β  bgcolor="Azure" style="height:7px" |Β  <!-- SPACER ROW -->


|-
|-
|<tt>[[Java_API:Record_Handling#processWorkflowAction |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#Workflow Record Handling|Workflow Record Handling]]
|<tt>[[Java_API:Composite_Objects#searchRecords|searchRecords]](String compositeObject, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params])</tt>||Search and retrieve [[Composite Object]] records. <tt>fields</tt> is a comma-separated list of fields to fetch. <tt>criteria</tt> is a [[JAVA API:Filter Expressions in JAVA APIs|Filter Expression]] || [[Result Class|Result object]]
|}
|}


<!--
<!--
=== Tenant Data Sharing ===
=== Tenant Data Sharing ===
{| border="1" cellpadding="5" cellspacing="0"
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
Line 67: Line 70:


=== Data Import ===
=== Data Import ===
{| border="1" cellpadding="5" cellspacing="0"
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
Line 78: Line 81:
-->
-->


=== Email and Document Management ===
=== Email ===
{| border="1" cellpadding="5" cellspacing="0"
[[Java API:Email]]
Β 
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
!Return
!Return
!Category


|-width="150"
|-width="150"
|<tt>[[Java API:Email_and_Document_Management#sendEmail |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]]
| <tt>[[Java API:Email#sendEmail |sendEmail]](String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList)</tt>
| Send an email
| [[Result Class|Result object]]
|-width="150"
Β 
| <tt>[[Java API:Email#sendEmail |sendEmail]](String objectName, String id, String to, String cc, String bcc, String subject, String body, String attachmentTemplateId, String attachmentIdList)</tt>
| Send an email with a bcc list
| [[Result Class|Result object]]
Β 
|-width="150"
| <tt>[[Java API:Email#sendEmail |sendEmail]](String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList, TenantContext context)</tt>
| Send an email with tenant context
| [[Result Class|Result object]]
Β 
|-width="150"
| <tt>[[Java API:Email#sendEmail |sendEmail]](String objectName, String recordid, String to, String cc, String bcc, String subject, String body, String attachmentTemplateId, String attachmentIdList, String fromName, String fromAddress)</tt>
| Send an email with bcc list, from name, and from address
| [[Result Class|Result object]]
Β 
|-
|-
|<tt>[[Java_API:Email_and_Document_Management#sendEmailUsingTemplate|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]]
| <tt>[[Java_API:Email#sendEmailUsingTemplate|sendEmailUsingTemplate]](String objectName, String recordId, String to, String cc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList)</tt>
| Send an email evaluating Template identified by bodyTemplateId as email body
| [[Result Class|Result object]]


|-
|-
|<tt>[[Java API:Email_and_Document_Management#generateDocument |generateDocument</tt>]](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]]
| <tt>[[Java_API:Email#sendEmailUsingTemplate|sendEmailUsingTemplate]](String objectName, String recordId, String to, String cc, String bcc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList)</tt>
| Send an email using Template with bcc list
| [[Result Class|Result object]]
Β 
|-
| <tt>[[Java_API:Email#sendEmailUsingTemplate|sendEmailUsingTemplate]](String objectName, String recordId, String to, String cc, String bcc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList, String fromName, String fromAddress)</tt>
| Send an email using Template with bcc list, from name, and from address
| [[Result Class|Result object]]
|}
|}


=== Document Management ===
[[Java API:Document Management]]


=== Event and Task Management ===
:{| border="1" cellpadding="5" cellspacing="0"
{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
!Return
!Return
!Category


|-width="150"
|-
|<tt>[[Java_API:Event_and_Task_Management#addTask|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]]
| <tt>[[Java API:Document Management#generateDocument |generateDocument]](String objectName, String recordId, String templateId, String format)</tt>
| Generates document of using the specified template, in the specified format (PDF or HTML), using the specified object and record to populate template variables. Returns the ID of the generated document in the Result object.
| [[Result Class|Result]]


|-
|-
|<tt>[[Java_API:Event_and_Task_Management#updateTask|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]]
| <tt>[[Java API:Document Management#getDocument |getDocument]](String documentId)</tt>
| Gets a document identified by its ID, in the form of a {{^PlatformFileBean}} contained in the Result.
| [[Result Class|Result]]


|-
|-
|<tt>[[Java_API:Event_and_Task_Management#deleteTask|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:Document Management#Example:_Generate_an_Attachment|Example: Generate an Attachment]]
| colspan="2"| Shows how to generate a document and attach it to the current record.
Β 
|}
Β 
=== Transaction Management ===
[[Java_API:Utility functions|Utility functions]]
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Description
!Return


|-width="150"
|-width="150"
|<tt>[[Java_API:Event_and_Task_Management#addEvent|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]] Β 
|<tt>[[Java_API:Utility functions#addSavePoint |addSavePoint]](String name)</tt>||Adds a Save Point with name|| None
Β 
|-
|<tt>[[Java API:Utility functions#doesSavePointExist |doesSavePointExist]](String name)</tt>||checks whether the named save point exists or not|| Boolean
Β 
|-
|<tt>[[Java_API:Utility functions#getAllSavePoints|getAllSavePoints]]()</tt>||Returns All Save Points|| Set


|-
|-
|<tt>[[Java_API:Event_and_Task_Management#updateEvent|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]]
|<tt>[[Java_API:Utility functions#rollback |rollback]]()</tt>||Roll backs all the inserts and updates|| None


|-
|-
|<tt>[[Java_API:Event_and_Task_Management#deleteEvent|deleteEvent]](String eventId)</tt>||Deletes the event for the eventId|| [[Result Class|Result object]]|| [[Java_API:Event_and_Task_Management|Event and Task Management]]
|<tt>[[Java_API:Utility functions#rollbackToSavePoint|rollbackToSavePoint]](String name)</tt>||Rollback to specific save point with name|| None


|-
|-
|<tt>[[Java_API:Event_and_Task_Management#logActivity |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]]
|<tt>[[Java_API:Utility functions#removeSavePoint|removeSavePoint]](String name)</tt>||removes save point with name from save point list|| None
|}
|}


=== Logger Functions ===
[{{DOCHOST}}/javadocs/com/platform/api/Logger.html Logger] class (static methods):
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Description
|-
| <tt>[[Java API:Utility functions#Logger Functions|info]](String msg, String msgType)</tt>
| Log an information message. This is the default display level in the [[Debug Log]].<br>This level is appropriate for most application debugging.


=== Transaction Management ===
|-
{| border="1" cellpadding="5" cellspacing="0"
| <tt>[[Java API:Utility functions#Logger Functions|warn]](String msg, String msgType)</tt>
| Log a warning.
Β 
|-
| <tt>[[Java API:Utility functions#Logger Functions|error]](String&nbsp;msg,&nbsp;String&nbsp;msgType)</tt>
| Log an error message.
Β 
|-
| <tt>[[Java API:Utility functions#Logger Functions|fatal]](String msg, String msgType)</tt>
| Log a fatal error.
|}
Β 
=== Localization Functions ===
[{{DOCHOST}}/javadocs/com/platform/api/Functions.html Functions] class (static methods):
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
!Return
!Return
!Category


|-width="150"
|-
|<tt>[[Java_API:Utility#addSavePoint |addSavePoint]](String name)</tt>||Adds a Save Point with name|| None|| [[Java_API:Utility|Utility]]
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatCurrency(java.lang.String,%20int) <tt>formatCurrency(String value, int precision)</tt>]
| Format a value specified in [[Database Format]] with no currency character and no grouping indicators (commas), and with a decimal point for fractional amounts.
| Return a String with the value formatted using the company's locale setting for currencies, with the number of decimal places specified for the <tt>precision</tt>. If the conversion fails, return the original string.
Β 
|-
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatDate(java.util.Date) <tt>formatDate(Date d)</tt>]
| Format a date/time value.
| Return a String with the date formatted according the user's settings.
Β 
|-
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatDateTime(java.util.Date) <tt>formatDateTime(Date d)</tt>]
| Format a date/time value.
| Return a String with the date formatted according the user's settings, and time formatted using the user's locale.
Β 
|-
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatNumber(java.lang.String,%20int) <tt>formatNumber(String value, int precision)</tt>]
| Format a value specified in [[Database Format]] with no grouping indicators (commas), with a decimal point for fractional amounts.
| Return a String with the value formatted using the user's locale, with the number of decimal places specified for the <tt>precision</tt>. If the conversion fails, return the original string.
Β 
|-
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatPercent(java.lang.String,%20int) <tt>formatPercent(String value, int precision)</tt>]
| Format a value specified in [[Database Format]] with no percent sign, no grouping indicators (commas), and with a decimal point for fractional amounts.
| Return a String with the value formatted using the user's locale, with the number of decimal places specified for the <tt>precision</tt>. If the conversion fails, return the original string.


|-
|-
|<tt>[[Java_API:Utility#doesSavePointExist |doesSavePointExist]](String name)</tt>||checks whether specified save point with name is exist or not|| Boolean|| [[Java_API:Utility|Utility]]
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#formatTime(java.util.Date) <tt>formatTime(Date d)</tt>]
| Format a time value.
| Return a String with the time formatted using the user's locale.


|-
|-
|<tt>[[Java_API:Utility#getAllSavePoints|getAllSavePoints</tt>]]()</tt>||Returns All Save Points|| Set|| [[Java_API:Utility|Utility]]
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#parseCurrency(java.lang.String) <tt>parseCurrency(String value)</tt>]
| Parse a currency amount in the format specified by the company's locale setting for currencies.
| Return a String in [[Database Format]] format. If parsing fails, return the original string.


|-
|-
|<tt>[[Java_API:Utility#rollback |rollback]]()</tt>||Roll backs all the inserts and updates|| None|| [[Java_API:Utility|Utility]]
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#parseNumber(java.lang.String) <tt>parseNumber(String value)</tt>]
| Parse a numeric amount (with or without a fractional amount) in the format specified by the user's locale.
| Return a String in [[Database Format]] format. If parsing fails, return the original string.


|-
|-
|<tt>[[Java_API:Utility#rollbackToSavePoint|rollbackToSavePoint]](String name)</tt>||Rollback to specific save point with name|| None|| [[Java_API:Utility|Utility]]
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#parsePercent(java.lang.String) <tt>parsePercent(String value)</tt>]
| Parse a percentage in the format specified by the user's locale.
| Return a String in [[Database Format]] format. If parsing fails, return the original string.


|-
|-
|<tt>[[Java_API:Utility#removeSavePoint|removeSavePoint]](String name)</tt>||removes save point with name from save point list|| None|| [[Java_API:Utility|Utility]]
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#validateCurrency(java.lang.String) <tt>validateCurrency(String value)</tt>]
|}
| Verify that the currency amount is in the format specified by the company's locale setting for currencies.
| Return <tt>true</tt> if the data is in the expected format, otherwise <tt>false</tt>.


<!--TEMPLATE
|-
=== Transaction Management ===
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#validateNumber(java.lang.String) <tt>validateNumber(String value)</tt>]
{| border="1" cellpadding="5" cellspacing="0"
| Verify that the numeric amount (with or without a fractional amount) is in the format specified by the user's locale.
!Syntax
| Return <tt>true</tt> if the data is in the expected format, otherwise <tt>false</tt>.
!Description
!Return
!Category


|-width="150"
|-
|<tt>signature</tt>|| descr || [[Result Class|Result object]] || category
| [{{DOCHOST}}/javadocs/com/platform/api/Functions.html#validatePercent(java.lang.String) <tt>validatePercent(String value)</tt>]
| Verify that the percentage is in the format specified by the user's locale.
| Return <tt>true</tt> if the data is in the expected format, otherwise <tt>false</tt>.
|}
|}
-->


=== Utility ===
=== Utility Functions ===
{| border="1" cellpadding="5" cellspacing="0"
Static [[Java_API:Utility functions|Utility functions]] in the [{{DOCHOST}}/javadocs/com/platform/api/Functions.html Functions] class:
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
!Return
!Return
!Category
Β 
|-width="150"
|<tt>[[Java_API:Utility#debug |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]]
|-
|-
|<span style="color:red weight:bold-italics">Deprecated</span><br><tt>[[Java_API:Utility#exec |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]]
|<tt>[[Java_API:Utility functions#getEnv |getEnv]](String key)</tt>||Gets the environment variable value for the key|| The value of the environment variable
Β 
|-
|-
|<tt>[[Java_API:Utility#getEnv |getEnv]](String key)</tt>||Gets the environment variable value for the key|| The value of the environment variable || [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#getParametersInstance |getParametersInstance]]()</tt>||Gets an instance of Parameters class || [[Parameters Class|Parameters]] object
Β 
|-
|-
|<tt>[[Java_API:Utility#getParametersInstance |getParametersInstance]]()</tt>||Gets an instance of Parameters class|| [[Java_API:Utility|Utility]] || [[Parameters Class|Parameters object]]
|<tt>[[Java_API:Utility functions#setTargetPage|setTargetPage]](String url)</tt>||Sets the target page|| None
Β 
|-
|-
|<tt>[[Java_API:Utility#setTargetPage|setTargetPage]](String url)</tt>||Sets the target page|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#showMessage|showMessage]](String message)</tt>||Displays message|| None
Β 
|-
|-
|<tt>[[Java_API:Utility#showMessage|showMessage]](long millisecs)</tt>||Displays message|| None|| [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#sleep|sleep]](long millisecs)</tt>||Sleeps for the designated number of milliseconds.|| None Β 
|-
|-
|<tt>[[Java_API:Utility#sleep|sleep]](String message)</tt>||Sleeps for the designated number of milliseconds.|| None || [[Java_API:Utility|Utility]]
|<tt>[[Java_API:Utility functions#throwError|throwError]](String message)</tt>||Throws error with the message|| None
|}
Β 
Β 
[{{DOCHOST}}/javadocs/com/platform/api/utility/ServiceConfiguration.html ServiceConfiguration] class (static methods):
:{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Return Type
!Description
|-width="150"
Β 
|-
|-
|<tt>[[Java_API:Utility#throwError|throwError]](String message)</tt>||Throws error with the message|| None|| [[Java_API:Utility|Utility]]
| <tt>[{{DOCHOST}}/javadocs/com/platform/api/utility/ServiceConfiguration.html#getServiceName() getServiceName]()</tt> || String || Returns the Service Name (e.g. company name)
|-
| <tt>[{{DOCHOST}}/javadocs/com/platform/api/utility/ServiceConfiguration.html#getServiceDomainURL() getServiceDomainURL]()</tt> || String || Returns the Service URL.
|}
|}


===Metadata Management===
Customization methods.
:''Learn more:'' [[Java_API:Customize]]


===Metadata Management===
:{| border="1" cellpadding="5" cellspacing="0"
{| border="1" cellpadding="5" cellspacing="0"
!Syntax
!Syntax
!Description
!Description
!Return
!Return
!Category


|-width="150"
|-width="150"
Line 200: Line 317:
| Retrieve metadata from a {{type|}}s.
| Retrieve metadata from a {{type|}}s.
| [{{DOCHOST}}/javadocs/com/platform/beans/CustomObjectMetaDataBean.html CustomObjectMetaDataBean] Β 
| [{{DOCHOST}}/javadocs/com/platform/beans/CustomObjectMetaDataBean.html CustomObjectMetaDataBean] Β 
| [[Java_API:Customize|Customize]]


|-
|-
Line 206: Line 322:
| Return a map of all visible {{type|}} object metadata records, indexed by object ID.
| Return a map of all visible {{type|}} object metadata records, indexed by object ID.
| Map: Object ID => [{{DOCHOST}}/javadocs/com/platform/beans/CustomObjectMetaDataBean.html CustomObjectMetaDataBean] Β 
| Map: Object ID => [{{DOCHOST}}/javadocs/com/platform/beans/CustomObjectMetaDataBean.html CustomObjectMetaDataBean] Β 
| [[Java_API:Customize|Customize]]
Β  Β 
Β  Β 
|-
|-
|<tt>[[Java_API:Customize#addObjectMetaData|addObjectMetaData]]([{{DOCHOST}}/javadocs/com/platform/beans/CustomObjectMetaDataBean.html CustomObjectMetaDataBean])</tt> Β 
|<tt>[[Java_API:Customize#addObjectMetaData|addObjectMetaData]]([{{DOCHOST}}/javadocs/com/platform/beans/CustomObjectMetaDataBean.html CustomObjectMetaDataBean])</tt> Β 
| Create a new object.
| Create a new object.
| String:Object ID || [[Java_API:Customize|Customize]]
| String:Object ID


|-
|-
Line 217: Line 332:
| Modify an object definition.
| Modify an object definition.
| String: Object ID Β 
| String: Object ID Β 
| [[Java_API:Customize|Customize]]


|-
|-
Line 223: Line 337:
| Deletes an object
| Deletes an object
| None
| None
| [[Java_API:Customize|Customize]]


|- Β 
|- Β 
| colspan="4"Β  bgcolor="Azure" style="height:7px" |Β  <!-- SPACER ROW -->
| colspan="4"Β  bgcolor="lightblue" style="height:7px" |Β  <!-- SPACER ROW -->


|-
|-
Line 232: Line 345:
| Get an object's [[Record Locator]] information. Β 
| Get an object's [[Record Locator]] information. Β 
| [{{DOCHOST}}/javadocs/com/platform/beans/RecordLocatorBean.html RecordLocatorBean] Β 
| [{{DOCHOST}}/javadocs/com/platform/beans/RecordLocatorBean.html RecordLocatorBean] Β 
| [[Java_API:Customize|Customize]]


|-
|-
Line 238: Line 350:
| Modify an object's Record Locator Settings.
| Modify an object's Record Locator Settings.
| String:Object ID Β 
| String:Object ID Β 
| [[Java_API:Customize|Customize]]
|}
|}

Latest revision as of 09:38, 26 September 2016

These APIs are defined in the Functions class.

Record Handling

Standard Objects

Record Handling APIs

Syntax Description Return
addRecord(String objectName, Params params) Adds a new record of type objectId with values from params Result object
updateRecord(String objectName, String recordId, Params params) Updates record of type objectId with values params. The Record is identified by recordId Result object
changeOwnerShipInfo(String object_id, String record_id, String owner_id) Changes the owner of the designated record None
deleteRecord(String objectName, String recordId) Deletes Record of type objectId where id is recordId Result object
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
getRecordCount(String objectName, String criteria) Returns the number of records in the object int
searchRecords(String objectName, String fields, String criteria [, Parameters params]) Search and retrieve the records for an object. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object
searchRecords(String objectName, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params]) Search and retrieve records for an object. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object
execSQL(String query) Execute a SQL query Result object


Composite Objects

Composite Object APIs

Syntax Description Return
getRecord(String compositeObject, String fields, String recordId) Get a Composite Object record, with specified fields. Result object
getRecordCount(String compositeObject, String criteria) Gets a count of records in a Composite Object that match specified filtering criteria. int
searchRecords(String compositeObject, String fields, String criteria [, Parameters params]) Search and retrieve Composite Object records. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object
searchRecords(String compositeObject, String fields, String criteria, String sortBy, String sortOrder, String sortBy2, String sortOrder2, int offset, int numberOfRows [, Parameters params]) Search and retrieve Composite Object records. fields is a comma-separated list of fields to fetch. criteria is a Filter Expression Result object


Email

Java API:Email

Syntax Description Return
sendEmail(String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList) Send an email Result object
sendEmail(String objectName, String id, String to, String cc, String bcc, String subject, String body, String attachmentTemplateId, String attachmentIdList) Send an email with a bcc list Result object
sendEmail(String objectName, String id, String to, String cc, String subject, String body, String attachmentTemplateId, String attachmentIdList, TenantContext context) Send an email with tenant context Result object
sendEmail(String objectName, String recordid, String to, String cc, String bcc, String subject, String body, String attachmentTemplateId, String attachmentIdList, String fromName, String fromAddress) Send an email with bcc list, from name, and from address Result object
sendEmailUsingTemplate(String objectName, String recordId, String to, String cc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList) Send an email evaluating Template identified by bodyTemplateId as email body Result object
sendEmailUsingTemplate(String objectName, String recordId, String to, String cc, String bcc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList) Send an email using Template with bcc list Result object
sendEmailUsingTemplate(String objectName, String recordId, String to, String cc, String bcc, String subject, String bodyTemplateId, String attachmentTemplateId, String attachmentIdList, String fromName, String fromAddress) Send an email using Template with bcc list, from name, and from address Result object

Document Management

Java API:Document Management

Syntax Description Return
generateDocument(String objectName, String recordId, String templateId, String format) Generates document of using the specified template, in the specified format (PDF or HTML), using the specified object and record to populate template variables. Returns the ID of the generated document in the Result object. Result
getDocument(String documentId) Gets a document identified by its ID, in the form of a PlatformFileBean contained in the Result. Result
Example: Generate an Attachment Shows how to generate a document and attach it to the current record.

Transaction Management

Utility functions

Syntax Description Return
addSavePoint(String name) Adds a Save Point with name None
doesSavePointExist(String name) checks whether the named save point exists or not Boolean
getAllSavePoints() Returns All Save Points Set
rollback() Roll backs all the inserts and updates None
rollbackToSavePoint(String name) Rollback to specific save point with name None
removeSavePoint(String name) removes save point with name from save point list None

Logger Functions

Logger class (static methods):

Syntax Description
info(String msg, String msgType) Log an information message. This is the default display level in the Debug Log.
This level is appropriate for most application debugging.
warn(String msg, String msgType) Log a warning.
error(String msg, String msgType) Log an error message.
fatal(String msg, String msgType) Log a fatal error.

Localization Functions

Functions class (static methods):

Syntax Description Return
formatCurrency(String value, int precision) Format a value specified in Database Format with no currency character and no grouping indicators (commas), and with a decimal point for fractional amounts. Return a String with the value formatted using the company's locale setting for currencies, with the number of decimal places specified for the precision. If the conversion fails, return the original string.
formatDate(Date d) Format a date/time value. Return a String with the date formatted according the user's settings.
formatDateTime(Date d) Format a date/time value. Return a String with the date formatted according the user's settings, and time formatted using the user's locale.
formatNumber(String value, int precision) Format a value specified in Database Format with no grouping indicators (commas), with a decimal point for fractional amounts. Return a String with the value formatted using the user's locale, with the number of decimal places specified for the precision. If the conversion fails, return the original string.
formatPercent(String value, int precision) Format a value specified in Database Format with no percent sign, no grouping indicators (commas), and with a decimal point for fractional amounts. Return a String with the value formatted using the user's locale, with the number of decimal places specified for the precision. If the conversion fails, return the original string.
formatTime(Date d) Format a time value. Return a String with the time formatted using the user's locale.
parseCurrency(String value) Parse a currency amount in the format specified by the company's locale setting for currencies. Return a String in Database Format format. If parsing fails, return the original string.
parseNumber(String value) Parse a numeric amount (with or without a fractional amount) in the format specified by the user's locale. Return a String in Database Format format. If parsing fails, return the original string.
parsePercent(String value) Parse a percentage in the format specified by the user's locale. Return a String in Database Format format. If parsing fails, return the original string.
validateCurrency(String value) Verify that the currency amount is in the format specified by the company's locale setting for currencies. Return true if the data is in the expected format, otherwise false.
validateNumber(String value) Verify that the numeric amount (with or without a fractional amount) is in the format specified by the user's locale. Return true if the data is in the expected format, otherwise false.
validatePercent(String value) Verify that the percentage is in the format specified by the user's locale. Return true if the data is in the expected format, otherwise false.

Utility Functions

Static Utility functions in the Functions class:

Syntax Description Return
getEnv(String key) Gets the environment variable value for the key The value of the environment variable
getParametersInstance() Gets an instance of Parameters class Parameters object
setTargetPage(String url) Sets the target page None
showMessage(String message) Displays message None
sleep(long millisecs) Sleeps for the designated number of milliseconds. None
throwError(String message) Throws error with the message None


ServiceConfiguration class (static methods):

Syntax Return Type Description
getServiceName() String Returns the Service Name (e.g. company name)
getServiceDomainURL() String Returns the Service URL.

Metadata Management

Customization methods.

Learn more: Java_API:Customize
Syntax Description Return
getObjectMetaData(String objectName) Retrieve metadata from a Custom Objects. CustomObjectMetaDataBean
getObjectMetaDataMap() Return a map of all visible Custom Object object metadata records, indexed by object ID. Map: Object ID => CustomObjectMetaDataBean
addObjectMetaData(CustomObjectMetaDataBean) Create a new object. String:Object ID
updateObjectMetaData(CustomObjectMetaDataBean) Modify an object definition. String: Object ID
deleteObjectMetaData(CustomObjectMetaDataBean) Deletes an object None
getRecordLocator(String objectName) Get an object's Record Locator information. RecordLocatorBean
updateRecordLocator(RecordLocatorBean) Modify an object's Record Locator Settings. String:Object ID