//Info: JOIN-185
Requirement: Create a MapReduce script to delete the Sales order Records.
In these cases, Normally we set a saved search criteria to met the requirement & retrieve the data’s from the search script and then proceed with the Deletion mapping.
In case of sales order, we have multiple set of records linked to a single order.
Here, Deletion is not possible by referring the individual internalid of each record which is commonly used unique field.
Solution:
Group the internalid’s and call the value using Array method, since it consist of two different objects linked.
Sample Code:
log.debug('salesorder id',dataObj.values["GROUP(internalid)"] );
record.delete({
id: dataObj.values["GROUP(internalid)"].value,
type: 'salesorder'
});