Seed preloaded data into entity

Currently, I would like to have some data preloaded into an application from a JSON file, which is then accessible via the domain model. I have a USStates entity with name and abbreviation attributes, and a json file inside the project folder which contains the data of each of the states to fill the entity as objects. I would like to know if it’s possible to, on the application’s initialization, load this data into the domain model. 
1 answers

Sure.  Create json structure, input mappings, and microflows to import the data.  I think the quickest way to include the Json is to create a string variable in your microflow and copy the Json into that variable.

Then, create a microflow that checks to see if the data has been uploaded and, if not calls the microflows that load the data.  Specify this microflow as your after startup microflow in the project configuration page.


FYI, this how to has the details about how to import json into your Mendix app.  You can ignore the part of this how to that involves calling the rest service