Part #4 Create CRUD operations

Cabdukayumova
4 min readSep 7, 2022

--

This post will describe the main steps of creating CRUD operations in Outsystems. Luckily it is not so complicated =)

What will be covered:

  1. Create operation
  2. Update operation
  3. Delete operation

Let’s start!

Go to the project which you created before in Outsystems. Open CS extended module (CS module can have a different name in your project, but notice it will have Service word in the scope).

Create Operation

Go to the Logic tab and right-click Service Actions and click Add Folder. Note: keeping your actions structured inside the files keeps your code more readable and editable.

After, inside the folder right-click the folder and click Add Service Action. First, we will work with Create action. To do this, go to the Data tab, and expand the Request table to expend the CreateRequest action. It will show you input and output resources and what they should look like.

Note: You can always expend action inside the table to see input and output variables.

After reviewing which kind of input and output variables will be required, drag and drop it to the action which you created in the Logic tab -> Create_Request Service Action.

The system will show you an error, you should create an input variable and assign it to the CreateRequest action. After using the assign widget to assign the ID of the newly created value.

For this create one output variable with the RequestId data type variable. After searching the Assign widget on the left side of the screen and putting it after the action.

Repeat the same actions where you need the CreateAction option.

Update Operation

Go to the Data tab and open the Request table, find the UpdateRequest action, and expand it. Notice which kind of data variable is required to work with this action

After drag and drop to the service action which you created on the Logic tab. The system will show you an error. It is okay! Create an input variable on the Update_Request action with the Request data type.

Assign to the action created variable. Repeat the same actions to the tables where you will need to update the action

Delete action

For using delete actions from the tables’ action you should repeat the same action, just this time choose to delete action.

Repeat the same actions to the tables where you will need to delete the action

Note: For almost all additional actions related to m:m, 1:m connections, or filters, we will call basic CRUD operations from the CW module.

This is what my Service Action looks like:

I created CRUD actions for ApproveHistory, Attachment, Product, Request, and RequestedUser tables.

Note: For the Attachment update action I used the first Delete action inside and after Create Action. Because it is a Blob file it is better to clean it up every time when I want to update it.

Finally — all other database-related actions will be called and manipulated in the CW module.

This post was dedicated to basic CRUD operations without going deeper into the logic of the eTicketing system.

Let me know if you are interested in different topics, or facing some issues =)

--

--

Cabdukayumova
Cabdukayumova

Written by Cabdukayumova

OutSystems developer who is passionate about delivering projects and open to the connections.