How to delete or filter particula items from the record sublist?
I need to import Sales Order with its items but I don`t need all of the items, just some of them
What I use but it doesn`t work:
function preMap (options) {
return options.data.map((d) => {
for(let k = 0; k < d.item.length; k++){
if(d.item[k].custcol_talis_item_product_line != 'Instrument'){
d.item.splice(k, 1);
// k--;
}
}
return {
data: d
}
})
}
0
Comments
This function should suffice. Just replace the custcol field name, then inside the filter function supply the criteria you wish to use for those lines you want to keep. In this case, I wanted to only keep those lines where custcol_fj_sf_id was blank.
function preMap (options) {
var itemsarray = options.data[0].item;
options.data[0].item = itemsarray.filter(function(itemlines){
return !itemlines.custcol_fj_sf_id;
});
return options;
}
Please sign in to leave a comment.