Tearamezoo
Tearamezoo

Reputation: 1

Setting Values between Transactions

I'm trying to set the Rate of an item on a Purchase Order unto a custom transaction column on the Sales Order called Cost using a Workflow Action Script, but I'm finding issue accomplishing that on a multi-line Purchase Order.

salesOrderRecord.selectLine({
  sublistId: 'item',
  line: j
});

salesOrderRecord.setCurrentSublistValue({
  sublistId: 'item',
  fieldId: 'custcol1',
  value: itemRate
});

// Log

salesOrderRecord.commitLine({
  sublistId: 'item'
});

It functions properly when the Purchase Order has one item but completely stops when the Purchase Order has multiple items/lines. It stops right before the .commitLine method (at the Log) and doesn't continue on with the script.

If I put the .setCurrentSublistValue and .commitLine methods into a try block, it runs properly through the entire Purchase Order and logs that the Sales Order record has been saved (using .save()) but when I check, the Cost hasn't been changed.

Upvotes: 0

Views: 22

Answers (0)

Related Questions