Hi ,
I am trying to change the status field of PO through the script once a vendor bill is generated. I am creating the bill from Enter Bills not from Bill Purchase Orders and while creating a bill in one of my custom body field i am selecting the PO#. Script is not showing Any Error but it is not changing the status also.
function AfterSubmit_Bill()
{
var VendorBill = nlapiGetNewRecord();
var POnumber = VendorBill.getFieldValue('custbody14');
nlapiLogExecution('DEBUG','PONumber',POnumber);
var PORecord = nlapiLoadRecord('purchaseorder',POnumber);
PORecord.setFieldValue('status','PurchOrd:G');
nlapiLogExecution('DEBUG','Status1',PORecord.getFieldValue('status'));
nlapiSubmitRecord(PORecord);
var PORecord1 = nlapiLoadRecord('purchaseorder',POnumber);
var status = PORecord1.getFieldValue('status');
nlapiLogExecution('DEBUG','Status',status);
}
The same issue i am facing when i am trying to change the Status with the Workflow. :h_a_w: