[BulkInsert] BulkInsert - TenantId not stored

Forge Component
(19)
Published on 2019-10-02 by Galter
19 votes
Published on 2019-10-02 by Galter

Hi,

I noticed that when I try to use BulkInsert on an entity with its Tenant Identifier (Tenant_Id) shown, this field is not filled and remains 0. Is this a known issue?

Regards,
Lennart

Hello Lennart, could you please see if there some message error in Outsystems General LOG?

If you put your table with show tenant identifier i think it should result.

As well you can try create a struct with all columns that you would like to bulk insert, all columns need to have the same name as your entity.


Best Regards,
Paulo Fagundes Jr.

Hi Paulo,

There are no messages in the General or Error log. I did a test with an entity with the fields Tenant_Id, Id, Label.

I have a loop adding records to a list of this entity, manually filling Tenant_Id and Label. This list is then fed to the BulkInsert action. This action does create the records in the entity. Field Label is filled, but field Tenant_Id is 0.

I've also tried it with ColumnsToIgnore filled with "Id" and ReferenceColumns set to "Tenant_Id", but that didn't make a difference.

Regards,
Lennart

Hi Lennart, sorry for my late reply.

Try use a struct instead of your entity. Create a struct with Tenant_Id and MyText columns.

Using it like this way you don't need put anything in ignore columns. Make sure that your columns name will have the same name as entity has, Put a breakpoint before your BulkInsert action and verify in debug if the whole data is filled in your variable,

This is not an error, this is a feature of the Outsystems entity object.

  • If the table is multi-tenant, there is no TENANT_ID information in the entity structure by default and Bulk insert extension do not know that.
  • If you want the C# object to contains TENANT_ID, set the property "show tenant identifier" on. Bulk insert extension need TENANT_ID if entity is multi-tenant.

Attention remember assign TENANT_ID into record list. After that your bulk insert working correctly.