After creating entity there is create and CreateAndUpdate is there,What is use of it

Hello all,

Hope all doing well. I have create entity and it has CRUD operation methods. There is 

1) create action

2) Update action

3) CreateAndUpdate Action is there. 

So what is difference of these three action. There is CreateAndUpdate action, so any need to have separate create and update action?

Entity.JPG

Hi ,

As the names specifies,

1. CreateEntity1 : Adds a new record into the database

2. CreateOrUpdateEntity1 : Adds a new record but if the record exists, it updates that record with new values.

3. UpdateEntity1 : Updates the record with new values.

Hi @Vrushali Punekar ,

Than you for your time but why outsystem did this way? means outsystem developer can provide one action -> CreateAndUpdate instead of creating two separate actions ex. Create , Update.

mvp_badge
MVP

Hello there PSS,

Hope you're doing well.

Those operations are called Entity Actions and they are related with their entity.


So, responding to your questions:

1) Create<Entity> Action: 

Adds a new entity record to the Database.

2) CreateOrUpdate<Entity> Action:

Adds a new entity record to the Database. If the record already exists, all attributes will be replaced with the new ones.

3) Update<Entity> Action:

Replaces all attributes in an entity record in the Database.


You can find all of these descriptions in Service Studio, as you can see in here:


Also, you may check the response from Cristiana Umbelino in this thread where she provides good documentation about the several types of entity actions:

https://www.outsystems.com/forums/discussion/56793/entity-actions-documentation/



Hope that this helps you!


Kind regards,

Rui Barradas

Hi @Rui Barradas  ,

Than you for your time but why outsystem did this way? means outsystem developer can provide one action -> CreateAndUpdate instead of creating two separate actions ex. Create , Update. 

There are very few situations where you want to use CreateOrUpdate, mostly you want to programmatically use either create or update as separate actions since CreateOrUpdate has an extra penalty  of validating if the record already exists. As a rule of thumb, if you know on your code whether is a creation or not (e.g. null identifier) you should use the individual actions instead. Curious to know if this is still as is, looking forward to other opinions.

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