Cloning Structure to Entity

How to clone an entity as structure? I Have a structure which holds data from a REST API call. I want to store that response everytime into entity.

Solution

Hi Shivam, 

To have all action available, your entity in OutSystems need to define a primary key.

You can include an id attribute as long integer, mandatory and autonumber. So, click with the right button and select the "set identifier".

regards 

Fabio

Hi Shivam,

I don't think there is any default action there to generate structure from Entity directly.

You can generate Structure from JSON or manually you can create structure.

In your case you have REST  integration response structure .

  1. Once you get response from JSON you can create a server action with Entity  type as a variable
  2.  Now in variable you can assign value from Integration response structure.
  3. Finally you can call create or update based on your requirements and assign the local variable as record.
  4. If you want to delete old  before inserting new and then insert fresh you can delete the records and then do the 2 and 3rd steps.

Hope this will give you an idea to solve your problem.

Dileep

Hi Dileep,

Thanks for your response. My question was more around copying the Structure and its attributes as is it was there in structure. I Think simple copy pasting will create the Entity and its attributes. But it does not create all the CRUD actions in the entity.

Solution

Hi Shivam, 

To have all action available, your entity in OutSystems need to define a primary key.

You can include an id attribute as long integer, mandatory and autonumber. So, click with the right button and select the "set identifier".

regards 

Fabio

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.