My Products
Help
kashyap
PARTNER

Failed to create voucher

by kashyap

We are trying to create voucher with PDF attachment. Getting below error. 

{"errors":[{"message":"Error: The primary key is in use.","path":["useCompany","incomingAccountingDocumentAttachment_create","values/0"],"extensions":{"data":{"status":15,"status_name":"valueNotAccepted"}}}],"data":{"useCompany":{"batch_create":{"affectedRows":1,"items":[{"batchNo":46}]},"voucher_create":{"affectedRows":2,"items":[{"batchNo":46,"voucherNo":1,"voucherDate":20240627},{"batchNo":46,"voucherNo":2,"voucherDate":20240627}]},"incomingAccountingDocumentAttachment_create":{"affectedRows":1,"items":[{"incomingAccountingDocumentNo":1,"attachmentNo":0,"fileNo":0}]}}},"extensions":{"vbnxt-trace-id":"0000000000000000dcd04b09d706e92c"}}

 

Can you please help?

9 REPLIES 9
kashyap
PARTNER

by kashyap

Anyone know how to resolve below error. Everyday our client getting this error. 

"The primary key is in use."

omelhus
PARTNER

by omelhus

Can you post the entire query?

kashyap
PARTNER

by kashyap

Request:


{"query":"mutation createBatchAndVoucherWithAttachment($batchId: Int = 0) { useCompany(no: 3105037) { batch_create( values: [{voucherSeriesNo: null, valueDate: 20240905, description: \"Z-rapport-1-1003\" }]) { affectedRows items { batchNo @export(as: \"batchId\") } } voucher_create( values: [{creditAccountNo: 3005, creditTaxCode: null, amountDomestic: 2660, batchNo: $batchId, voucherType: 1, voucherNo: null, voucherDate: null, text: \"Z-rapport 1003 Salg Varer 25.00% MVA (05.09.2024)\"}{debitAccountNo: 1920, debitTaxCode: null, amountDomestic: 1930, batchNo: $batchId, voucherType: 1, voucherNo: null, voucherDate: null, text: \"Z-rapport 1003 BankAxept (05.09.2024)\"}{debitAccountNo: 1901, debitTaxCode: null, amountDomestic: 730, batchNo: $batchId, voucherType: 1, voucherNo: null, voucherDate: null, text: \"Z-rapport 1003 Til nattsafe (05.09.2024)\"}]) { affectedRows items { batchNo voucherNo voucherDate } } incomingAccountingDocumentAttachment_create( values: [{incomingAccountingDocumentNo: 1, attachmentNo: 1, attachmentType: 2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AxIDAgUgovSW5mbyA1IDAgUgo+PgpzdGFydHhyZWYKMTE2ODUKJSVFT0YK\" }]) { affectedRows items { incomingAccountingDocumentNo attachmentNo fileNo } }  } }"}




Response received: 

{"errors":[{"message":"Error: The primary key is in use.","path":["useCompany","incomingAccountingDocumentAttachment_create","values\/0"],"extensions":{"data":{"status":15,"status_name":"valueNotAccepted"}}}],"data":{"useCompany":{"batch_create":{"affectedRows":1,"items":[{"batchNo":70}]},"voucher_create":{"affectedRows":3,"items":[{"batchNo":70,"voucherNo":1,"voucherDate":20240905},{"batchNo":70,"voucherNo":1,"voucherDate":20240905},{"batchNo":70,"voucherNo":2,"voucherDate":20240905}]},"incomingAccountingDocumentAttachment_create":{"affectedRows":1,"items":[{"incomingAccountingDocumentNo":1,"attachmentNo":0,"fileNo":0}]}}},"extensions":{"vbnxt-trace-id":"00000000000000003149118474fb2d56"},"success":true,"code":200}



omelhus
PARTNER

by omelhus

You are using the wrong endpoint to upload the document for the voucher/batch.

 

mutation createBatchAndVoucherWithAttachment($batchId: Int = 0) {
  useCompany(no: 5051201) {
    batch_create(
      values: [{voucherSeriesNo: null, valueDate: 20240905, description: "Z-rapport-1-1003"}]
    ) {
      affectedRows
      items {
        batchNo @export(as: "batchId")
      }
    }
    voucher_create(
      values: [{creditAccountNo: 3005, creditTaxCode: null, amountDomestic: 2660, batchNo: $batchId, voucherType: 1, voucherNo: null, voucherDate: null, text: "Z-rapport 1003 Salg Varer 25.00% MVA (05.09.2024)"}, {debitAccountNo: 1920, debitTaxCode: null, amountDomestic: 1930, batchNo: $batchId, voucherType: 1, voucherNo: null, voucherDate: null, text: "Z-rapport 1003 BankAxept (05.09.2024)"}, {debitAccountNo: 1901, debitTaxCode: null, amountDomestic: 730, batchNo: $batchId, voucherType: 1, voucherNo: null, voucherDate: null, text: "Z-rapport 1003 Til nattsafe (05.09.2024)"}]
    ) {
      affectedRows
      items {
        batchNo
        voucherNo
        voucherDate
      }
    }
    voucher_processings {
      addNewDocument(
        filter: {batchNo: {_eq: $batchId}}
        args: {fileName: "z-report-1003-4.pdf", description: "z-report-1003-4", fileBytes: "JVBERi0xLjMKMSAwIG9iago8PC..."}
      ) {
        succeeded
      }
    }
  }
}
kashyap
PARTNER

