How do I import data from external DB into Outsystems entity?

How do I import data from external DB into Outsystems entity?

I've tried creating queries that reference both an internal Outsystems entity and an entity from another MS SQL database.  I get an error message that the query can't reference the Outsystems entity and the foreign key.  How can I migrate the data from the MS SQL database table into an internal Outsystems entity?  I've looked through SQL manager and I don't see any tables with the name of my entity.


Hi Craig, 

Integration Studio doesn't copy the other systems entities to the outsystems catalog, it just references them, in order for you to have access to the records stored there.

If you import the data from the external DB to an outsystems catalog, then you'll get the same data in both places. If that's the scenario you should create an entity in your service studio and create a timer to, periodically, selects the records from the external DB and then create them in the OutSystems new entity.

Hi Craig,

To import tables to OutSystems here's what you can do:

1 - In SQL Server grant owner permission of those tables to the OSRuntime user
2 - In Integration Studio import those entities and publish an extension
3 - In Service Studio import those extension entities
4 - In the eSpace tree right click one of those entities and click copy
5 - Right click in the Entities folder in the eSpace tree and select Paste
6 - Repeat steps 5,6 for all the desired entities
7 - You will now have entities with the same structure
8 - Create an action in a timer to copy records from the old tables to the new ones
9 - Publish and run the timer
10 - Delete the action, the timer, the extension and the original tables in SQL Server

Tiago Simões
Hi Guys,
I have exactly the same issue, but my lack of knowledge is stopping me from understanding this post.
My Scenario:
I have a production application that creates data and stores it in an MSSQL db (this app will remain in production and is the master data source), I want to create an new application using Service studio that imports this data - (refreshing every hour at least) into my new App.
I have followed Tiago's steps below, but I don't know how to create the action in step 8 - I tried following the Outsystems demo that shows how to import data from Excel, and then modifying it to source data from my SQL DB instead, but it didn't work.
Can anybody help me with this? I really need a step by step guide or a working action in an oml to play with to see how it works.
Thanks in advance....
Hi Gary,

That action would be created in the following way:
  1. Create an integration component that imports your external entities to your eSpace (doing as explained in this video);
  2. Create a Timer that executes an action that first queries your external database entity to get all records and for each record, create or update the record in the local OutSystems database. To do this, you will have to store some kind of an "original identifier" so that you are able to map the two database; 
Have you tried doing this? Are you getting any error?

Kind Regards,

Daniel Lourenço
Hi Daniel,
Thank you for your reply.
I have already done step 1 and can see the data.
Step 2 is where I need help, I'm afraid listing a description of what I need to do doesn't help me achieve it as I'm new at this - sorry
I also posted this.... maybe it explains my problem further...

In summary how do I:
Query the external database entity to get all records - my post above points out that one record is written using the action created, but there are 1500 records that are not processed - I must have a logic / process wrong.
Just to be clear, my source database cannot be altered in any way, I just need to see the source data and link my new data to it