Examples

The following section lists a few scenarios and formula expression examples that can be used in the Formula field on the Configurable Formula page.

Scenario 1

Default a user field to the current user adding/updating a record. You can use the following expression in the Formula field.

this.getUser()

Note: This is not supported for Performance Budgeting.

Scenario 2

Default a date field to the current application date. You can use one of the below expressions in the Formula field.

Simply specify the supported key word.

applicationDate

You can also use the Utility method to achieve the same result.

AMSUtil.getApplControlDate(this.getSession())

Note: These are not supported for Performance Budgeting.

Scenario 3

Calculate an amount field value using simple arithmetic operations based on other fields on the business object. You can use an expression with simple field references.

LN_AM - RTG_LN_AM - DISC_LN_AM + PNLTY_INTR_LN_AM - WHLD_LN_AM - INCT_LN_AM - DFLT_INT_FEE_AM - SUPP_INT_FEE_AM - CNTRC_WHLD_AM

Performance Budgeting amount fields need to be typecasted to BigDecimal.

Scenario 4

Calculate the Posting Type field value conditionally on a transaction using the if/else condition with simple field references and Advantage Helper class combination.

if (DOC_CD ==  'IPO' OR R_GEN_DOC_CTRLImpl.getDocSubTyp(this.getSession(), DOC_CD) == 'IRQ')

{

     if ( EVNT_CAT_ID =~ ['IP1', 'IP2', 'IP3', 'IP4', 'IP5', 'IP6', 'IP7', 'IP8', 'IP9', 'IP10'])

    {

       return ‘B’

     } else {

       return ‘A’

    }

}

Scenario 5

Calculate the value of a parent record field as the sum of amounts on corresponding child records using the Utility method.

AMSUtil.getSumOfFields(this,”TOT_DED_AM”,”ABS_DOC_ACTG”,”DED_AM”)

Note: It is recommended that the AMSUtil.getSumOfFields() helper method only be used on transactions as the method is only triggered for the formula on an update and Save action. For transactions, this action occurs on Validate or Submit. For a reference page, the use of the method is not recommended as the method is only triggered when the parent record is updated and a Save action is performed.

Note: This is not supported for Performance Budgeting.

Scenario 6

Calculate the value of a parent record field as the sum of amounts on corresponding child records using the Utility method using a relationship name other than transactions.

AMSUtil.getSumOfFields(this,”SMOKE_CURR10”,” SmokeTack-SmokeTackBals”,”SMOKE_BUCK_AM”)

Note: It is recommended that the AMSUtil.getSumOfFields() helper method only be used by any Parent child relationship as the method is only triggered for the formula on an update and Save action. The use of the method is not recommended as the method is only triggered when the parent record is updated and a Save action is performed.

Note: This is not supported for Performance Budgeting.

Please refer to the “Additional Configurable Validation & Formula Examples” topic for more use cases and example expressions.