to get a personalized navigation.
to get a personalized navigation.
Hi,
When retrieving an invoice through API, what parameters should we check to ensure to invoice is ready for sending through EDI?
Also, is there an easy way to check if a customer has EDI invoice activated in "Grunndata Kunder - Sendemåte for dokumenter"?
Solved! Go to Solution.
Hi @danielboylan
Assuming the ordre is not yet invoiced, you could check if the order is in a status ready for invoicing, is that matches your scenario(?)
Here's an example showing orders in status "Ready for invoice", omittting orders marked for batch invoicing.
Apart from that, it depends on what you mean by "ready for sending through EDI":
query OrdersReadyForInvoice ($cid: Int) {
useCompany(no: $cid){
order (filter: {
orderStatus1: {_is_on: 1},
orderPreferences: {_is_off: 4}}) {
totalCount
items {
orderNo
customerNo
sumBeforeGroupDiscountDomestic
}
}
}
}
I suppose you would have to query customers for a value in Document delivery method 1, something like this:
query OrdersReadyForInvoice ($cid: Int) {
useCompany(no: $cid){
associate(filter: {
customerNo: {_gt: 0},
documentDeliveryMethod1: {_is_on: 8}}) {
totalCount
items {
customerNo
name
documentDeliveryMethod1
}
}
}
}
where "8" is the bitvalue representing EDI, if that's what you are looking for specifically.
This is not a correct filter:
filter: {
orderStatus1: {_is_on: 1},
orderPreferences: {_is_off: 4}}
It has more than one value so you need to build and expression with _and and/or _or. For instance, if both of these need to be true, then write it as follows:
filter: { _and: [
{orderStatus1: {_is_on: 1}},
{orderPreferences: {_is_off: 4}}
]}
However, it might be easier for you to write the filter using the flag fields:
filter: {_and:[
{orderStatus1Flags: {_is_on: ReadyForInvoicesAndCreditNotes}},
{orderPreferencesFlags: {_is_off: BatchInvoice}}
]}
In the GraphiQL web IDE, you can explore the documentation and see the possible flags and their numerical value for each such flags field.
You can read more about that here: https://docs.business.visma.net/docs/schema/bitflags
Thanks for the followup Marius, I'll make sure to build bu query using "and"!
Copyright © 2022 Visma.com. All rights reserved.