Is there a better way to check if there are any it...
# suitescript
k
Is there a better way to check if there are any items of a certain parent id from within the checkout other than just setting a 'flag' if there is a match in the lines itemid JSON (Like a getAllLines and check if the value is in there via one function? JSON string array by:
Copy code
item = line.get('item');
thumbnail = item.get('_thumbnail');
console.log('item rec: ' + JSON.stringify(item));
Copy code
{
  "isinstock": true,
  "canonicalurl": "<http://www.ohmyarthritis.com/s.nl/it.A/id.2223/.f>",
  "onlinecustomerprice_detail": {
    "onlinecustomerprice_formatted": "$‎78.99",
    "onlinecustomerprice": 78.99
  },
  "storedisplayimage": "",
  "internalid": 2223,
  "itemid": "P2014-L2",
  "showoutofstockmessage": false,
  "itemtype": "Assembly",
  "minimumquantity": null,
  "ispurchasable": true,
  "itemoptions_detail": {
    "matrixtype": "child",
    "fields": [],
    "parentid": 2222
  }
}
How would I get specifically the
parentid
field from within the
itemoptions_detail
field and set a boolean variable if the
parentid
is present in the cart?