Access to Entity from Module side

Access to Entity from Module side

  

Hi everyone,

I'm trying to create a module that is validate and insert record to a dynamic Entity which is provided by user.

In this component, I have an Advance SQL with the Insert query:

SyntaxEditor Code Snippet

INSERT INTO @DupRecordsTable
SELECT temp.*
FROM @TempTable temp

The expand incline parameter will be provided by user, ex: "{EntityA}", "{EntityB}" (Noted that each of this entity doesn't exist in Module side)

After try to execute this Module from user side, I got the error: "'EntityA' found in 'Expand Inline' parameter is an unknown Entity"

Is there anyway to interact with user's Entity from Module side?

Thanks

Hi Thang,

Could you explain where the user entity is stored? I assume that you don't store it the OutSystems database, but I don't get where you have these user entities.

Kind regards,

Remco Dekkinga

Remco Dekkinga wrote:

Hi Thang,

Could you explain where the user entity is stored? I assume that you don't store it the OutSystems database, but I don't get where you have these user entities.

Kind regards,

Remco Dekkinga


Hi Remco,

The user entity is created by themself and stored it in OutSystems.

Ex: They created the EntityA in OutSystems and then they passed the name of this Entity to my Module ("{EntityA}"). My Module will replace this name to the expand inline parameter in SQL.

Solution

Ok, 

This means that there are developers that create an OutSystems User entity in an OutSystems Module, probably not set as public.

When they are not public and not referenced, your module can't find those entities. This is a security measurement in the platform.

However, if you want to run a query on a physical tablename, you should use the following advanced query:

SELECT column_name FROM os@PhysicalTableName

Where you strip the first two characters from the input parameter PhysicalTableName.

For instance: ossys_entity will be sys_entity, because the ossys, oslog, etc. are reserved words and this way you can bypass these.

Kind regards,

Remco Dekkinga

Solution

Hi Thang,



Insert Into @DupRecordsTable (@DupRecordsTable.[Name]) Select temp.[Name] FROM @TempTable temp

Kindly note you need to set Input parameter property to Expand Inline to Yes. also you need to specify column names.

 if you want to get all columns i.e *  then you need to set IDENTITY_INSERT to ON.


Insert Into @DupRecordsTable(@DupRecordsTable.*) Select temp.* FROM @TempTable temp



Here I am assuming that you are setting input parameter entity value like "{EntityA}".

Let me know if you still face the issue.


Thanks,

Remco Dekkinga wrote:

Ok, 

This means that there are developers that create an OutSystems User entity in an OutSystems Module, probably not set as public.

When they are not public and not referenced, your module can't find those entities. This is a security measurement in the platform.

However, if you want to run a query on a physical tablename, you should use the following advanced query:

SELECT column_name FROM os@PhysicalTableName

Where you strip the first two characters from the input parameter PhysicalTableName.

For instance: ossys_entity will be sys_entity, because the ossys, oslog, etc. are reserved words and this way you can bypass these.

Kind regards,

Remco Dekkinga


It works perfectly, thanks for your support!

Afaque Shaikh wrote:

Hi Thang,



Insert Into @DupRecordsTable (@DupRecordsTable.[Name]) Select temp.[Name] FROM @TempTable temp

Kindly note you need to set Input parameter property to Expand Inline to Yes. also you need to specify column names.

 if you want to get all columns i.e *  then you need to set IDENTITY_INSERT to ON.


Insert Into @DupRecordsTable(@DupRecordsTable.*) Select temp.* FROM @TempTable temp



Here I am assuming that you are setting input parameter entity value like "{EntityA}".

Let me know if you still face the issue.


Thanks,


I did as Remco said and it worked perfectly, thanks for your support!