Hi,
I want to ask how can i access the CRUD Function if the entity in the CS module is not public? If i make the entity public, the technical debt for my app will be higher which means i cannot push it to production. I have tried using server actions but the input parameter need the entity to be public. I have to make it expose read only.
Is there any ways to do this?
Thank you!
Hi Aina Khalidah,
To ensure secure and efficient CRUD operations on entities without exposing them directly, create server actions within the module containing the entities. For each CRUD operation, define a dedicated structure to encapsulate the necessary parameters (e.g., input and output fields) and mark these structures as public for reuse across modules. Use these structures as parameters for the server actions, ensuring clear and consistent data exchange. Once the server actions are implemented, make them public, allowing other modules to access the CRUD functionalities without directly exposing the entities. This approach maintains proper encapsulation, reduces technical debt, and follows best practices for modular application development.
Thanks
I tried this but i think maybe i got my step wrong. Do you have any oml that i can refer to?
I just attached one sample oml for creating EmployeeDetails. Please check it out.
Hope it helps.
You can create a structure with the required attributes from the Entity and use it as a parameter in your server action. Inside your server action map the values to the entity record and complete the required operations.
Hello @Aina Khalidah ,
You can create CRUD operations using Advanced SQL in OutSystems without making the entity public.
Example:
CREATE (Insert Record)
Create a Server Action in Your Core Services (CS) Module:
Define Input Parameters:
Add an Advanced SQL Node:
INSERT INTO {Entity} ([Name])VALUES (@Name)
This would work for this entity:
Hi @Aina Khalidah
Create a structure which contain same attribute of entity
and Structure should be public.
Create Server Action which are public and take a input variable type of Structure and do your CURD operation. take the dependency in Main module and Use newly created Server Action which is in your CS module
Regards ,
Rajat
Create a server action or service action to create a wrapper for crud operation and make it public and access the wrapper method instead of directly access entity methods.
It is not a best practice to use public entities or crud operation directly.
In OutSystems, a "public entity" pattern refers to the practice of designing entities (database tables) that are exposed to other modules or applications as read-only, meaning they can be accessed and queried but not directly modified by external components, promoting data integrity and controlled access to shared data across the system