Forum Discussion

sankhala's avatar
4 years ago

create purchase order not working

{
    "Number""PSMN001",
    "Date""2021-07-14T00:00:00",
    "SupplierInvoiceNumber"null,
    "Supplier": {
        "UID""afdc59ae-d844-4068-bf39-073b3e395b79"
    },
    "ShipToAddress""Postman Sample, Address, Here",
    "Terms": {
        "PaymentIsDue""DayOfMonthAfterEOM",
        "DiscountDate"1,
        "BalanceDueDate"30,
        "DiscountForEarlyPayment"0,
        "MonthlyChargeForLatePayment"0,
        "DiscountExpiryDate""2021-07-14T00:00:00",
        "Discount"0,
        "DueDate""2021-08-14T00:00:00"
    },
    "IsTaxInclusive"false,
    "IsReportable"false,
    "Lines": [{
        "Type""Transaction",
        "Description""Iten 123",
        "BillQuantity"100,
        "ReceivedQuantity"100,
        "BackorderQuantity"0,
        "Total"1000,
        "UnitPrice"10,
        "Job"null,
        "DiscountPercent"0,
        "TaxCode": {
            "UID""ea4e5559-1386-4326-943d-2e79e3ee2a19"
        },
        "Item": {
            "UID""280cdf4d-7ac5-4968-8760-c244af1ea5d6"
        }
    }],
    "Subtotal"1000,
    "Freight"0,
    "FreightTaxCode": {
        "UID""ea4e5559-1386-4326-943d-2e79e3ee2a19"
    },
    "TotalTax"100,
    "TotalAmount"1100,
    "Category"null,
    "Comment""",
    "ShippingMethod"null,
    "PromisedDate"null,
    "JournalMemo""Purchase; 786",
    "BillDeliveryStatus""Print",
    "AppliedToDate"0,
    "BalanceDueAmount"1100,
    "Status""Open",
    "LastPaymentDate"null,
    "Order"null,
    "ForeignCurrency"null
}

Response error

{
    "Errors": [
        {
            "Name""ValidationError",
            "Message""BusinessLine_AccountRequired",
            "AdditionalDetails""AccountId:(PurchaseOrderItemLine)",
            "ErrorCode"4239,
            "Severity""Error",
            "LearnMore"null
        },
        {
            "Name""ValidationError",
            "Message""PurchaseOrderLine_ItemBoughtOrInventoriedRequired",
            "AdditionalDetails""ItemId:(PurchaseOrderItemLine)",
            "ErrorCode"4302,
            "Severity""Error",
            "LearnMore"null
        }
    ],
    "Information""Warning, error messages have not been finalised in this release and may change"
}
  • Han-Solo's avatar
    Han-Solo
    MYOB Moderator

    HI sankhala,

     

    Thanks for reaching out and apologies for the delay in getting back to you. 

     

    Looking at the error messages `"Message""BusinessLine_AccountRequired",` that you have provided and the body request it does not look like you are passing the AccountField. 

     

    "Account": {
    "UID": "87967d0a-9e23-433e-b9dc-4304XXXXXXXXX",

     

    Response error
    {

        "Errors": [
            {
                "Name""ValidationError",
                "Message""BusinessLine_AccountRequired",
                "AdditionalDetails""AccountIdSmiley SadPurchaseOrderItemLine)",
                "ErrorCode"4239,
                "Severity""Error",
                "LearnMore"null
            },
           
     
    In regards to the second error PurchaseOrderLine_ItemBoughtOrInventoriedRequired", Suggest to me that the item being used has not been setup to Buy or inventory which means we would not be able to put a purchase or through before setting this up. 
     
     
     
     {
                "Name""ValidationError",
                "Message""PurchaseOrderLine_ItemBoughtOrInventoriedRequired",
                "AdditionalDetails""ItemIdSmiley SadPurchaseOrderItemLine)",
                "ErrorCode"4302,
                "Severity""Error",
                "LearnMore"null
            }
        ],
        "Information""Warning, error messages have not been finalised in this release and may change"