Link

Create Customer Subsidiary Relationship

Sample Requests and Responses

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

Request

Map<String, Object> nsCustomerSub1 = new Map<String, Object>();
    nsCustomerSub1.put('entity', new Map<String, Object>{'internalId'=>'362'});
    nsCustomerSub1.put('subsidiary', new Map<String, Object>{'internalId'=>'9'});

Map<String, Object> nsCustomerSub2 = new Map<String, Object>();
    nsCustomerSub2.put('entity', new Map<String, Object>{'internalId'=>'392'});
    nsCustomerSub2.put('subsidiary', new Map<String, Object>{'internalId'=>'9'});

//  Initializing the RequestJSON Data to be passed.
Map<String, Object> requestJSONMap = new Map<String, Object>();
    requestJSONMap.put('customerSubsidiaryRelationships', new List<Object>{nsCustomerSub1, nsCustomerSub2});
    String reqJSON = JSON.serialize(requestJSONMap);

Map<String, Object> reqObj = new Map<String, Object>();
    reqObj.put('version', '1.0');
    reqObj.put('action', 'createCustomerSubsidiaryRelationship');
    reqObj.put('requestJSON', reqJSON);

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

Response

{
  action=createCustomerSubsidiaryRelationship,
  timestamp=1626095474361,
  validRequest=true,
  version=1.0,
  responseJSON={
  "errors": [],
  "status": "200",
  "customerSubsidiaryRelationships": [
    {
      "subsidiary": {
        "type": null,
        "name": "Parent Company : Australia",
        "internalId": "9",
        "externalId": null
      },
      "primaryCurrency": {
        "type": null,
        "name": "INR",
        "internalId": "1",
        "externalId": null
      },
      "isPrimarySub": false,
      "internalId": "2006",
      "entity": {
        "type": null,
        "name": "21 Atherton Grocery",
        "internalId": "362",
        "externalId": null
      }
    },
    {
      "subsidiary": {
        "type": null,
        "name": "Parent Company : Australia",
        "internalId": "9",
        "externalId": null
      },
      "primaryCurrency": {
        "type": null,
        "name": "INR",
        "internalId": "1",
        "externalId": null
      },
      "isPrimarySub": false,
      "internalId": "2007",
      "entity": {
        "type": null,
        "name": "14:1 Info Systems",
        "internalId": "392",
        "externalId": null
      }
    }
  ]
 } 
}