Predefined Methods

This section describes the pre-defined methods available per object. These pre-defined methods can be divided into two categories: methods that are available on all or many objects, called generic methods, and methods that are only available on particular objects, called specific methods.

Generic Methods

This section describes generic methods

addDynamicRecord

Adds a new dynamic record to an object. If the record’s usage is configured as time-valid, then the record supports two additional attributes. They are startDate and endDate, of which the former is mandatory.

Availability

This method is available for all objects that support dynamic records. It is available for functions, but not for conditions.

Table 1. addDynamicRecord
In or Out Type Description

In

String

The usage name

In

Map

The attributes of the record, structured as name and value pairs

Example: Add a Non-Time-Valid Record

The following logic adds a non-time-valid record:

person.addDynamicRecord( "occurrence"
                      , [ code        : "06"
                        , description : "Crime victim"
                        ]
                      )
Example: Add A Time-Valid Record

Add a time-valid record in the same manner, except the map contains two extra attributes:

person.addDynamicRecord( "dynRecord1"
                      , [ code        : "06"
                        , description : "dynRecord 1 value 6"
                        , startDate   : person.dateOfBirth
                        , endDate     : person.endDate
                        ]
                      )

getDynamicRecords

Retrieves the dynamic record or records of a particular object. The output parameter type depends on the record’s definition. Check the detailed description in the section below.

Dynamic records are also available as attributes of an entity. Access them directly from the object with a usage name, instead of explicitly invoking this method. See examples.

Availability

This method is available for all objects that support dynamic records.

Single-value and Non-time-valid

This method will return a single record if the record definition has both single-value and non-time-valid configurations.

Table 2. getDynamicRecords
In or Out Type Description

In

String

A usage name.

Out

Map

The attributes of the record can be a name and a value pair.

Example

assert claim.getDynamicRecords("hobby").name == "Cricket"
assert claim.getDynamicRecords("hobby").level.code == "BEGINNER"

assert claim.hobby.name == "Cricket"
assert claim.hobby.level.code == "BEGINNER"

Multi-value or Time-valid

This method will return a list of records if the record definition has either multi-value or time-valid configurations.

Table 3. Multi-value or Time-valid
In or Out Type Description

In

String

A usage name.

Out

List

A list of records. Each record represents a map of attribute names or value pairs.

Example

assert claim.getDynamicRecords("hobbies").size() == 2
assert claim.getDynamicRecords("hobbies")[0].name == "Cricket"
assert claim.getDynamicRecords("hobbies")[1].name == "Soccer"

assert claim.hobbies.size() == 2
assert claim.hobbies[0].name == "Cricket"
assert claim.hobbies[1].name == "Soccer"

getDynamicRecordsByType

Retrieves the dynamic record or records of a particular object based on the usage name. The output parameter type depends on the record’s definition. Check the detailed description in the following section:

We recommend using this method only when there are at least 50 dynamic records for a specific resource. Unlike getDynamicRecords, which loads all dynamic records into memory at once, this method performs a separate database call for each usage name as needed.

This design minimizes memory usage by triggering a DB query if a different dynamic record is queried on the same object.

Dynamic records or fields that are created or updated during a dynamic logic execution cannot be queried within the same execution.

Following example states high level difference between getDynamicRecords and getDynamicRecordsByType:

  • claim.getDynamicRecords("hobby") → This call triggers a DB query to fetch ALL dynamic records (including non-hobby records) in memory and returns hobby records.

  • claim.getDynamicRecords("accidentState") → This call fetches the accidentState from the in-memory cache, which was populated when hobby records were fetched.

  • claim.getDynamicRecordsByType("hobby") → This call triggers a DB query to fetch only "hobby" records.

  • claim.getDynamicRecordsByType("accidentState") → This call triggers a fresh DB query to fetch only accidentState records.

Availability

This method is available for all objects that support dynamic records.

Single-value and Non-time-valid

This method returns a single record if the record definition includes both single-value and non-time-valid configurations.

Table 4. getDynamicRecordsByType
In or Out Type Description

In

String

A usage name.

Out

DynamicRecord

DynamicRecord with its attributes.

Example

assert claim.getDynamicRecordsByType("hobby").name == "Cricket"
assert claim.getDynamicRecordsByType("hobby").level.code == "BEGINNER"

Multi-value or Time-valid

This method will return a list of records if the record definition has either multi-value or time-valid configurations.

Table 5. Multi-value or Time-valid
In or Out Type Description

In

String

A usage name.

Out

List

An unordered list of records. Each record represents dynamicRecord with its attributes.

Example

assert claim.getDynamicRecordsByType("hobbies").size() == 2

def hobby1 = claim.getDynamicRecordsByType("hobbies")[0]
def hobby2 = claim.getDynamicRecordsByType("hobbies")[1]

deleteDynamicRecord

Deletes an existing dynamic record. If a key attribute is configured on the record’s definition, then the second input argument can delete a dynamic record with a specific key value. If no record with a matching key value is found, nothing is deleted. If multiple records match with the input key value, only one record is deleted. If the input key is NULL, or if no key attribute is configured at all, then all associated dynamic records are deleted.

Availability

This method is available for all objects that support dynamic records. It is available for functions, but not for conditions.

Table 6. deleteDynamicRecord
In or Out Type Description

In

String

The usage name

In

String

The record’s key attribute value, or null.

Examples

Assume an existing person has the following three values for the dynRecord1 record. This dynamic record has two attributes: code and description, where code is configured as the key.

Table 7. Examples
Code Description

01

dynRecord1 value 1

02

dynRecord1 value 2

03

dynRecord1 value 3

The following logic deletes the record with code 02 while leaving the other two records intact.

