# CRUD

### Create, Read, Update and Delete

CRUD is the acronym for CREATE, READ, UPDATE and DELETE. These terms describe the four essential operations for creating and managing persistent data elements.

Custom events are great for repetitive tasks. When you allow users to edit a Thing in multiple places on a page, you can add a 'make a change to' workflow each time you want to save this data. You can imagine that managing multiple workflows could result in errors or, at best, a lot of duplicate work.

<figure><img src="/files/a0BXQ6NIxolbHkwmCIQu" alt=""><figcaption></figcaption></figure>

Alternatively, you can create a Custom Event. It is a generic workflow that can be triggered or scheduled and use any type of data or no type of data at all.

<figure><img src="/files/kMHIi2tFmHwRfnt4Iia0" alt=""><figcaption><p>We are sending the User object that we want to update to the Custom event.</p></figcaption></figure>

Instead of having multiple 'make changes to Thing' workflows, you just create one and it's triggered by a custom event.

<figure><img src="/files/3wg3vRenxl0exYyTFq7N" alt=""><figcaption><p> A custom event that updates a User</p></figcaption></figure>

In this Custom Event we make changes to the User (we pass the user to the custom event and it will be accessible as the 'User'), but we can also use it to reset the form and trigger a Toast notification or edit the User in another way.

<figure><img src="/files/OnVzzAgacajnRKQ3gFUf" alt=""><figcaption><p>Make changes to thing is placed inside Custom event</p></figcaption></figure>

Inside the update action, we refer to the inputs where we define that values. Note that we have the ability to define multiple parameters when triggering the Custom event and it means that you don't always have to refer to input but you could also refer to data that you send via Custom event. See the example below:

<figure><img src="/files/7iNbdoWCknESF1LoKrSj" alt=""><figcaption><p>Here the suspended value could be also a dynamic variable. This is just for example purposes.</p></figcaption></figure>

<figure><img src="/files/xnhAAij1Sl3YLeqTSNk2" alt=""><figcaption><p>Example of passing additional value </p></figcaption></figure>

You should also use this custom event when you create a new Thing. You create the Thing in step 1 and send it to the Custom event in step 2:

<figure><img src="/files/yG2bHNbualGGB5vcKiAW" alt=""><figcaption><p>Create a User and save all the fields in the custom event.</p></figcaption></figure>

{% hint style="info" %}
This principle applies to all data types and not just only to the User data type.&#x20;
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.openbuild.io/working-with-the-framework/data-and-workflows/crud.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
