Link

Read Customer

Read Customer requestJSON has the following parameters.

Field NameData TypeDescription
customParametersMap<String,ParamValue>It is used to add filters to your search results
pageIndexIntegerrequest any page from the search results reponse
searchIdStringrequest any page with the Search Id from the search results reponse
customPageSizeStringno. 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

Param NameParam ValueDescription
wherekeyValueMapPass the supported where filters in Key-Value pair

Param Value can be passed in the following two ways.

ParamValue

Field NameData TypeDescription
valueStringsingle param value
keyValueMapMap<String,String>adding multiple key value params (where filters)

Supported “where” Filters

Field NameData TypeDescription
dateCreatedLongThis will filter on an exact match (equal). Use the “additionalFilter” option for a range of dates.
internalIdStringInternal ID of the Customer. Multiple values can be passed in a comma separated string.
lastModifiedDateLongThis will filter on an exact match (equal). Use the “additionalFilter” option for a range of dates.
stageStringstage can be ‘_customer’, ‘_prospect’ or ‘_lead’. Multiple values can be passed in a comma separated string Ex: _customer,_prospect
subsidiaryStringInternal ID of Subsidiary (Primary). Do Not Use this in additonalFilter. Multiple IDs can be passed in a comma separated string Ex: 1,2
additonalFilterStringconstruct the additional filter with a combination of above fields using ‘+and+’ separator and pass it as a single string. Make sure to wrap the whole string using EncodingUtil.urlEncode

Sample Requests and Responses

The following is an example request which can be used while using ‘readCustomer’ action.

Request

Map<String, Object> filterMap = new Map<String, Object>();
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

filterMap.put('where',new Map<String,Object>{'keyValueMap'=>filters}); // field filters and additionalFilter for where param
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);

//  Placing a request to Breadwinner Global API
Map<String, Object> resp = breadwinner_ns.BreadwinnerNetSuiteAPI.call(reqObj);

Response

