Hello,
I am writing a script that will automate the creation of special order or drop ship purchase orders based on whether criteria is met. I was able to utilize a helper script from SuiteAnswers, article ID 71358 "Create Dropship Purchase Order via Scripting". The code snippet is below:
var po_params = {
'recordmode': 'dynamic',
'soid': '<Sales Order Internal ID>',
'shipgroup': ''<Ship Group Internal ID>',
'poentity': '<Internal ID of the Preferred Vendor for the Item>',
'dropship': 'T',
'custid': '<Customer Internal ID>',
'entity': '<Internal ID of the Purchase Order Vendor>'
};
var po = nlapiCreateRecord('purchaseorder', po_params);
var poid = nlapiSubmitRecord(po, true, false);
The issue seems to be that sometimes you need to provide poentity, sometimes poentity and entity, or sometimes you can't provide either. When looking at the actual sales order record and looking at the "Spec. Ord. " link, I can see these parameters populated in the link, but cannot figure out how it determines which parameters need to be populated. I had initially thought it would need the poentity and/or entity if the Preferred Vendor is set on the item record, but that also is not consistent between orders. I.e two different orders have items that have a preferred vendor set. The "Spec. Ord." link has the "poentity" and "entity" parameters on one order, but doesn't on the other.
Has anyone else had this same issue and managed to figure it out?
Thanks,
Anthony