getPriorParams
From LongJump Support Wiki
When Writing Java Code for a Data Policy, use the getPriorParams() method in the Parameters object to access field values.
- Considerations
-
- getPriorParams() returns an instance of the Parameters Class.
- When a record is updated, it contains the earlier set of values saved in the DB for this record.
- If a record is updated with no changes to the fields, the prior parameters contains the unchanged values of the fields.
- When a record is added, the prior parameters of the record are empty.
- When retrieving values, you'll typically use the get-methods from the Parameters class that let you specify a default value, in case the record value is null.
- Retrieving prior values of account name and status
Parameters preParams = requestParams.getPriorParams(); String accountName = preParams .get("name"); Functions.debug("Previous Account Name: " + accountName); Functions.debug("Earlier value for acccount status: " + preParams.get("account_status"));
- Retrieving a field of type Float
- To retrieve a field of type 'Currency' without having to type-cast the return value, use getFloat().
Use getFloat(String, float) to handle null values. Float prior_transaction_amount = preParams.getFloat("amount", 0.0f); Functions.debug("Prior transaction amount: " + prior_transaction_amount);
- Retrieving an integer value
- To retrieve a field of type 'Number' without having to type-cast the return value, use getInteger().
Use getInteger(String, int) to handle null values. int account_num = preParams.getInteger("number", 0); Functions.debug("Prior account number value: " + account_num);
- Retrieving a String value
String account_name = preParams.get("field_name"); Functions.debug("Prior Account name: " + account_name);
- Retrieving a text area
String description = preParams.get("description"); Functions.debug("Prior Account description: " + description);
- Retrieving a field of type Date
- To retrieve a field of type 'Date' without having to type-cast the return value, use getDate().
Date date = preParams.getDate("date_created"); Functions.debug("Prior Account created date: " + date);
- Retrieving a field of type Boolean
- To retrieve a field of type 'CheckBox' without having to type-cast the return value, use getBoolean().
boolean contract_bool = preParams.getBoolean("contract"); Functions.debug("Prior Account contract: " + contract_bool );