Update is used to update the property values of existing entity objects records. Update works similar to a sql update statement. The update service will update an entity object record and the corresponding sql table record.
Update Use Example
In this example we are going to be looking at the Save Shopping Cart Webpart. This webpart allows a user to save their shopping cart so they can access it later at their leisure. Below you can see that this webpart consists of a textbox and a Save button. The save button process contains the update service that we are going to be analyzing.
In this process, we first retrieve the CartId of the cart that we are going to save. Once we have the CartId, we run the Update service and update the ShoppingCartHeader entity object record. The EntityId and EntityType act as a key here so we enter the CartId for the EntityId and we enter ShoppingCartHeader for the EntityType. The entity properties that we want to update are Nickname and UserId, so use the Nickname that was entered and the UserId of the current user to update those values.
Below is the log data for the save cart button process. Notice how all the entity properties are returned even though just one property was updated.
The Property Names correspond to columns that exist in the table tied to the entity. The property name must already exist as a column for the table/property for the entity. This is case sensitive. This means that if you make a database change to add a column, but do not sync the EASYProcess entity, the property will not exist yet and the action will be performed against the record, but it will occur as if the new column was not in the update statement ran.
Once the update service runs, the save cart webpart will close and the parent page will reload. The user can then navigate to the saved carts page and view that the cart was saved. If they log out or their session ends, they are able to reload the saved cart.