Hi All
We have a scenario where we want to automate PO invoicing as soon as we do SO invoicing.
I am calling a PO invoicing code after SI posting but I am getting "The value "CA07-001114323" is not found in the map."
I am getting the same error if I am using the "Generate intercompany Invoice" feature after sales invoice.

I tested the same in a job getting the same error.
public static void main(Args _args)
{
PurchFormLetter purchFormLetter;
VendInvoiceInfoTable vendInvoiceInfoTable;
PurchTable purchTable = PurchTable::find('PO000000004-CA07');// salesTableLoc.interCompanyPurchTable();
Num num = 'I0000010S-CA14';
ttsbegin;
purchFormLetter = purchFormLetter::construct(DocumentStatus::Invoice);
//purchFormLetter = PurchFormLetter_Invoice::newFromSavedInvoice(vendInvoiceInfoTable);
//purchFormLetter.interCompanyVoucher(custInvcJour.LedgerVoucher);
purchFormLetter.printFormLetter(NoYes::No);
purchFormLetter.updatePurchParmTableNum(num);
//VendInvoiceInfoTable::updateExpectedValuesAndMatchStatusForSession(purchFormLetter.parmId());
purchFormLetter.update(purchtable,num,systemdateget());
ttscommit;
if (PurchTable::find(purchTable.PurchId).DocumentStatus == DocumentStatus::Invoice)
{
info(strfmt("Posted invoiced journal for purchase order %1",purchTable.PurchId));
}
}
After debugging I could see the error was coming from line 6533