by kashyap

Is this new API available in documentation?

Accepted solution
kashyap
PARTNER

by kashyap

I have applied above given changes and got another errors:

Request Body:

mutation createBatchAndVoucherWithAttachment($batchId: Int = 0) {
  useCompany(no: 12xx679) {
    batch_create(
      values: [
        {
          voucherSeriesNo: null
          valueDate: 20240627
          description: "Z-rapport-1-13000"
        }
      ]
    ) {
      affectedRows
      items {
        batchNo @export(as: "batchId")
      }
    }
    voucher_create(
      values: [
        {
          creditAccountNo: 3021
          creditTaxCode: null
          amountDomestic: 1
          batchNo: $batchId
          voucherType: 1
          voucherNo: null
          voucherDate: null
          text: "Z-rapport 13000 Salg Varer 25.00% MVA (27.06.2024)"
        }
        {
          debitAccountNo: 1900
          debitTaxCode: null
          amountDomestic: 1
          batchNo: $batchId
          voucherType: 1
          voucherNo: null
          voucherDate: null
          text: "Z-rapport 13000 Kassebeholdning endring (27.06.2024)"
        }
      ]
    ) {
      affectedRows
      items {
        batchNo
        voucherNo
        voucherDate
      }
    }
    voucher_processings {
      addNewDocument(
        filter: { batchNo: { _eq: $batchId } }
        args: {
          fileName: "z-report-13000-763.pdf"
          description: "z-report-13000-763.pdf"
          fileBytes: "JVBER9GCg=="
        }
      ) {
        succeeded
      }
    }
  }
}


Error received:



{
  "errors": [
    {
      "message": "Error: Illegal value date 27.06.2024. Check suspension date and the accounting periods and VAT periods tables.",
      "path": [
        "useCompany",
        "batch_create",
        "values/0"
      ],
      "extensions": {
        "data": {
          "status": 15,
          "status_name": "valueNotAccepted"
        }
      }
    },
    {
      "message": "Error: Some non-incremental primary key columns are not entered.",
      "path": [
        "useCompany",
        "voucher_create",
        "values/0"
      ],
      "extensions": {
        "data": {
          "status": 2,
          "status_name": "nonAutomaticallyAssignablePrimaryKeyColumnsNotEntered"
        }
      }
    },
    {
      "message": "Error: Some non-incremental primary key columns are not entered.",
      "path": [
        "useCompany",
        "voucher_create",
        "values/1"
      ],
      "extensions": {
        "data": {
          "status": 2,
          "status_name": "nonAutomaticallyAssignablePrimaryKeyColumnsNotEntered"
        }
      }
    },
    {
      "message": "Error: Failed to execute operation.",
      "path": [
        "useCompany",
        "voucher_processings",
        "addNewDocument"
      ],
      "extensions": {
        "data": {
          "status": 5,
          "status_name": "failedToExecuteOperation"
        }
      }
    }
  ],
  "data": {
    "useCompany": {
      "batch_create": {
        "affectedRows": 1,
        "items": [
          {
            "batchNo": 0
          }
        ]
      },
      "voucher_create": {
        "affectedRows": 2,
        "items": [
          {
            "batchNo": 0,
            "voucherNo": 0,
            "voucherDate": 0
          },
          {
            "batchNo": 0,
            "voucherNo": 0,
            "voucherDate": 0
          }
        ]
      },
      "voucher_processings": {
        "addNewDocument": {
          "succeeded": false
        }
      }
    }
  },
  "extensions": {
    "vbnxt-trace-id": "0000000000000000518559a0d44533c4"
  }
}

by Øyvind Årseth

@kashyap You have to fix the first error, the given value date is in conflict with the current suspension date for the company, prohibiting the batch creation, which is key to the rest of your mutation. Check the current suspension date by running the processing "Move suspension date" in the company information table. Then adjust your suspension date accordingly.

kashyap
PARTNER

by kashyap

Yes. Using BNXT AI chatbot I am able to resolve the issue. Thanks for quick response.

omelhus
PARTNER

by omelhus

Yeah, this is probably an issue that the BNXT AI chatbot can help you with, as it's an issue within Business NXT.

 

Try it out here and follow its recommendation.