Skip to main content

<a id=“SuperOffice_WebApi_Agents_ICustomObjectAgent”></a> Interface ICustomObjectAgent

Namespace: SuperOffice.WebApi.Agents
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.

Implements

IAgentBase, 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.

Parameters

definitionName string Database table name of the Custom Object Definition, e.g. ‘y_equipment’. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CustomObject&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

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CustomObjectDefinition&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.

Parameters

definitionName string Database table name of the Custom Object Definition, e.g. ‘y_equipment’. id int Primary key of the row to delete. requestOptions RequestOptions Override language/culture codes on this request.

Returns

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.

Parameters

definitionName string Database table name of the Custom Object Definition, e.g. ‘y_equipment’. id int Primary key of the row to fetch. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CustomObject&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.

Parameters

definitionName string Database table name of the Custom Object Definition, e.g. ‘y_equipment’. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CustomObjectDefinition&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.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<StringDictionary&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.

Parameters

requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CustomObjectMetadata[]&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.

Parameters

definitionName string Database table name of the Custom Object Definition. edit bool True to check for a custom edit screen; false to check for a custom view screen. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<bool&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.

Parameters

definitionName string Database table name of the Custom Object Definition, e.g. ‘y_equipment’. row CustomObject The Custom Object row to save. requestOptions RequestOptions Override language/culture codes on this request.

Returns

Task<CustomObject&gt; The saved Custom Object row, with any server-assigned values (e.g. primary key) filled in.