Does anyone have a sample of Map/Reduce script? I ...
# general
f
Does anyone have a sample of Map/Reduce script? I want to modify 13000 records of Inventory Adjustment but my search always failed I don't know why.
Copy code
const getInputData = () => {
    const sqlQuery = `
    select id from transaction where type = 'InvAdjst' and trandate >= TO_DATE('23-04-2025', 'DD-MM-YYYY')
    `;
    const queryResult = query.runSuiteQLPaged({ query: sqlQuery, pageSize: 1000 });
    return queryResult;
  };

  const map = (context) => {
    try {
      const result = context.value;
      const internalId = result.id;

      const invAdj = record.load({
        type: record.Type.INVENTORY_ADJUSTMENT,
        id: internalId,
      });

      invAdj.save();
    } catch (e) {
      log.error("Error Resaving Record", e);
    }
  };