My Products
Help
christianth
PARTNER

Add attachment to order

by christianth

Hi!

 

How do I add an attachment on a order in graphQL?

 

I have looked at the orderAttachment_create mutation, but can not find any "fileData" field (base64) like the incomingAccountingDocumentAttachment_create mutation.

 

Br,

Christian

4 REPLIES 4
omelhus
PARTNER

by omelhus

Did a quick test appending .pdf to an xml-file and it did not work, unfortunately.

omelhus
PARTNER

by omelhus

I doubt it.

 

The only file type you are allowed to upload in the UI is pdf, so I expect the same constraints are applied to the API.

 

I don't think there's any integrity check though, so you could probably just append .pdf to the file name and live happily ever after.

Accepted solution
omelhus
PARTNER

by omelhus
    mutation UploadOrderAttachment(
        $companyNo: Int!
        $orderNo: Int!
        $fileName: String!
        $description: String!
        $data: String!
    ) {
        useCompany(no: $companyNo) {
            order_processings {
                addAttachment(
                    filter: { orderNo: { _eq: $orderNo } }
                    args: { description: $description, fileName: $fileName, fileBytes: $data }
                ) {
                    succeeded
                }
            }
        }
    }
christianth
PARTNER

by christianth

Thank you!

Is it possible to add both XML and PDF?