person.deleteDynamicRecord("dynRecord1", "02")

The following logic deletes all three occurrences in records.

person.deleteDynamicRecord("dynRecord1", null)

getSystemProperty

Returns the value of the property with the passed key as input.

Availability

This method is available in the dynamic logic (Groovy script).

Table 8. getSystemProperty
In or Out Type Description

In

String

Key of the property

Out

String

Value of the property

lookUpFlexCode

Returns the flex code object that matches the input character string.

Availability

This method can be called without a base object.

Table 9. lookUpFlexCode
In / Out Type Description

In

String

Key value of the flexCode

In

String

Definition code of the flexCode

Out

flexCode

The flex code

Example
person.dynamicFieldYesNoIndicator = lookUpFlexCode("YES", "YES_NO")

lookUpPerson

Looks up the Person in the system on the input parameters passed.

Availability

This method is available in the Dynamic Logic (Groovy script).

Table 10. lookUpPerson
In or Out Type Description

In

String

Code of the Person

Out

Person

Person

test

A method that tests a dynamic logic:

  1. Follows the security restrictions of the unit under test (UUT).

  2. The application sets the transaction to rollback only. Any data changes to the database are temporary.

    Availability

    This method is available for a Dynamic Logic (Groovy script).

Table 11. test
In or Out Type Description

In

String

Dynamic logic Code of the UUT

In

Map<String,Object>

Map with the input parameters of the UUT

Out

DynamicLogicResult

Contains the result of the test and the exception class if the test encounters any errors.

Attributes of this object are:

  • result

  • exception

Example
def result = test("SPECIAL_BENEFIT_SELECT", [
    "claim" : claim
])

updateDynamicRecord

Updates the attributes of an existing dynamic record. To find the correct record to update, match on the record’s key attribute value. If none of the existing records have a matching key value, nothing is updated. If multiple records match with the key value, only one of them is updated. If no key is configured at all, executing this method results in adding a record. This applies to both non-time-valid and time-valid dynamic records, so time-validity does not play a role in finding the record to update.

Only the attributes that are present in the input map are updated. Attributes that are not mentioned are left untouched.

Availability

This method is available for all objects that support dynamic records. It is available for functions, but not for conditions.

Table 12. updateDynamicRecord
In / Out Type Description

In

String

A usage name.

In

Map

The attributes of the record, that can have a structure of name or value pairs.

Example, Update a Multi-Value Record

Assume an existing person has the following three values for the dynRecord1 record. This dynamic record has three attributes: code, description, and level, where code is configured as the key.

Table 13. Update a Multi-Value Record
Code Description Level

01

dynRecord1 value 1

3

02

dynRecord1 value 2

7

03

dynRecord1 value 3

12

The following logic updates the level of the record with code 02 from 7 to 6. Its description is retained.

person.updateDynamicRecord( "dynRecord1"
                         , [ code  : "02"
                           , level : 6
                           ]
                         )
Example: Update a Time-Valid Record

Update a record’s start and end date attribute in the same way as other attributes. Assume an existing person has the following two values for the dynRecord1 record. Besides, startDate and endDate, this time-valid dynamic record has two attributes: code, description, where code is configured as the key.

Table 14. Update a Time-Valid Record
Code Description StartDate EndDate

01

dynRecord1 value 1

2015-01-01

2015-12-31

02

dynRecord1 value 2

2016-01-01

The following logic sets the endDate of the second record to the person’s end date. Its other attributes are retained.

person.updateDynamicRecord("dynRecord1"
                         , [ code    : "02"
                           , endDate : person.endDate
                           ]
                         )

Please refer to the Claims Developer Guide for the list of other available generic methods.

Search Methods

Please refer to the Claims Developer Guide for the list of available search methods.

Object Methods

In this section, the methods are described that are only available on specific objects. For each method, the following information is given:

  • The purpose of the method.

  • On which object(s) the method can be called.

  • Description of the parameters.

  • An example of the usage.

addBasket

Adds a basket to an authorization.

Availability

This method is available for Authorization. Its purpose is to have the possibility to add a basket through function dynamic logic:

Parameters:

Table 15. addBasket
In or Out Type Description

In

String

Basket code. Mandatory

In

Date

Authorization basket start date. Mandatory

In

Date

Authorization basket end date. Optional

Example
authorization.addBasket("NAPPI_BASKET", authorization.startDate)

addMessage

Adds a message to an authorization.

Availability

This method is available for Authorization. Its purpose is to have the possibility to add a message through function dynamic logic:

Parameters

Table 16. addMessage
In / Out Type Description

In

String

Message code. Mandatory

In

Object[]

Message arguments. Optional

Example
def enrollmentResponseMessage = enrollmentResonseMessageList[0]authorization.addMessage(enrollmentResponseMessage.message.code, enrollmentResponseMessage.value0, enrollmentResponseMessage.value1)

getAttachedData

This method returns the data attached to the authorization in context; this is necessary because no relationship between attached authorization data and the authorization exists.

Availability

This method is available for object authorization.

Parameters

Table 17. getAttachedData
In or Out Type Description

Out

AttachedAuthorizationData

The data attached to the authorization

setDynamicField

The method sets the dynamic field to an object.

Availability

This method is available for all objects that support dynamic fields.

Parameters

Table 18. setDynamicField
In or Out Type Description

In

String

A usage name

In

Object

Structure of the dynamic field

Example

The following logic sets a time-valid field usage:

policy.setDynamicField("policyCoverage", new DynamicFieldPeriod(polCovRef.policyCoverage,polCovRef.startDate,polCovRef.endDate))
The recommended way to use the dynamic field is mentioned in the Writing section.