Creating XML file through FlowScript

We would like to create a complex XML file in flow. The existing XML connector (Generate Xml Data) is quite limited in it’s functionality and therefore we would like to do it in FlowScript. Does anyone have an example of a FlowScript that’s creating an XML file?


There are two ways in Flow Script that I’ve used. Either you assign a variable in a Script Step with the XML string you wan’t to create and replace the tag values with Flow variables where needed. To get this somewhat readable you should create new lines and intendent properly. Connect each row with a “&” sign.

A more ambitious approach is to create FlowScript functions that create the tags for you. Not sure if this is the most convention way. This example is a bit complicated maybe, but hopefully you get the idea.

Both approaches requires manual work and somewhat cumbersome, but it gets the job done. And you have full control of the output.

Both approaches will result in a Flow variable containing a XML string. I would go with the first approach if you don’t love coding in Flow Script :slight_smile:

here is a flow i made for us to export absences to a payrol system. It contains some proccess specific logic but at the end it produces a simple XML file.
So the example part is here:

Here is what it creates (since i cant upload txt files :slight_smile: )

Hope this helps!

CIT-53 Export Hogia Absence File.wap (53.0 KB)

When all your data or most of your data is coming from a database you can generate the XML from a query through a database connector.
In Oracle you can define complex structures.