Skip to content
JonSaffron edited this page Oct 15, 2014 · 7 revisions

How to use the library to run a 3e process

First, create a new Process object. The first parameter is the name of custom 3e Process, and the second is the name of the 3e Object being manipulated. For example:

var p = new Process("WsMatter", "Matter");

Add, Edit or Delete

You then need to specify the operation to perform. To insert a new record, use:

var op = p.AddOperation();

To update or delete a record you need to specify which record. The first way is to pass in the primary key value which will be either a string, an integer, or a guid:

var op = p.EditOperation(12345);

Some archetypes in 3e like Matter, Client, Timekeeper, and BankAcct have an alias property which you can use as an alternative identifier. You should specify the name of the alias column, and the alias value itself will always be a string:

var op = p.EditOperationByAlias("Number", "LS1000.00001");

You can also select a record by its position:

p.DeleteOperationByPosition(0);

though this option is more useful when a child record needs to be updated.

A delete operation will delete the specified record, plus any and all related child records as defined by the definition of the 3e Object.

You can perform more than one operation within the same call to the process by simply adding additional Add, Edit or Delete operations.

Set attribute values

For add and edit operations you need to specify the new attribute values:

op.AddAttribute("Description", "A new matter");

Attributes are defined by the 3e object rather than the archetype and so may include items that have no physical presence in the database:

op.AddAttribute("IsAutoNumbering", true);

You can, as before, specify values using an alias property:

op.AddAttribute("Client", "Number", "LS1000");

You can pass in a null value for a integer, decimal or datetime:

decimal? budgetAmount = null; op.AddAttribute("Budget", budgetAmount);

Just like inserting or updating a record in a database, you must ensure that no attributes on the object that are marked as required are left unset. That means for an add operation, you must add at least all the attributes that are marked required (and give them non-null values). You do not need to add attributes that are marked AutoNumber. For an edit operation you can add as many or as few attributes as you like, but no required attribute must be set to a null value.

Children

Many objects, like Matter, have one or more children and you can update values in these children at the same time.

Clone this wiki locally