Retrieving the child item name, where the name contains special characters.

let itemSearch = search.create({

  type: search.Type.ITEM,

  columns: [‘internalid’, ‘name’, ‘parent’],

  filters: [

    [“type”, “anyof”, “InvtPart”],

    “AND”,

    [“isinactive”, “is”, “F”]

  ]

});

let pagedData = itemSearch.runPaged({ pageSize: 1000 });

pagedData.pageRanges.forEach(pageRange => {

  let page = pagedData.fetch({ index: pageRange.index });

  page.data.forEach(result => {

    items.push({

      id: result.getValue(‘internalid’),

      name: result.getText(‘parent’) ? result.getValue(‘name’).replace(result.getText(‘parent’) + ‘ : ‘, ”) : result.getValue(‘name’),

    });

  });

});

Leave a comment

Your email address will not be published. Required fields are marked *