I need to generate XML UBL 2.1 format documents

Hello bubblers

I am building an e-invoicing app and I can’t find a plugin to generate XML UBL 2.1 document. Is there a way I can achieve this on bubble or I need to go back to code?

Hi Razvan,

Maybe someone has a better idea but in these cases (generating XML/JSON/other formats) I use ‘:format as text’ a lot.

For example, you have 2 data types:

  1. invoice

image

  1. invoiceLine

image

And you want to save the xml in another data type, you can do something like this:

  1. 'Search for invoices:first item:converted to list:format as text" retrieves the invoice and using :format as text, the details are formatted as XML:

  1. After that, the data from the related invoiceLine(s) is appended:

  1. The data is formatted as XML:

  1. And in the last stap the closing tag for invoice is added:

  1. Parts of the result

image

Disclaimer: I did not validate the XML, this is just an example of what is possible. :wink:

1 Like

That’s so cool. Thank you for your time and efforts to provide such detailed actions. I don’t see why this should not work…but is easy to test a validation. Anyaway…
A few questions please:
in ur screenshots I see XML = …
I am assuming that XML is a field you created as file in the data table invoice?
and where is the “type invoiceXML” coming from? you renamed you first datatable from invoice to invoiceXML?

Thank you so much for this. Really helpful.

N.p. Razvan! The data type invoiceXML is a 3rd data type, I did not rename the data type invoice. XML is a field in that 3rd data type just to save the XML. Yeah indeed, you can also save it in the invoice data type.

I had a lot of work to do because I am taking all the info from an SQL server and I only store partially (I do not store the invoice lines) the invoices on bubble…but after a few days of hard work, today I generated a few xml invoices and I got a successful validation thanks to your help. Now I only have one last step to do: to send the xml via API to the authorities and since they have a lousy documentation it is going to take a while :frowning:

Thank you again for your precious help.

1 Like