RE: How do I close multiple Purchase Orders out at once? (I have like 200 I need to clean up)
How do I close multiple Purchase Orders out at once? (I have like 200 I need to clean up)
Write a (scheduled, workflow action or map-reduce) script that sets the ‘isclosed’ field to ‘T’.
Snippet:
// Load the PO. var rec = record.load({ type: record.Type.PURCHASE_ORDER, id: recordId }); // Close each line. var sublist = 'item'; // You'll also need to loop over expense lines. for (var i = 0; i < rec.getLineCount(sublist); i++) { rec.setSublistValue({ sublistId: sublist, fieldId: 'isclosed', line: i, value: true }); } // Save the updated record. rec.save();
Once all lines are closed, the PO will automatically be marked as closed.