---
schema_version: "1"
id: c34eca22b2cb7db6def1918ed4af3f5d5fdd2d35ead392c8bdb022429cb5da8b
title: Sample Implementation to Override the 255-Character Limitation
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/comms-t-sample-implementation-to-override-the-255-character-limitation.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/comms-t-sample-implementation-to-override-the-255-character-limitation.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0dbc72c09e18f9f96a264fa2853975484de2c5ce79be57416001d931925685c8
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Sample Implementation to Override the 255-Character Limitation

The Digital Commerce APIs use the vlocity_cmt**APIParams**c field in the vlocity_cmt**VlocityAPIMetaData**c sObject to configure request response fields, batch size, and other options. This field is also used to identify certain settings of the API while processing batch jobs or while processing API requests at run time.

However, the vlocity_cmt_APIParams\_\_c field is by default limited to 255 characters. In some scenarios, this can be insufficient. For example, consider the following JSON request for a batch job:

```nolang
{"batchSize":20,"scopeAll":true, "productFields" : ["vlocity_cmt__IsActive__c"]}
```

In this example, if you specify multiple fields in productFields, the vlocity_cmt_APIParams\_\_c field might exceed the 255 character limitation. In such cases, to increase the number of characters this field can contain, you can override the default character limitation. To do this, you can create an Apex class along with an interface implementation. For example, create an implementation similar to the following sample.

Sample Implementation Name

DCAPIParamsImplementation

Sample Implementation Method

fetchAPIParamsOverride

Input

| Key     | Type   | Description                                                                                                                         |
| ------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| apiName | String | Defines the name of the API from vlocity_cmt**VlocityAPIMetaData**c.vlocity_cmt**APIName**c                                         |
| params  | String | Defines the parameters of the given API name. This represents vlocity_cmt**VlocityAPIMetaData**c.vlocity_cmt**VlocityAPIMetaData**c |

Output

| Key    | Type   | Description                                        |
| ------ | ------ | -------------------------------------------------- |
| result | String | Updates the API parameters for the given API name. |

Sample Implementation

```nolang
/*
 * We can override this default implementation by defining the following interface
 * INTERFACE : DCAPIParamsInterface
 */
global class DCAPIParamsImplementation implements vlocity_cmt.VlocityOpenInterface {
	public static Map < String, String > overiddenParamMap = new Map < String, String > {};
	static {
		//Field should have their own string here for getoffers api
		overiddenParamMap.put('GetOffers', '{"batchSize":20,"productFields" : ["vlocity_cmt__IsActive__c"]}');
		//Field should have their own string here for getofferdetails api
		overiddenParamMap.put('GetOfferDetails', '{"batchSize":20}');
		//Field should have their own string here for getrelatedofferdetails api
		overiddenParamMap.put('GetRelatedOffers', '{"batchSize":20, "productFields" : ["vlocity_cmt__IsActive__c"]}');
	}
	global DCAPIParamsImplementation() {}

	global static Boolean invokeMethod(String methodName, Map < String, Object > inputs, Map < String, Object > outputs, Map < String, Object > options) {
		if (methodName == 'fetchAPIParamsOverride') {
			return fetchAPIParamsOverride(inputs, outputs, options);
		}
		return false;
	}

	/*
	Inputs :
	    1) key : apiName, type : String
	    2) key : params, type : String
	Outputs :
	    1) key : result, type : String
	*/
	public static Boolean fetchAPIParamsOverride(Map < String, Object > inputs, Map < String, Object > outputs, Map < String, Object > options) {
		String apiName = (String) inputs.get('apiName');
		String overiddenParam = overiddenParamMap.get(apiName) == null ? ((String) inputs.get('params')) : overiddenParamMap.get(apiName);
		outputs.put('result', overiddenParam);
		return true;
	}
}
```
