Hi All, I am transforming the purchase order to ve...
# suitescript
a
Hi All, I am transforming the purchase order to vendor bill in script - Bill is getting created but link is not getting established
b
are you saying that the bill is not showing up in the related records of the purchase order
or that the purchase order is not showing up in the related records of the bill?
a
@battk purchase order is not showing up in bill
b
what does your code look like?
a
I have written in 1.0
Copy code
var vendorBillRec = nlapiTransformRecord("purchaseorder", purchaseOrderId, "vendorbill");
				vendorBillRec.setFieldValue("tranid",itemReciptRec.getFieldValue("custbody_tile_vendor_inv_no"))	
				var lineItemCountPO = vendorBillRec.getLineItemCount("item");
				for (var i = 1; i <= lineItemCountPO; i++) {
					vendorBillRec.removeLineItem("item", 1);
				}
				nlapiLogExecution("DEBUG","remove lines");
				for(var j = 1; j<= lineItemCountIR ; j++){
					vendorBillRec.setLineItemValue("item", "item", j, itemReciptRec.getLineItemValue("item", "item", j));
					vendorBillRec.setLineItemValue("item", "quantity", j, itemReciptRec.getLineItemValue("item", "quantity", j));
					vendorBillRec.setLineItemValue("item", "rate", j, 1);
					vendorBillRec.setLineItemValue("item", "description", j, itemReciptRec.getLineItemValue("item", "description", j));
				}
				vendorBillRec.setLineItemValue("purchaseorders", "id", 1, purchaseOrderId);
				var id = nlapiSubmitRecord(vendorBillRec,true,true);
b
you are destroying the link by removing the line items
a
okay so link is in line