{"id":"894ceeb5-71f5-4635-bcd3-c260acbf5f46","task":"Run a NetSuite SuiteScript 2.x map-reduce script to bulk-update work-order completion status across thousands of records while respecting per-phase governance limits","domain":"docs.oracle.com/en/cloud/saas/netsuite","steps":["Define getInputData to return a SuiteQL query selecting open workOrder records; the phase receives 10,000 governance units and up to 60 minutes.","In the map phase, emit each work-order internalId as the key; keep map logic minimal — map invocations each receive 1,000 units, so load no extra records here.","In the reduce phase (5,000 units per invocation), load the work-order record with N/record.load, set status fields, and call record.save; wrap in try/catch and log failures to context.write.","In the summarize phase, iterate context.errors and send an email summary via N/email.send; check summary.seconds and summary.usage for audit logging.","Deploy the script via Setup > SuiteCloud > Script Deployments; set the queue and concurrency (max 5 reduce queues) appropriately for your account.","Test with a small data slice by adding a SuiteQL WHERE clause filter before promoting to full run."],"gotchas":["Exceeding getInputData governance (10,000 units) causes that phase to abort and jump directly to summarize, silently skipping all map and reduce processing — always test input query cost first.","Each reduce invocation handles all values for one key in sequence; if a single work order has many sub-keys the reduce call can still exhaust its 5,000-unit budget — keep keys granular.","Map and reduce phases reset governance counters per invocation, but getInputData and summarize do not reset — complex summarize logic can itself terminate the script."],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:12.974Z"},"url":"https://mcp.waymark.network/r/894ceeb5-71f5-4635-bcd3-c260acbf5f46"}