Show / Hide Table of Contents

Interface ICustomObjectAgent

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

Experimental: The CustomObject agent is experimental, subject to change, and not intended for partners.
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("CustomObject Agent", "Interface for the CustomObject Agent. Agent for working with Custom Objects (extra tables): read schema and full CRUD over rows. Purpose-built replacement for using DatabaseTableAgent against custom objects.")]
public interface ICustomObjectAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;

using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
   using (CustomObjectAgent agent = new CustomObjectAgent())
   {
      // call methods on agent here...
   }
}

Methods

CreateDefaultCustomObjectAsync(string, CancellationToken)

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

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<CustomObject> CreateDefaultCustomObjectAsync(string definitionName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string definitionName

Database table name of the Custom Object Definition, e.g. 'y_equipment'.

CancellationToken cancellationToken
Returns
Type Description
Task<CustomObject>

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

CreateDefaultCustomObjectDefinitionAsync(CancellationToken)

Loading default values into a new CustomObjectDefinition.

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<CustomObjectDefinition> CreateDefaultCustomObjectDefinitionAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<CustomObjectDefinition>

New CustomObjectDefinition with default values

DeleteCustomObjectAsync(string, int, CancellationToken)

Deletes a single Custom Object row by primary key.

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task DeleteCustomObjectAsync(string definitionName, int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string definitionName

Database table name of the Custom Object Definition, e.g. 'y_equipment'.

int id

Primary key of the row to delete.

CancellationToken cancellationToken
Returns
Type Description
Task

This method has no return value

GetCustomObjectAsync(string, int, CancellationToken)

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

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<CustomObject> GetCustomObjectAsync(string definitionName, int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string definitionName

Database table name of the Custom Object Definition, e.g. 'y_equipment'.

int id

Primary key of the row to fetch.

CancellationToken cancellationToken
Returns
Type Description
Task<CustomObject>

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

GetCustomObjectDefinitionAsync(string, CancellationToken)

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

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<CustomObjectDefinition> GetCustomObjectDefinitionAsync(string definitionName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string definitionName

Database table name of the Custom Object Definition, e.g. 'y_equipment'.

CancellationToken cancellationToken
Returns
Type Description
Task<CustomObjectDefinition>

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

GetCustomObjectsIconsAsync(CancellationToken)

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

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<StringDictionary> GetCustomObjectsIconsAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<StringDictionary>

Map of table name to SVG icon data URI.

GetCustomObjectsMetadataAsync(CancellationToken)

Returns bootstrap metadata for all Custom Object tables.

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<CustomObjectMetadata[]> GetCustomObjectsMetadataAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task<CustomObjectMetadata[]>

Metadata for all custom object tables.

HasScreenChooserAsync(string, bool, CancellationToken)

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

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<bool> HasScreenChooserAsync(string definitionName, bool edit, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string definitionName

Database table name of the Custom Object Definition.

bool edit

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

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

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

SaveCustomObjectAsync(string, CustomObject, CancellationToken)

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

Experimental: The operation is experimental, subject to change, and not intended for partners.
Declaration
Task<CustomObject> SaveCustomObjectAsync(string definitionName, CustomObject row, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string definitionName

Database table name of the Custom Object Definition, e.g. 'y_equipment'.

CustomObject row

The Custom Object row to save.

CancellationToken cancellationToken
Returns
Type Description
Task<CustomObject>

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

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top