Update from extension to entity

Update from extension to entity

  

Update from extension to entity

Is it possible to update from extension to entity?
The target entity becomes entity of another module.

If updating the entity of another module as an architecture please also tell me about it if you should do with ServerAction calling it.

Thank You.

Hi Usami


You can use RuntimePublicDB to get the connection/transaction and execute your SQL:

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/RuntimePublic.Db_API/Insert_Data_in_the_Application_Database

And to get the physical table name of your entity you can query the entity "Entity" from System, and look for your entity.


Do inserts/updates in extensions are hard to maintain. It's probably better to use server actions instead.


Cheers

Victor Salvalagio Pereira wrote:

Hi Usami


You can use RuntimePublicDB to get the connection/transaction and execute your SQL:

https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/RuntimePublic.Db_API/Insert_Data_in_the_Application_Database

And to get the physical table name of your entity you can query the entity "Entity" from System, and look for your entity.


Do inserts/updates in extensions are hard to maintain. It's probably better to use server actions instead.


Cheers


Thank you for your reply.

Where is the USEDITEM pointed to, where is the Entity located?

Is Entity defined in IntegrationStudio?
Is it an Entity defined in ServiceStudio?


If it was defined in ServiceStudio, should I even be in Public?

Solution
In this example, we add a record to the USEDITEM table that is in the application database.

Reading the docs I believe that USEDITEM is a table, and not an entity in OutSystems. 


The documentation that I sent to you is to query tables inside the outsystems database, and not external databases. If you want to query some table from IntegrationStudio you need to follow this docs: https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/RuntimePublic.Db_API/Query_Data_from_an_External_Database


As you are querying directly in the database you will need the physycal table name of your entity.

You can query these two tables from System to find the physical table name of your entity, and pass the name as a parameter to your extension:



Victor

Solution

Victor Salvalagio Pereira wrote:

In this example, we add a record to the USEDITEM table that is in the application database.

Reading the docs I believe that USEDITEM is a table, and not an entity in OutSystems. 


The documentation that I sent to you is to query tables inside the outsystems database, and not external databases. If you want to query some table from IntegrationStudio you need to follow this docs: https://success.outsystems.com/Documentation/10/Reference/OutSystems_APIs/RuntimePublic.Db_API/Query_Data_from_an_External_Database


As you are querying directly in the database you will need the physycal table name of your entity.

You can query these two tables from System to find the physical table name of your entity, and pass the name as a parameter to your extension:



Victor


Thank you for your help

I did not understand how to search and use the target physical table name, but it was solved with your help.

Thank you very much