Table of Contents

Class Dispatch

Namespace
Sage.CRM.Utils
Assembly
SageCRMNet.dll

Use this for controlling database transactions and locks. Also gives access to Cookies, Content and Query fields.
Dispatch

public class Dispatch
Inheritance
Dispatch
Inherited Members

Properties

DatabaseName

Returns the name of the database for this install (readonly).

public string DatabaseName { get; }

Property Value

string

Host

Returns the name of the web server on which the CRM install is running (readonly).

public string Host { get; }

Property Value

string

InstallName

Returns the name of the current install (readonly).

public string InstallName { get; }

Property Value

string

TabGroupName

Returns the TabGroupName for the current context.

public string TabGroupName { get; }

Property Value

string

Version

Returns the current version of the CRM being used (readonly).

public string Version { get; }

Property Value

string

Methods

Commit()

Commits the current transation. StartTransaction must have been called previously.

public void Commit()

ContentField(string)

Gets the value of a field from the content fields.

public string ContentField(string fieldName)

Parameters

fieldName string

Name of field whose value to retrieve.

Returns

string

The value of the field from the Content fields. Returns a blank string if the field does not exist or if the value is blank.

ContentFields()

Get all values in the content request.

public List<KeyValuePair<string, string>> ContentFields()

Returns

List<KeyValuePair<string, string>>

List with key value pair of all items in the content

ContentFieldValues(string)

Gets all values of a multi-select field.

public List<string> ContentFieldValues(string fieldName)

Parameters

fieldName string

Name of field whose values to retrieve

Returns

List<string>

String list with the values of the field. If --None-- or Blank option is selected the list will contain an empty item. The list will have size 0 only if no option is selected.

EitherField(string)

Gets the value of the specified field from either the content fields or the query fields. Queryfields are checked first, if there is no value there then the content fields are checked.

public string EitherField(string fieldName)

Parameters

fieldName string

The name of the field whose value to retrieve.

Returns

string

The value of the field from either the Query fields or the Content fields.

FreeLocks()

Release any locks held by the current user. This means locks held in the CRM Locks table that may have been added by a call to GetLock().

public void FreeLocks()

GetCookieValue(string)

Returns the value of the specified cookie.

public string GetCookieValue(string cookieName)

Parameters

cookieName string

The name of the cookie whose value to retrieve.

Returns

string

The value of that cookie.

GetLock(string, int)

Creates a lock for a user on the specified record in specified table. This will ensure that no other user can update the same record. This adds a record to the CRM Locks table. When the updates are completed, the lock should be freed using the FreeLocks() method.

public string GetLock(string tableName, int recordId)

Parameters

tableName string

The table caption for the table being altered.

recordId int

The id of the row in the table being altered.

Returns

string

A blank string if successful, otherwise an error message. GetLock will fail if another user currently has the same record locked.

QueryField(string)

Gets the value from the query fields for the specified fieldname.

public string QueryField(string fieldName)

Parameters

fieldName string

The name of the field whose value to retrieve.

Returns

string

The value of the given field in the Query fields. Value will be blank if the field does not exist or if it is blank.

QueryFields()

Get all values in the query request.

public List<KeyValuePair<string, string>> QueryFields()

Returns

List<KeyValuePair<string, string>>

List with key value pair of all items in the query

Redirect(string)

Redirect to the given URL.

public void Redirect(string url)

Parameters

url string

URL to redirect to.

Rollback()

Rollback the current transaction. StartTransaction must have been called previously to start the transaction.

public void Rollback()

ServerVariable(string)

Creates a value from Request.ServerVariables list.

public string ServerVariable(string variableName)

Parameters

variableName string

The name of the variable to retrieve.

Returns

string

The value of the given variable.

SetCookieValue(string, string)

Saves a value into the specified cookie.

public void SetCookieValue(string cookieName, string value)

Parameters

cookieName string

The name of the cookie to update.

value string

The value to save in the given cookie name.

StartTransaction()

Starts a new transaction on the database. Transactions must be commited or rolled back, using Commit() or Rollback() methods.

public void StartTransaction()