Hi Friends,
I have a problem when i am transforming the SO to a Cash Sales. I am using following code to do that in my Scheduled Script.
var salesOrderrecord = nlapiLoadRecord('salesorder',id);
var fulfillRecord = nlapiTransformRecord('salesorder', id, 'itemfulfillment');
nlapiSubmitRecord( fulfillRecord );
var billType = searchresults.getValue('terms') != null ? 'invoice' : 'cashsale';
var billRecord = nlapiTransformRecord('salesorder', id, billType);
nlapiSubmitRecord( billRecord );
nlapiLogExecution("DEBUG", "Sales order transformed to cashsale","SalesOrderID = "+id);
I got the above style from one of the samples posted on the help site.
Following is the error that i get in the log
[I]"Code: INVALID_INITIALIZE_REF Details: You have an invalid sales order XXXX or the order is already closed."
I am not sure what can be the possible reason for this error getting generated?
Can someone help me identifying what i need to get this correctly converted to a Cash Sales record?
Thanks!