Delete data from the database
Level: advanced
note
The examples in this article are also implemented in the web service. The package that contains the web service implementation is attached in the Resources block.
In most cases, a deletion query must contain the Where
condition, which specifies the exact records to delete. If you do not specify the Where
condition, Creatio will delete all records.
Example
Example
Delete the contact that has the specified name.
DeleteContacts() method
public string DeleteContacts(string name) {
var delete = new Delete(UserConnection)
.From("Contact")
.Where("Name").IsEqual(Column.Parameter(name));
var cnt = delete.Execute();
return $ "Contacts with name {name} were deleted. {cnt} rows affected";
}