{
  action=readCustomer,
  timestamp=1631109943108,
  validRequest=true,
  version=1.0,
  responseJSON={
    "currentPageRecords": 2,
    "totalRecords": 2,
    "totalPages": 1,
    "searchId": "WEBSERVICES_5333445_SB1_090820219776321931335921658_242f8c69",
    "pageIndex": 1,
    "errors": [],
    "customParamters": {
        "where": {
          "value": null,
          "keyValueMap": {
            "subsidiary": "1",
            "additionalFilter": "lastModifiedDate%3E1628091060%2Band%2BlastModifiedDate%3C1629127860"
          }
        }
    },
    "status": "200",
    "customers": [
      {
        "vatRegNumber": null,
        "url": "https://www.grandhotel.com",
        "title": null,
        "territory": {
          "type": null,
          "name": "Default Round-Robin",
          "internalId": "-5",
          "externalId": null
        },
        "terms": {
          "type": null,
          "name": "1% 10 Net 30",
          "internalId": "5",
          "externalId": null
        },
        "taxItem": null,
        "subsidiary": {
          "type": null,
          "name": "Parent Company",
          "internalId": "1",
          "externalId": null
        },
        "startDate": 1606847400,
        "stage": "_customer",
        "salutation": null,
        "salesRep": null,
        "salesforceID": null,
        "resaleNumber": null,
        "reminderDays": null,
        "receivablesAccount": {
          "type": null,
          "name": "Accounts Receivable",
          "internalId": "122",
          "externalId": null
        },
        "priceLevel": {
          "type": null,
          "name": "Base Price",
          "internalId": "1",
          "externalId": null
        },
        "phone": null,
        "parent": null,
        "nullFieldList": null,
        "middleName": null,
        "lastName": null,
        "lastModifiedDate": 1606907165,
        "itemPricingList": null,
        "isPerson": false,
        "isInactive": false,
        "internalId": "32342",
        "firstName": null,
        "fax": null,
        "externalId": null,
        "entityStatus": {
          "type": null,
          "name": "CUSTOMER-Closed Won",
          "internalId": "13",
          "externalId": null
        },
        "entityId": "CUST533AT Grand Hotels & Resorts Ltd",
        "endDate": null,
        "email": null,
        "dateCreated": 1606907165,
        "customForm": {
          "type": null,
          "name": "Standard Customer Form",
          "internalId": "-2",
          "externalId": null
        },
        "customFieldList": {
          "customField": [
            {
              "valueLookup": null,
              "value": "76.89",
              "scriptId": "custentity_decimal",
              "internalId": "435",
              "fieldType": null
            },
            {
              "valueLookup": {
                "type": null,
                "name": "Acquired",
                "internalId": "2",
                "externalId": null
              },
              "value": null,
              "scriptId": "custentityrating",
              "internalId": "42",
              "fieldType": null
            }
          ]
        },
        "currencyRecord": {
          "type": null,
          "name": "INR",
          "internalId": "1",
          "externalId": null
        },
        "currencyList": {
          "currencyRecord": [
            {
              "currencyRecord": {
                "type": null,
                "name": "INR",
                "internalId": "1",
                "externalId": null
              }
            }
          ]
        },
        "creditLimit": null,
        "creditHoldOverride": "_auto",
        "companyName": "Grand Hotels & Resorts Ltd",
        "category": null,
        "addressbookList": {
          "replaceAll": null,
          "addressbook": [
            {
              "label": "2334 N. Michigan Avenue, Suite 1500",
              "isResidential": true,
              "internalId": "29188",
              "defaultShipping": true,
              "defaultBilling": true,
              "addressbookAddress": {
                "zip": "60601",
                "state": "IL",
                "internalId": null,
                "country": "_unitedStates",
                "city": "Chicago",
                "attention": null,
                "addrPhone": null,
                "addressee": "Grand Hotels & Resorts Ltd",
                "addr3": null,
                "addr2": null,
                "addr1": "2334 N. Michigan Avenue, Suite 1500"
              }
            }
          ]
        },
        "accountNumber": null
      },
      {
        "vatRegNumber": null,
        "url": "http://www.burlington.com",
        "title": null,
        "territory": null,
        "terms": null,
        "taxItem": null,
        "subsidiary": {
          "type": null,
          "name": "Parent Company",
          "internalId": "1",
          "externalId": null
        },
        "startDate": null,
        "stage": "_customer",
        "salutation": null,
        "salesRep": {
          "type": null,
          "name": "James M",
          "internalId": "4",
          "externalId": null
        },
        "salesforceID": null,
        "resaleNumber": null,
        "reminderDays": null,
        "receivablesAccount": {
          "type": null,
          "name": "Use System Preference",
          "internalId": "-10",
          "externalId": null
        },
        "priceLevel": null,
        "phone": "9888888888",
        "parent": null,
        "nullFieldList": null,
        "mobilePhone": null,
        "middleName": null,
        "lastName": null,
        "lastModifiedDate": 1628504795,
        "itemPricingList": null,
        "isPerson": false,
        "isInactive": false,
        "internalId": "61087",
        "firstName": null,
        "fax": null,
        "externalId": null,
        "entityStatus": {
          "type": null,
          "name": "CUSTOMER-Closed Won",
          "internalId": "13",
          "externalId": null
        },
        "entityId": "CUST846AT GR Group",
        "endDate": null,
        "email": null,
        "dateCreated": 1628504793,
        "customForm": null,
        "customFieldList": {
          "customField": [
            {
              "valueLookup": null,
              "value": "1625198400",
              "scriptId": "custentity_date",
              "internalId": "433",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": "34.6",
              "scriptId": "custentity_decimal",
              "internalId": "435",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": "test text",
              "scriptId": "custentity_freeformtext",
              "internalId": "437",
              "fieldType": null
            },
            {
              "valueLookup": null,
              "value": "false",
              "scriptId": "custentity_mm_stopsendingsms",
              "internalId": "424",
              "fieldType": null
            },
            {
              "valueLookup": {
                "type": null,
                "name": "Parent Company : Atlanta",
                "internalId": "20",
                "externalId": null
              },
              "value": null,
              "scriptId": "custentity_standardrecord",
              "internalId": "467",
              "fieldType": null
            }
          ]
        },
        "currencyRecord": {
          "type": null,
          "name": "US Dollars",
          "internalId": "2",
          "externalId": null
        },
        "currencyList": {
          "vendorCurrency": null,
          "currencyRecord": [
            {
              "currencyRecord": {
                "type": null,
                "name": "US Dollars",
                "internalId": "2",
                "externalId": null
              }
            }
          ]
        },
        "creditLimit": null,
        "creditHoldOverride": "_auto",
        "companyName": "GR Group",
        "category": null,
        "addressbookList": {
          "replaceAll": null,
          "addressbook": [
            {
              "label": null,
              "isResidential": false,
              "internalId": "64108",
              "defaultShipping": false,
              "defaultBilling": true,
              "addressbookAddress": {
                "zip": null,
                "state": null,
                "overrideValue": false,
                "internalId": null,
                "country": "_india",
                "city": null,
                "attention": null,
                "addrText": "GR Group<br>India",
                "addrPhone": null,
                "addressee": "GR Group",
                "addr3": null,
                "addr2": null,
                "addr1": null
              }
            }
          ]
        },
        "accountNumber": null
      }
    ]
  }
}