Interface IContactAgent
Interface for the Contact Agent Contact (company) data services.
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Contact Agent", "Interface for the Contact Agent. Contact (company) data services.")]
public interface IContactAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
Methods
AddPerson(Int32, PersonEntity)
Add a person to the given contact
Declaration
PersonEntity AddPerson(int contactId, PersonEntity newPersonEntity)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | Contact to add person to |
PersonEntity | newPersonEntity | Person object to add |
Returns
Type | Description |
---|---|
PersonEntity | Updated person object |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
ChangeCountry(ContactEntity, Int32)
Change country regenerates the default values and localized information such as phone number and address format
Declaration
ContactEntity ChangeCountry(ContactEntity contactEntity, int toCountryId)
Parameters
Type | Name | Description |
---|---|---|
ContactEntity | contactEntity | |
Int32 | toCountryId | The country to switch to |
Returns
Type | Description |
---|---|
ContactEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
Copy(Int32, String, String, Boolean)
Copy a contact. Activities and related data will be ignored
Declaration
int Copy(int sourceContactId, string destinationContactName, string destinationContactDepartment, bool copyPersons)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceContactId | The id of the contact to copy |
String | destinationContactName | The name of the destination contact |
String | destinationContactDepartment | The department of the destination contact |
Boolean | copyPersons | If true, persons will be copied from source contact |
Returns
Type | Description |
---|---|
Int32 | Id of copied contact |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
CreateDefaultContactEntity()
Loading default values into a new ContactEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
ContactEntity CreateDefaultContactEntity()
Returns
Type | Description |
---|---|
ContactEntity | New ContactEntity with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
CreateDefaultPreviewContact()
Loading default values into a new PreviewContact. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
PreviewContact CreateDefaultPreviewContact()
Returns
Type | Description |
---|---|
PreviewContact | New PreviewContact with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
CreateNewEntry(DuplicateEntry)
Creates a new contact based on external duplicate
Declaration
int CreateNewEntry(DuplicateEntry duplicate)
Parameters
Type | Name | Description |
---|---|---|
DuplicateEntry | duplicate | The duplicate to create a new entry based upon |
Returns
Type | Description |
---|---|
Int32 | The database identity of the newly created entry |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
DeleteContactEntity(Int32)
Deletes the ContactEntity
Declaration
void DeleteContactEntity(int contactEntityId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactEntityId | The identity of the ContactEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
DeleteExpired()
Trigger deletion of contacts (companies) that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).
Declaration
void DeleteExpired()
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetAddress(Int32)
Gets the contact's localized address.
Declaration
Address GetAddress(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The contact id |
Returns
Type | Description |
---|---|
Address | The address as LocalizedField[][]. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetAddressByCountry(Int32, Int32)
Gets the contact's localized address.
Declaration
Address GetAddressByCountry(int contactId, int countryId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The contact id |
Int32 | countryId |
Returns
Type | Description |
---|---|
Address | The address as LocalizedField[][]. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetContact(Int32)
Gets a Contact object.
Declaration
Contact GetContact(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The identifier of the Contact object |
Returns
Type | Description |
---|---|
Contact | Contact |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetContactEntity(Int32)
Gets a ContactEntity object.
Declaration
ContactEntity GetContactEntity(int contactEntityId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactEntityId | The identifier of the ContactEntity object |
Returns
Type | Description |
---|---|
ContactEntity | ContactEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetContactList(Int32[])
Gets an array of Contact objects.
Declaration
Contact[] GetContactList(int[] contactIds)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | contactIds | The identifiers of the Contact object |
Returns
Type | Description |
---|---|
Contact[] | Array of Contact objects |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetContactSummary(Int32, Int32)
Get summary of contact and its recent activity.
Declaration
ContactSummary GetContactSummary(int contactId, int limit)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The contact id to summarize. |
Int32 | limit | Max number of items to include in summary lists. |
Returns
Type | Description |
---|---|
ContactSummary | Summary of contact, with recent requests, sales, follow-ups, chats. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetContactWithPersons(Int32)
Returns the contact with all the contact persons belonging to the contact
Declaration
ContactEntity GetContactWithPersons(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The id of the contact. |
Returns
Type | Description |
---|---|
ContactEntity | ContactEntity with all data and persons. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetDomainDuplicates(String)
Get duplicates based on the domain
Declaration
DuplicateEntry[] GetDomainDuplicates(string domain)
Parameters
Type | Name | Description |
---|---|---|
String | domain | Domain used for lookup |
Returns
Type | Description |
---|---|
DuplicateEntry[] | Any records matching the specified domain |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetDuplicateRules()
Retrieve all available duplicate rules for contact
Declaration
DuplicateRule[] GetDuplicateRules()
Returns
Type | Description |
---|---|
DuplicateRule[] | All available duplicate rules |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetDuplicates(String)
Get duplicates (exact or similar in the database) based on the name
Declaration
DuplicateEntry[] GetDuplicates(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name used for lookup |
Returns
Type | Description |
---|---|
DuplicateEntry[] | Any records matching the specified name |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetMyActiveContacts(DateTime, Int32[], ContactAction)
Returns the contacts where there has been activity since activityStartTime. If activityStartTime is larger than the current date, all contacts with activity since last log-out are returned. The result set can be filtered by category and action type.
Declaration
ContactActivity[] GetMyActiveContacts(DateTime activityStartTime, int[] contactCategories, ContactAction actionType)
Parameters
Type | Name | Description |
---|---|---|
DateTime | activityStartTime | The start time of the activities. If the start time is set to a future date; activites since the user last logged out are returned. |
Int32[] | contactCategories | Integer array of categories to filter on. If the array is empty contacts from all categories will be selected. |
ContactAction | actionType | The type of action that has occured. E.g. updates, deletes, new appointments, etc. |
Returns
Type | Description |
---|---|
ContactActivity[] | Array of contacts where there have been activity in the period. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetMyBizCard()
Returns all data needed to display the logged on person's business card. That is company, person, and company interest data.
Declaration
ContactEntity GetMyBizCard()
Returns
Type | Description |
---|---|
ContactEntity | The contact object with persons and interests |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetMyContact()
Gets the contact belonging to the currently logged on user.
Declaration
ContactEntity GetMyContact()
Returns
Type | Description |
---|---|
ContactEntity | The Contact |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetMyContacts()
Getting the contacts where the user currently logged in is set as contact owner.
Declaration
Contact[] GetMyContacts()
Returns
Type | Description |
---|---|
Contact[] | Array of contacts |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetMyRecentContacts(ContactSourceType)
Method that returns a set of initial contacts. This could be the contacts in a favorites selection, the history list, the diary, or from all sources. If retrieved from the diary it will get appointments for the current and the next day.
Declaration
Contact[] GetMyRecentContacts(ContactSourceType sourceType)
Parameters
Type | Name | Description |
---|---|---|
ContactSourceType | sourceType | The source where the contacts are retrieved from (Favorites, History, Diary) |
Returns
Type | Description |
---|---|
Contact[] | Arrayof contacts |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetNameDepartmentDuplicates(String, String)
Get duplicates based on the contact name and department
Declaration
DuplicateEntry[] GetNameDepartmentDuplicates(string name, string department)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name used for lookup |
String | department | Department used for lookup (if any) |
Returns
Type | Description |
---|---|
DuplicateEntry[] | Any records matching the specified name and department |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetPersons(Int32)
Returns an array of all the contact persons for the company card.
Declaration
Person[] GetPersons(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId |
Returns
Type | Description |
---|---|
Person[] | Array of Persons |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetPreviewContact(Int32)
Get a contact from its ID
Declaration
PreviewContact GetPreviewContact(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | Contact ID |
Returns
Type | Description |
---|---|
PreviewContact | Contact minimal contact suitable for preview |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
GetQuoteVersionAddresses(Int32)
Get the associated billing and invoice quote version addresses. These addresses might be address on the contact, or a custom address.
Declaration
Address[] GetQuoteVersionAddresses(int quoteVersionId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | quoteVersionId | The version to get the addresses for. |
Returns
Type | Description |
---|---|
Address[] | The quote version addresses. Invoice and billing address, in that order. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
IsNumberValid(Int32, String)
Checks if the number is unique or required. The setting is configured from admin under system options.
Declaration
bool IsNumberValid(int contactId, string number)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | Primary key |
String | number | Number field value to check. |
Returns
Type | Description |
---|---|
Boolean | True if the number satisifies the configured rules for uniqueness. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
Merge(Int32, Int32, Boolean, Boolean)
Merge two contacts. The destination contact will remain.
Declaration
void Merge(int sourceContactId, int destinationContactId, bool mergeIdenticalPersons, bool replaceEmptyFieldsOnDestination)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourceContactId | Source contact to merge from. This contact will disappear after the merge. |
Int32 | destinationContactId | Destination contact to merge into |
Boolean | mergeIdenticalPersons | Persons with identical names will be merged |
Boolean | replaceEmptyFieldsOnDestination | If true, empty fields on destination will be replaced by values from source. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
SaveContactEntity(ContactEntity)
Updates the existing ContactEntity or creates a new ContactEntity if the id parameter is empty
Declaration
ContactEntity SaveContactEntity(ContactEntity contactEntity)
Parameters
Type | Name | Description |
---|---|---|
ContactEntity | contactEntity | The ContactEntity that is saved. |
Returns
Type | Description |
---|---|
ContactEntity | New or updated ContactEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
SaveQuoteVersionAddress(Int32, Address, AddressType, Int32)
Save a custom quote version address.
Declaration
Address SaveQuoteVersionAddress(int quoteVersionId, Address address, AddressType addressType, int countryId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | quoteVersionId | The version to save the address on. |
Address | address | The address to save on the quote version. |
AddressType | addressType | Should be either QuoteBillingAddress or QuoteShippingAddress |
Int32 | countryId | The country for the custom address |
Returns
Type | Description |
---|---|
Address | The saved addresses. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
SetDuplicateRulesStatus(DuplicateRule[])
Set which duplicate rules should be active or not
Declaration
void SetDuplicateRulesStatus(DuplicateRule[] rules)
Parameters
Type | Name | Description |
---|---|---|
DuplicateRule[] | rules | Duplicate rules to update active status for |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
Undelete(Int32)
This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
Declaration
void Undelete(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | The primary key of the entity to undelete |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}
ValidateContactEntity(ContactEntity)
Check that entity is ready for saving, return error messages by field.
Declaration
StringDictionary ValidateContactEntity(ContactEntity contactEntity)
Parameters
Type | Name | Description |
---|---|---|
ContactEntity | contactEntity | Entity to be checked for errors. |
Returns
Type | Description |
---|---|
StringDictionary | Error messages tagged by field. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (ContactAgent agent = new ContactAgent())
{
// call methods on agent here...
}
}