> For the complete documentation index, see [llms.txt](https://docs.silkbuilder.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.silkbuilder.com/how_to/mark_deleted.md).

# Mark Deleted

When SilkBuilder receives a request to remove a record from the database, it executes the SQL command "delete," which physically removes it. However, there are cases in which a record has to be "removed" from the application operations but still exists in the database for archiving or log purposes. To accomplish this kind of scenario, the *silk:DataProvider* tag provides the property *markDeleted*.

### The markDeleted Property

By default, when not added, the *markDeleted* property value is "**false."** In this case, the *DataProvider* will execute a regular *delete* SQL command. If the property *markDelete* value is set to "**true,"** then the *DataProvider* will execute a **"delete"** on the client side for visual feedback and an **"update"** in the server side.

```xml
<silk:DataProvider id="dataDP" servicePath="" markDeleted="true" />
```

To complete this process, the DataProvider has to be "informed" of which column, or columns, defines the removal of the record. To do this SilkBuilder provides the DataProvider event markDeleted. This event is triggered before the delete method is executed. Using the method setOperationsItem, the column, or columns, defining the record deletion can be set up.

```javascript
dataDP.on("markDeleted",function(){
	/*
	 * In this example the column 'archiveStatus' defines
	 * in the table the 'deleted' condition.
	 * The value 0 is not-deleted, and 1 is deleted.
	 */
	dataDP.setOperationItem("archiveStatus",1);
});
```

### ORM Triggers

Even though the *markDeleted="true"* property will execute an *update* in the database, the ORM will still execute a **before delete** and/or **after delete** triggers if these had been configured.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.silkbuilder.com/how_to/mark_deleted.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
