> ## 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

<h1 id="SuperOffice_WebApi_Agents_ICustomObjectAgent">
  Interface ICustomObjectAgent
</h1>

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

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_CreateDefaultCustomObjectAsync_System_String_SuperOffice_WebApi_RequestOptions_">
  CreateDefaultCustomObjectAsync(string, RequestOptions)
</h3>

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.

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_CreateDefaultCustomObjectDefinitionAsync_SuperOffice_WebApi_RequestOptions_">
  CreateDefaultCustomObjectDefinitionAsync(RequestOptions)
</h3>

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

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_DeleteCustomObjectAsync_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_">
  DeleteCustomObjectAsync(string, int, RequestOptions)
</h3>

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

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_GetCustomObjectAsync_System_String_System_Int32_SuperOffice_WebApi_RequestOptions_">
  GetCustomObjectAsync(string, int, RequestOptions)
</h3>

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.

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_GetCustomObjectDefinitionAsync_System_String_SuperOffice_WebApi_RequestOptions_">
  GetCustomObjectDefinitionAsync(string, RequestOptions)
</h3>

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.

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_GetCustomObjectsIconsAsync_SuperOffice_WebApi_RequestOptions_">
  GetCustomObjectsIconsAsync(RequestOptions)
</h3>

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.

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_GetCustomObjectsMetadataAsync_SuperOffice_WebApi_RequestOptions_">
  GetCustomObjectsMetadataAsync(RequestOptions)
</h3>

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.

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_HasScreenChooserAsync_System_String_System_Boolean_SuperOffice_WebApi_RequestOptions_">
  HasScreenChooserAsync(string, bool, RequestOptions)
</h3>

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.

<h3 id="SuperOffice_WebApi_Agents_ICustomObjectAgent_SaveCustomObjectAsync_System_String_SuperOffice_WebApi_Data_CustomObject_SuperOffice_WebApi_RequestOptions_">
  SaveCustomObjectAsync(string, CustomObject, RequestOptions)
</h3>

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](/en/api/reference/webapi/SuperOffice.WebApi.Agents.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.Data.CustomObject](/en/api/reference/webapi/SuperOffice.WebApi.Data.CustomObject.md)
