Read
To read Customers, please use the below parameters.
Field Name | Data Type | Description |
|---|---|---|
customParameters | Map<String, ParamValue> | It is used to add filters to your search results |
pageIndex | Integer | request any page from the search results reponse |
searchId | String | request any page with the Search Id from the search results reponse |
customPageSize | String | no. of records to return per search request. |
Custom Parameters in the requestJSON are in the form of Param Name and Value Map which are used for filtering different search results. There is currently only one supported custom parameter.
Supported Custom Parameters
Field Name | Data Type | Description |
|---|---|---|
where | keyValueMap | Pass the supported where filters in Key-Value pair |
Param Value can be passed in the following two ways.
ParamValue
Field Name | Data Type | Description |
|---|---|---|
value | String | single param value |
keyValueMap | Map<String, String> | adding multiple key value params (where filters) |
Supported “where” Filters
Field Name | Data Type | Description |
|---|---|---|
category | String | Pass in the NetSuite Category Internal ID you want to filter on |
dateCreated | Long | This will filter on an exact match (equal). Use the “additionalFilter” option for a range of dates. |
internalId | String | Internal ID of the Customer. Multiple values can be passed in a comma-separated string. |
isInactive | Boolean | Pass false to grab active customers |
lastModifiedDate | Long | This will filter on an exact match (equal). Use the “additionalFilter” option for a range of dates. |
stage | String | stage can be ‘_customer’, ‘_prospect’ or ‘_lead’. Multiple values can be passed in a comma-separated string. Ex: _customer,_prospect |
subsidiary | String | Internal ID of Subsidiary (Primary). Do Not Use this in additionalFilter. Multiple IDs can be passed in a comma-separated string. Ex: 1,2 |
additonalFilter | String | Construct the additional filter with a combination of the above fields using ‘+and+’ separator and pass it as a single string. Make sure to wrap the whole string using EncodingUtil.urlEncode |
String | This filters based on an exact email match | |
Custom Fields: Syntax: cf_dataType_scriptId e.g., cf_date_custentity13 Note: Supported datatypes 1. cf_date 2. cf_string 3. cf_boolean 4. cf_long 5. cf_double | true (cf_boolean), 1606803100 (cf_date) ... | Used to include the custom fields as the filter for the request.e.g., cf_date_custentity13>1606803100+and+cf_string_custentity25=marketing+and+cf_boolean_custentity_checkbox=true. |
Example
Map<String, Object> filters = new Map<String, Object>();
filters.put('subsidiary', '1,2');
filters.put('additionalFilter', EncodingUtil.urlEncode('lastModifiedDate>1628091060+and+lastModifiedDate<1629127860', 'UTF-8'));
// Encode additionalFilter after constructing it with +and+ for multi-filters
// field filters and additionalFilter for where param
Map<String, Object> filterMap = new Map<String, Object>();
filterMap.put('where', new Map<String, Object>{'keyValueMap'=>filters});
Map<String, Object> requestJSONMap = new Map<String, Object>();
requestJSONMap.put('customParameters', filterMap);
String reqJSON = JSON.serialize(requestJSONMap);
Map<String, Object> reqObj = new Map<String, Object>();
reqObj.put('version', '1.0');
reqObj.put('action', 'readCustomer');
reqObj.put('requestJSON', reqJSON);
// Place a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);
System.debug(resp);