You are here:
DefaultOdinNotifFldFormatImplementation:getFormattedFieldValue Method
Gets the formatted value of the field in the required data type.
Signature
public Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options)Usage
Formats the field values passed in the notification map from Vlocity Order Management with updateMethod specified as directfieldupdate.
Parameters
Parameter | Data Type | Description |
|---|---|---|
input |
Map |
Map <String, Object> of the required input parameters for the method. |
output |
Map |
Map <String, Object> to store the result value. |
options |
Map |
Map <String, Object> of the optional input parameters for the method. |
methodName |
String |
The name of the method that you want to use. In this case: getFormattedFieldValue |
Input Data
{
"fieldValue": "2020-08-29T02:42:19.861Z",
"fieldDataType": "DATETIME",
"fieldName": "ppathak_v109_2__duedate__c",
"record": {
"attributes": {
"type": "Order",
"url": "/services/data/v49.0/sobjects/Order/8013t0000016lLNAAY"
},
"Id": "8013t0000016lLNAAY",
"AccountId": "0013t00001Zu989AAB",
"Status": "Draft",
"ppathak_v109_2__OrderStatus__c": "Ready To Submit",
"ppathak_v109_2__FulfilmentStatus__c": "In Progress",
"ppathak_v109_2__IsChangesAllowed__c": true,
"ppathak_v109_2__IsChangesAccepted__c": false,
"ppathak_v109_2__FirstVersionOrderIdentifier__c": "8013t0000016lLNAAY",
"ppathak_v109_2__IsActiveOrderVersion__c": true,
"OrderItems": {
"totalSize": 2,
"done": true,
"records": [
.
.
.
<Sample records data here>
.
.
.
]
}
}
}Output Data
This method returns the formatted field value. For example:
{"formattedFieldValue":"2020-08-29T02:42:19.000Z"}Example
Example of implementing this method.
global class SampleOdinNotifFldFormatImplementation implements vlocity_cmt.VlocityOpenInterface {
global Boolean invokeMethod(String methodName, Map < String, Object > input, Map < String, Object > output,
Map < String, Object > options) {
if (methodName.equals('getFormattedFieldValue')) {
getFormattedFieldValue(input, output, options);
return true;
}
return false;
}
private void getFormattedFieldValue(Map < String, Object > input, Map < String, Object > output,
Map < String, Object > options) {
SObject record = (SObject) input.get('record');
String fieldName = (String) input.get('fieldName');
String fieldDataType = (String) input.get('fieldDataType');
Object fieldValue = input.get('fieldValue');
//write your own logic to format the field value
output.put('formattedFieldValue', fieldValue);
}
}