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)

Rookie Asked on August 17, 2020 in Jobs.
Add Comment
1 Answer(s)

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.

Rookie Answered on August 17, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor