Application Composer Series: Where and When to use Groovy

This brief post is really intended as more of a reference than an article. The table below highlights two things, firstly where you can add you own custom logic via groovy code (end column), and secondly (middle column) when you might use each particular feature. Obviously this applies only where Application Composer exists, namely Fusion CRM and Oracle Sales Cloud, and is based on current (release 8) functionality.

Most Common Use Case
Field Triggers
React to run-time data changes. Only fired when the field is changed and upon submit.
Object Triggers
To extend the standard processing logic for an object, based on record creation, updates and deletes. There is a split between these firing events, with some related to UI/ADF actions and others originating in the database.

UI Trigger Points:

  • After Create - fires when a new object record is created. Commonly used to set default values for fields.
  • Before Modify - Fires when the end-user tries to modify a field value. Could be used for generic warnings or extra security logic.
  • Before Invalidate - Fires on the parent object when one of its child object records is created, updated, or deleted. For building in relationship logic.
  • Before Remove - Fires when an attempt is made to delete an object record. Can be used to create conditions that prevent deletes.

Database Trigger Points:

  • Before Insert in Database - Fires before a new object is inserted into the database. Can be used to ensure a dependent record exists or check for duplicates.
  • After Insert in Database - Fires after a new object is inserted into the database. Could be used to create a complementary record.
  • Before Update in Database -Fires before an existing object is modified in the database. Could be used to check dependent record values.
  • After Update in Database - Fires after an existing object is modified in the database. Could be used to update a complementary record.
  • Before Delete in Database - Fires before an existing object is deleted from the database. Could be used to check dependent record values.
  • After Delete in Database - Fires after an existing object is deleted from the database. Could be used to remove dependent records.
  • After Commit in Database - Fires after the change pending for the current object (insert, update, delete) is made permanent in the current transaction. Could be used when committed data that has passed all validation is required.
  • After Changes Posted to Database - Fires after all changes have been posted to the database, but before they are permanently committed. Could be used to make additional changes that will be saved as part of the current transaction.
Field Validation
Displays a user entered error message based groovy logic validating the field value. The message is shown only when the validation logic returns false, and the logic is triggered only when tabbing out of the field on the user interface.
Object Validation
Commonly used where validation is needed across multiple related fields on the object. Triggered on the submit UI action.
Object Workflows
All Object Workflows are fired upon either record creation or update, along with the option of adding a custom groovy firing condition. Y

Field Updates - change another field when a specified one changes. Intended as an easy way to set different run-time values (e.g. pick values for LOV's) plus the value field permits groovy logic entry. Y

E-Mail Notification - sends an email notification to specified users/roles. Templates support using run-time value tokens and rich text. N

Task Creation - for adding standard tasks for use in the worklist functionality. N

Outbound Message - will create and send an XML payload of the related object SDO to a specified endpoint. N

Business Process Flow - intended for approval using the seeded process, however can also trigger custom BPMN flows. N
Global Functions
Utility functions that can be called from any groovy code in Application Composer (across applications).
Object Functions Utility functions that are local to the parent object. Usually triggered from within 'Buttons and Actions' definitions in Application Composer, although can be called from other code for that object (e.g. from a trigger). Y
Add Custom Fields
When adding custom fields there are a few places you can include groovy logic.

Default Value - to add logic within setting the default value when new records are entered. Y

Conditionally Updateable - to add logic to set the field to read-only or not.

Conditionally Required - to add logic to set the field to required or not.

Formula Field - Used to provide a new aggregate field that is entirely based on groovy logic and other field values.
Simplified UI Layouts - Advanced Expressions
Used for creating dynamic layouts for simplified UI pages where fields and regions show/hide based on run-time context values and logic. Also includes support for the depends-on feature as a trigger.

Related References

  • This Blog: Application Composer Series
  • Extending Sales Guide: Using Groovy Scripts
  • Groovy Scripting Reference Guide


Object workflow:

outbound message in object does it work...end point url ?

Posted by guest on August 04, 2016 at 03:02 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Follow us on twitter Fusion Applications Extensibility, Customizations and Integration forum Fusion Applications Dev Relations YouTube Channel
This blog offers news, tips and information for developers building extensions, customizations and integrations for Oracle Fusion Applications.


« August 2016