I am creating an uploader to upload invoices on the vendor collaboration screen. The invoices get created but I am not able to see the line in the invoice. The amount appears on the header but no line is displayed on the form. Below are the attached SS and code that I am using. Please help me find the missing link.
Header SS: Amount appearing.
Lines SS: No line is appearing.
Code:
if (UploadVendorInvoices::validateInvoiceId(invoiceNumber, vendorId)) {select vendInvoiceInfoTable where vendInvoiceInfoTable.Num == invoiceNumber;if (!vendInvoiceInfoTable) {VendTable vendTable = VendTable::find(vendorId);vendInvoiceInfoTable.clear();vendInvoiceInfoTable.initValue();vendInvoiceInfoTable.Ordering = DocumentStatus::Invoice;vendInvoiceInfoTable.DocumentOrigin = DocumentOrigin::VendorPortal;vendInvoiceInfoTable.ParmId = formletterParmData::getNewParmId();vendInvoiceInfoTable.TableRefId = formletterParmData::getNewTableRefId();vendInvoiceInfoTable.DocumentDate = invoiceDate;//vendInvoiceInfoTable.FixedDueDate = invoiceDate;vendInvoiceInfoTable.Num = invoiceNumber;vendInvoiceInfoTable.InvoiceAccount = vendorId;vendInvoiceInfoTable.OrderAccount = vendorId;vendInvoiceInfoTable.Payment = vendTable.PaymTermId;vendInvoiceInfoTable.modifiedField(fieldNum(vendInvoiceInfoTable, Payment));vendInvoiceInfoTable.PurchName = vendTable.name();vendInvoiceInfoTable.TaxGroup = vendTable.TaxGroup;vendInvoiceInfoTable.modifiedField(fieldNum(vendInvoiceInfoTable, InvoiceAccount));vendInvoiceInfoTable.modifiedField(fieldNum(vendInvoiceInfoTable, OrderAccount));vendInvoiceInfoTable.Description = invoiceDescription;vendInvoiceInfoTable.ParmJobStatus = ParmJobStatus::Waiting;if (currencyCode != '') {vendInvoiceInfoTable.CurrencyCode = currencyCode;}if (vendInvoiceInfoTable.validateWrite()) {vendInvoiceInfoTable.insert();}vendInvoiceInfoLine.clear();vendInvoiceInfoLine.initValue();select RecId from ecoResCategory where ecoResCategory.Name == procurmentCat;vendInvoiceInfoLine.ProcurementCategory = ecoResCategory.RecId;vendInvoiceInfoLine.DSSProjid = ProjId;vendInvoiceInfoLine.DSSProjCategory = ProjCat;vendInvoiceInfoLine.DSSCustInvoiceId = clientInvoiceId;vendInvoiceInfoLine.PurchPrice = invoiceAmount;vendInvoiceInfoLine.ReceiveNow = quantity;vendInvoiceInfoLine.ParmId = vendInvoiceInfoTable.ParmId;vendInvoiceInfoLine.TableRefId = vendInvoiceInfoTable.TableRefId;vendInvoiceInfoLine.modifiedField(fieldNum(VendInvoiceInfoLine, PurchPrice));if (vendInvoiceInfoLine.validateWrite()) {vendInvoiceInfoLine.insert();}}}