I am receiving an error "You cannot add an item an...
# ask-stanley-ai
m
I am receiving an error "You cannot add an item and purchase order combination that does not exist to a Vendor Bill" what could be the case
c
AI generated answer (using internal Slack threads):
The error "You cannot add an item and purchase order combination that does not exist to a Vendor Bill" typically occurs when you are trying to create a Vendor Bill from a Purchase Order (PO) and the item or the PO line you are trying to bill does not exist or is not associated with the PO. Here are a few things you could check: 1. Verify the Purchase Order and Line Item: Ensure that the Purchase Order (PO) and the line item you are trying to bill actually exist and are associated with each other. The PO ID and the line item ID you are using in your code should be valid and correctly linked. 2. Check the Vendor: Make sure that the vendor associated with the Vendor Bill is the same as the one associated with the Purchase Order. You cannot add multiple vendors to a single Vendor Bill. 3. Check the Currency: Ensure that the currency of the Vendor Bill and the Purchase Order are the same. You cannot add multiple currencies to a single Vendor Bill. 4. Check the Item Receipt: If you have the 'Bill in Advance of Receipt' preference disabled, you can only bill items that have been received. So, make sure the items you are trying to bill have been received. 5. Check the Status of the PO Line: The PO line should be open for it to be billed. If it's closed, you won't be able to bill it. Here is a sample code snippet that was used to create a Vendor Bill from a Purchase Order:
Copy code
javascript
var vendorBill = recordModule.create({
    type: recordModule.Type.VENDOR_BILL,
    isDynamic: true,
    defaultValues: {
        entity: supplierId
    }
});
vendorBill.selectNewLine('item');
vendorBill.setCurrentSublistValue('item', 'orderdoc', poId);
vendorBill.setCurrentSublistValue('item', 'orderline', poLineId);
                
vendorBill.commitLine('item');
vendorBill.save({
    enableSourcing: false,
    ignoreMandatoryFields: true
});
In this code,
supplierId
,
poId
, and
poLineId
should be valid and correctly associated with each other. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84619391
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844320297
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843208253
Please provide your feedback on this answer.