addItemsIncremental(jsonDataList, loadParams, itemComparisonParams)

Add items to a list without removing the existing items and without adding duplicates. The method also performs postLoadItemUpdates if the method exists for the given LO.

Required Editions

Available in: Lightning Experience in Professional, Unlimited, and Enterprise Editions that have Consumer Goods Cloud enabled.

Parameters

  • jsonDataList: JSON. List of JSON objects that represent the list items to add.
  • loadParams: JSON. The load parameters that are used to load the list object. Is passed to postLoadItemUpdates if the method exists for the given LO.
  • itemComparisonParams: JSON. Array of {"fieldName": <fieldname>, "op":<operator> } objects that is used to compare items in the list.
// Call merge engine
Facade.getMergedListAsync(mergeEngineParams)
then(function (items) {
 // Define criteria for containsItem() function
var itemComparisonParams = []
itemComparisonParams.push({ "fieldName": "prdMainPKey" });
itemComparisonParams.push({ "fieldName": "sdoItemMetaPKey" });
itemComparisonParams.push({ "fieldName": "quantityLogisticUnit" });
// Add items to list incrementally
me.addItemsIncremental(items, jsonParams, itemComparisonParams);