> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SuperOffice.WebApi.Agents.ICustomObjectAgent

# \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent">\</a> Interface ICustomObjectAgent

Namespace: [SuperOffice.WebApi.Agents](SuperOffice.WebApi.Agents.md)\
Assembly: SuperOffice.WebApi.dll

Agent for working with Custom Objects (extra tables): read schema and full CRUD over rows. Purpose-built replacement for using DatabaseTableAgent against custom objects.

```csharp theme={null}
public interface ICustomObjectAgent : IAgentBase, IDisposable
```

#### Implements

[IAgentBase](SuperOffice.WebApi.Agents.IAgentBase.md),
[IDisposable](https://learn.microsoft.com/dotnet/api/system.idisposable)

## Methods

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_CreateDefaultCustomObjectAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultCustomObjectAsync(string, RequestOptions)

Returns a new Custom Object row pre-populated with the default values declared by the Custom Object Definition. The row is not yet persisted.

```csharp theme={null}
Task<CustomObject> CreateDefaultCustomObjectAsync(string definitionName, RequestOptions requestOptions = null)
```

#### Parameters

`definitionName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Database table name of the Custom Object Definition, e.g. 'y\_equipment'.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CustomObject](SuperOffice.WebApi.Data.CustomObject.md)\&gt;

A new Custom Object row pre-populated with default values. Not yet persisted.

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_CreateDefaultCustomObjectDefinitionAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> CreateDefaultCustomObjectDefinitionAsync(RequestOptions)

Set default values into a new CustomObjectDefinition.
NetServer calculates default values on the entity, which is required when creating/storing a new instance

```csharp theme={null}
Task<CustomObjectDefinition> CreateDefaultCustomObjectDefinitionAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CustomObjectDefinition](SuperOffice.WebApi.Data.CustomObjectDefinition.md)\&gt;

A blank CustomObjectDefinition

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_DeleteCustomObjectAsync\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> DeleteCustomObjectAsync(string, int, RequestOptions)

Deletes a single Custom Object row by primary key.

```csharp theme={null}
Task DeleteCustomObjectAsync(string definitionName, int id, RequestOptions requestOptions = null)
```

#### Parameters

`definitionName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Database table name of the Custom Object Definition, e.g. 'y\_equipment'.

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Primary key of the row to delete.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

This method has no return value

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_GetCustomObjectAsync\_System\_String\_System\_Int32\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCustomObjectAsync(string, int, RequestOptions)

Returns a single Custom Object row by definition name and primary key.

```csharp theme={null}
Task<CustomObject> GetCustomObjectAsync(string definitionName, int id, RequestOptions requestOptions = null)
```

#### Parameters

`definitionName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Database table name of the Custom Object Definition, e.g. 'y\_equipment'.

`id` [int](https://learn.microsoft.com/dotnet/api/system.int32)

Primary key of the row to fetch.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CustomObject](SuperOffice.WebApi.Data.CustomObject.md)\&gt;

The Custom Object row, or null if no row with that id exists.

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_GetCustomObjectDefinitionAsync\_System\_String\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCustomObjectDefinitionAsync(string, RequestOptions)

Returns the schema (table + field definitions) for a Custom Object Definition by its database table name.

```csharp theme={null}
Task<CustomObjectDefinition> GetCustomObjectDefinitionAsync(string definitionName, RequestOptions requestOptions = null)
```

#### Parameters

`definitionName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Database table name of the Custom Object Definition, e.g. 'y\_equipment'.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CustomObjectDefinition](SuperOffice.WebApi.Data.CustomObjectDefinition.md)\&gt;

The Custom Object Definition, or null if no definition with that name exists.

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_GetCustomObjectsIconsAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCustomObjectsIconsAsync(RequestOptions)

Returns SVG icon data for all Custom Object tables, keyed by table name.

```csharp theme={null}
Task<StringDictionary> GetCustomObjectsIconsAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[StringDictionary](SuperOffice.WebApi.Data.StringDictionary.md)\&gt;

Map of table name to SVG icon data URI.

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_GetCustomObjectsMetadataAsync\_SuperOffice\_WebApi\_RequestOptions\_">\</a> GetCustomObjectsMetadataAsync(RequestOptions)

Returns bootstrap metadata for all Custom Object tables.

```csharp theme={null}
Task<CustomObjectMetadata[]> GetCustomObjectsMetadataAsync(RequestOptions requestOptions = null)
```

#### Parameters

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CustomObjectMetadata](SuperOffice.WebApi.Data.CustomObjectMetadata.md)\[]\&gt;

Metadata for all custom object tables.

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_HasScreenChooserAsync\_System\_String\_System\_Boolean\_SuperOffice\_WebApi\_RequestOptions\_">\</a> HasScreenChooserAsync(string, bool, RequestOptions)

Returns true if a screen chooser is configured for the given Custom Object Definition and mode.

```csharp theme={null}
Task<bool> HasScreenChooserAsync(string definitionName, bool edit, RequestOptions requestOptions = null)
```

#### Parameters

`definitionName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Database table name of the Custom Object Definition.

`edit` [bool](https://learn.microsoft.com/dotnet/api/system.boolean)

True to check for a custom edit screen; false to check for a custom view screen.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\&gt;

True if a screen chooser (view or edit) is configured for this Custom Object.

### \<a id="SuperOffice\_WebApi\_Agents\_ICustomObjectAgent\_SaveCustomObjectAsync\_System\_String\_SuperOffice\_WebApi\_Data\_CustomObject\_SuperOffice\_WebApi\_RequestOptions\_">\</a> SaveCustomObjectAsync(string, CustomObject, RequestOptions)

Saves a Custom Object row. If the row has a primary key set it will be updated, otherwise a new row is inserted.

```csharp theme={null}
Task<CustomObject> SaveCustomObjectAsync(string definitionName, CustomObject row, RequestOptions requestOptions = null)
```

#### Parameters

`definitionName` [string](https://learn.microsoft.com/dotnet/api/system.string)

Database table name of the Custom Object Definition, e.g. 'y\_equipment'.

`row` [CustomObject](SuperOffice.WebApi.Data.CustomObject.md)

The Custom Object row to save.

`requestOptions` [RequestOptions](SuperOffice.WebApi.RequestOptions.md)

Override language/culture codes on this request.

#### Returns

[Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1)\<[CustomObject](SuperOffice.WebApi.Data.CustomObject.md)\&gt;

The saved Custom Object row, with any server-assigned values (e.g. primary key) filled in.


## Related topics

- [SuperOffice.WebApi.Agents.CustomObjectAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.CustomObjectAgent.md)
- [SuperOffice.WebApi.Agents.CustomerServiceAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.CustomerServiceAgent.md)
- [SuperOffice.WebApi.Agents.IConfigurationAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IConfigurationAgent.md)
- [SuperOffice.WebApi.Agents.ConfigurationAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ConfigurationAgent.md)
- [SuperOffice.WebApi.Agents.DiagnosticsAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.DiagnosticsAgent.md)
- [SuperOffice.WebApi.Agents.IDiagnosticsAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IDiagnosticsAgent.md)
