Class PersonAgent
Facade for the Person Agent Person data services.
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
public class PersonAgent : AgentBase<IPersonAgent>, IDisposable, IPersonAgent, IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
Constructors
PersonAgent()
Facade for the Person Agent Person data services.
Declaration
public PersonAgent()
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
Methods
AddBounce(String)
Add a bounce count on the email address if it exists
Declaration
public void AddBounce(string emailAddress)
Parameters
Type | Name | Description |
---|---|---|
String | emailAddress | The email address which we want to add a bounce count to |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
AddBounceWithCount(String, Int32)
Add a number of bounce counts on the email address if it exists
Declaration
public void AddBounceWithCount(string emailAddress, int counts)
Parameters
Type | Name | Description |
---|---|---|
String | emailAddress | The email address which we want to add bounce counts to |
Int32 | counts | The number of bounce counts to add |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
AddBounceWithDetails(String, Int32, Int32, String)
Add a number of bounce counts on the email address if it exists, and with possible bounce code and reason
Declaration
public void AddBounceWithDetails(string emailAddress, int counts, int code, string reason)
Parameters
Type | Name | Description |
---|---|---|
String | emailAddress | The email address which we want to add bounce counts to |
Int32 | counts | The number of bounce counts to add |
Int32 | code | A numeric code representing the bounce reason |
String | reason | A textual tag representing the bounce reason |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
AddEmailAddressToPerson(Int32, String, Boolean)
Sets the primary email address on person, possibly re-ranking email addresses accordingly.
Declaration
public void AddEmailAddressToPerson(int personId, string emailAddress, bool setAsPrimaryEmail)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | Person id of the person |
String | emailAddress | The email address to set as primary email address |
Boolean | setAsPrimaryEmail | True if the address shall be primary email address (have rank == 1) |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
ChangeCountry(PersonEntity, Int32)
Change country regenerates the default values and localized information such as phone number and address format for this entity.
Declaration
public PersonEntity ChangeCountry(PersonEntity personEntity, int toCountryId)
Parameters
Type | Name | Description |
---|---|---|
PersonEntity | personEntity | The PersonEntity to change country on |
Int32 | toCountryId | The country to switch to |
Returns
Type | Description |
---|---|
PersonEntity | The PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
ChangePersonRank(Int32, Boolean)
Move one person up or down in the ranking in the Person Archive, if possible.<para/>The person record that has rank = 1 is the primary contact for a company, and is the one used in situations where no person has been explicitly chosen (such as in selections).<para/>This method corresponds to the move up/move down functions in the person archive in the contact panel.<para/>This method always affects two records.
Declaration
public int ChangePersonRank(int personId, bool moveUp)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | Primary key of person record to move up or down. You must have write access both to this record AND to whatever record is adjacent in the direction you want to move. |
Boolean | moveUp | If true, the given person is moved to an earlier rank (lower numeric rank value, down to a limit of 1; up in the GUI if sorted by ascending rank). If false, movement is to later priority (higher numeric rank value). |
Returns
Type | Description |
---|---|
Int32 | If movement occurred, the return value will be the ID of the OTHER person that got moved. A GUI should switch the positions of the original person ID and this return value.<para/>If no movement occurred, for any reason, 0 is returned. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CheckTemporaryKey(String)
Check a temporary key for validity, and in case it is valid, return its domain, targetId and personId
Declaration
public TemporaryKeyInfo CheckTemporaryKey(string temporaryKey)
Parameters
Type | Name | Description |
---|---|---|
String | temporaryKey | The base64 encoded key value, as returned by CreateTemporaryKey |
Returns
Type | Description |
---|---|
TemporaryKeyInfo | The info about the temporary key. Domain will be Unknown if key is not valid. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateDefaultByContactId(Int32)
Creates a PersonEntity with default values based on the contactId.
Declaration
public PersonEntity CreateDefaultByContactId(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | Contact id of the person |
Returns
Type | Description |
---|---|
PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateDefaultConsentPerson()
Loading default values into a new ConsentPerson. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public ConsentPerson CreateDefaultConsentPerson()
Returns
Type | Description |
---|---|
ConsentPerson | New ConsentPerson with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateDefaultFromCredential(Int32, String, String, String)
Creates a PersonEntity with default values based on the contactId and credentials.
Declaration
public PersonEntity CreateDefaultFromCredential(int contactId, string credentialType, string credentialValue, string credentialDisplayValue)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | Contact id of the person |
String | credentialType | Type of credentials, corresponding to name of plugin and type in the credentials table. |
String | credentialValue | This is the actuall value of the credentials. This will typically be the password or teh users SID in active directory |
String | credentialDisplayValue | The value displayed to the user. this will typically be the users login name in active directory. |
Returns
Type | Description |
---|---|
PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateDefaultPersonEntity()
Loading default values into a new PersonEntity. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public PersonEntity CreateDefaultPersonEntity()
Returns
Type | Description |
---|---|
PersonEntity | New PersonEntity with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateDefaultPersonImage()
Loading default values into a new PersonImage. NetServer calculates default values (e.g. Country) on the entity, which is required when creating/storing a new instance
Declaration
public PersonImage CreateDefaultPersonImage()
Returns
Type | Description |
---|---|
PersonImage | New PersonImage with default values |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateOrUpdateUserCandidate(Int32, String, Boolean)
Creates a Customer Centre User (UserCandidate) for a given Contact (personId) with the supplied parameters. If the Customer Centre User already exists for a given Contact, the user is updated with the supplied parameters.
Declaration
public UserCandidate CreateOrUpdateUserCandidate(int personId, string username, bool accessAllRequests)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | Person to create UserCandidate for. |
String | username | Desired username. Username must be unique. If the username is not unique, method will throw an error. |
Boolean | accessAllRequests | Determines if Custom Center User has access to all requests created for all Contacts in the company. |
Returns
Type | Description |
---|---|
UserCandidate | UserCandidate created or updated. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateTemporaryKey(TemporaryKeyDomain, Int32, Int32, DateTime)
Create a temporary key in the database from the given parameters and return the key string. Used for temporary keys for accessing customer centric functionality, such as UpdateSubscriptions.
Declaration
public string CreateTemporaryKey(TemporaryKeyDomain domain, int targetId, int personId, DateTime expires)
Parameters
Type | Name | Description |
---|---|---|
TemporaryKeyDomain | domain | The domain this key is for |
Int32 | targetId | The primary key of the entity this is for. Depends on domain. |
Int32 | personId | The person this key is for. May be null. |
DateTime | expires | When the key will expire (servers local time) |
Returns
Type | Description |
---|---|
String | The key as base64, ready to be used e.g. in a URL |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
CreateTemporaryKeyWithPayload(TemporaryKeyDomain, Int32, Int32, DateTime, String)
Create a temporary key in the database from the given parameters and return the key string. Used for temporary keys for accessing customer centric functionality, such as UpdateSubscriptions.
Declaration
public string CreateTemporaryKeyWithPayload(TemporaryKeyDomain domain, int targetId, int personId, DateTime expires, string payload)
Parameters
Type | Name | Description |
---|---|---|
TemporaryKeyDomain | domain | The domain this key is for |
Int32 | targetId | The primary key of the entity this is for. Depends on domain. |
Int32 | personId | The person this key is for. May be null. |
DateTime | expires | When the key will expire (servers local time) |
String | payload | The payload for the temporary key |
Returns
Type | Description |
---|---|
String | The key as base64, ready to be used e.g. in a URL |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
DeleteConsentPerson(Int32)
Deletes the ConsentPerson
Declaration
public void DeleteConsentPerson(int consentPersonId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | consentPersonId | The identity of the ConsentPerson |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
DeleteExpired()
Trigger deletion of persons that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).
Declaration
public void DeleteExpired()
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
DeletePersonEntity(Int32)
Deletes the PersonEntity
Declaration
public void DeletePersonEntity(int personEntityId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personEntityId | The identity of the PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
DeleteTemporaryKeysOfDomain(TemporaryKeyDomain, Int32)
Delete all temporary keys for a given domain and person
Declaration
public void DeleteTemporaryKeysOfDomain(TemporaryKeyDomain domain, int personId)
Parameters
Type | Name | Description |
---|---|---|
TemporaryKeyDomain | domain | The domain type to delete |
Int32 | personId | The person for which to delete the keys |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetAddress(Int32)
Gets the person's localized address.
Declaration
public Address GetAddress(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id |
Returns
Type | Description |
---|---|
Address | The address as LocalizedField[][]. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetAddressByCountry(Int32, Int32)
Gets the person's localized address.
Declaration
public Address GetAddressByCountry(int personId, int countryId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person 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 (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetBestSoLanguageForTemplate(Int32, Int32)
Get the best language for this person on this template
Declaration
public string GetBestSoLanguageForTemplate(int personId, int templateId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The id of the person |
Int32 | templateId | The id of the template to find languages on |
Returns
Type | Description |
---|---|
String | The solang code for best language, empty string if no best language found |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetColleagues()
Gets the persons working in the same company as the logged on user.
Declaration
public Person[] GetColleagues()
Returns
Type | Description |
---|---|
Person[] | Colleagues. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetColleaguesByDepartment(Int32)
Gets the persons working in a specific department in the same company as the logged on user. Departments can be retrieved with the PhoneList.DepartmentList service.
Declaration
public Person[] GetColleaguesByDepartment(int departmentId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | departmentId | The department id. |
Returns
Type | Description |
---|---|
Person[] | PersonList with colleagues. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetColleaguesBySource(AssociateSourceType, Int32)
Gets the persons working in the same company as the logged on user. The list of person could be retrieved from the history list, the diary view list, or from all sources.
Declaration
public Person[] GetColleaguesBySource(AssociateSourceType sourceType, int count)
Parameters
Type | Name | Description |
---|---|---|
AssociateSourceType | sourceType | The “source” the colleagues should be retrieved from. <see cref="AssociateSourceType"/> for more information. |
Int32 | count |
Returns
Type | Description |
---|---|
Person[] | Colleagues. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetConsentInfos(Int32)
Get all consent information for a given person. May include withdrawn consents (check
Declaration
public ConsentInfo[] GetConsentInfos(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id to get consents for |
Returns
Type | Description |
---|---|
ConsentInfo[] | List of consents recorded on this person |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetConsentPerson(Int32)
Gets a ConsentPerson object.
Declaration
public ConsentPerson GetConsentPerson(int consentPersonId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | consentPersonId | The identifier of the ConsentPerson object |
Returns
Type | Description |
---|---|
ConsentPerson | ConsentPerson |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetCustomerCentrePasswordReplyTemplate(Int32)
Gets a parsed Customer Centre password reply template for a particular customer
Declaration
public ReplyTemplateParsed GetCustomerCentrePasswordReplyTemplate(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | Person/customer id to get the template for. |
Returns
Type | Description |
---|---|
ReplyTemplateParsed | A parsed Customer Centre password reply template. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetMyOwner()
Get the owner of the logged in person.
Declaration
public Person GetMyOwner()
Returns
Type | Description |
---|---|
Person | Person |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetMyPerson()
Gets the person info belonging to the currently logged on user.
Declaration
public PersonEntity GetMyPerson()
Returns
Type | Description |
---|---|
PersonEntity | The PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetOwnerOnPersonId(Int32)
Get the owner of the person by id.
Declaration
public Person GetOwnerOnPersonId(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId |
Returns
Type | Description |
---|---|
Person | Person |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPerson(Int32)
Gets a Person object.
Declaration
public Person GetPerson(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The identifier of the Person object |
Returns
Type | Description |
---|---|
Person | Person |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonEntity(Int32)
Gets a PersonEntity object.
Declaration
public PersonEntity GetPersonEntity(int personEntityId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personEntityId | The identifier of the PersonEntity object |
Returns
Type | Description |
---|---|
PersonEntity | PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonImage(Int32)
Returns the person image that is displayed in the CRM application.
Declaration
public Image GetPersonImage(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id of the person the image belongs to. |
Returns
Type | Description |
---|---|
Image | The image as a System.Drawing.Image. (If the the image is returned over webservices, the stream is returned as a Base64 encoded string.) |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonImages(Int32[], Int32, Int32)
Get the image for a set of persons scaled to a specific size. Returned images are in PNG format.
Declaration
public PersonImage[] GetPersonImages(int[] personIds, int scaledWidth, int scaledHeight)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | personIds | List of persons to get images for. |
Int32 | scaledWidth | Returned images are scaled to this width |
Int32 | scaledHeight | Returned images are scaled to this height |
Returns
Type | Description |
---|---|
PersonImage[] | List of person images. Persons without an image are not present in this list. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonList(Int32[])
Gets an array of Person objects.
Declaration
public Person[] GetPersonList(int[] personIds)
Parameters
Type | Name | Description |
---|---|---|
Int32[] | personIds | The identifiers of the Person object |
Returns
Type | Description |
---|---|
Person[] | Array of Person objects |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonsFromContact(Int32)
Returns all the persons belonging to a contact.
Declaration
public Person[] GetPersonsFromContact(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The project id |
Returns
Type | Description |
---|---|
Person[] | The persons belonging to a contact. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonsFromProject(Int32)
Returns all the persons belonging to a project.
Declaration
public Person[] GetPersonsFromProject(int projectId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | projectId | The project id |
Returns
Type | Description |
---|---|
Person[] | The persons belonging to a project. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPersonSummary(Int32, Int32)
Get summary of person and recent activity.
Declaration
public PersonSummary GetPersonSummary(int personId, int limit)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id to summarize. |
Int32 | limit | Max number of items to include in summary lists. |
Returns
Type | Description |
---|---|
PersonSummary | Summary of person, with recent requests, sales, follow-ups, chats. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetPhones(Int32)
Returning all phones that belong to a person, ordered by the phone type.
Declaration
public EntityElement[] GetPhones(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id |
Returns
Type | Description |
---|---|
EntityElement[] | An array of Phones |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetSalesRep(String, String, String, String, String)
Returns the sales representative for an external user. If this method is accessed with anonymous authentication the external user is recognized by contact and name, or by email, or phone number. If the external user is recognized as an CRM5 user (internal or external) the input fields can be left blank.
Declaration
public PersonEntity GetSalesRep(string contactName, string personFirstname, string personLastname, string emailAddress, string phoneNumber)
Parameters
Type | Name | Description |
---|---|---|
String | contactName | The company name of the person requesting his sales representative. May be empty if email or phone is provided. |
String | personFirstname | The firstname of the person requesting his sales representative. May be empty if email or phone is provided. |
String | personLastname | The lastname of the person requesting his sales representative. May be empty if email or phone is provided. |
String | emailAddress | The email address of the person requesting his sales representative. May be empty if phone, or contact and person name is provided. |
String | phoneNumber | The phone number of the person requesting his sales representative. May be empty if email, or contact and person name is provided. |
Returns
Type | Description |
---|---|
PersonEntity | The PersonEntity of the sales rep. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
GetUserCandidateByPerson(Int32)
Gets user candidate linked to a person.
Declaration
public UserCandidate GetUserCandidateByPerson(int personId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | Person related to requested UserCandidate. |
Returns
Type | Description |
---|---|
UserCandidate | UserCandidate linked to a person. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
HasConsent(Int32, String)
Check if consent has been given by a specified person, for a specific purpose. Withdraw consents return FALSE.
Declaration
public bool HasConsent(int personId, string purpose)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id |
String | purpose | The key of the purpose to check. (e.g. 'STORE' or 'EMARKETING') |
Returns
Type | Description |
---|---|
Boolean | True if the person has consented to the given purpose. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// 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
public bool IsNumberValid(int contactId, string number)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | |
String | number | Number to check. |
Returns
Type | Description |
---|---|
Boolean | True if number is ok (passes uniqueness/required checks) |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
Merge(Int32, Int32, DateTime, Boolean, Boolean)
Merge two persons. The destination person will remain. You must specify the date after which activities will be moved along with the person.
Declaration
public void Merge(int sourcePersonId, int destinationPersonId, DateTime moveAfterDate, bool deleteSource, bool replaceEmptyFieldsOnDestination)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sourcePersonId | The identifier for the person which will be merged into the destination person. The source person is deleted/marked retired after the merge. |
Int32 | destinationPersonId | The identifier for the person which will remain after the merge. The target person is updated. |
DateTime | moveAfterDate | Merge activites after this date. Activities before this date are left alone. |
Boolean | deleteSource | If true, the source person will be deleted after the merge. If false, it will have its retired flag set |
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 (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
Move(Int32, Int32, DateTime)
Move a person to a specified contact. You must specify the date after which activities will be moved along with the person.
Declaration
public void Move(int personId, int destinationContactId, DateTime moveAfterDate)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The identifier for the person |
Int32 | destinationContactId | The identifier for the contact which the person will be moved to |
DateTime | moveAfterDate | Move activites after this date. Activities before this date are left alone. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
NormalizeRanks(Int32)
Nomralize the ranks for all persons that belong to a contact. This means that the persons will be sorted according to their current rank values, and the ranks will be made monotonically increasing from 1.
Declaration
public bool NormalizeRanks(int contactId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | Id of contact whose persons are to be rank normalized |
Returns
Type | Description |
---|---|
Boolean | The reutrn value is true if the operation suceeded, either because all persons were already normalized, or because normalization was done. It is false if Sentry blocks any required changes. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
RemoveConsent(Int32, String)
Turn off consent for a specified person and purpose.
Declaration
public void RemoveConsent(int personId, string purpose)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id |
String | purpose | The key of the purpose to remove. (e.g. 'STORE' or 'EMARKETING') |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
ResolvePersonFromInfo(Int32, String, String[], String[])
Get a person from the provided information. If the person does not exist, it will be created on demand.
Declaration
public ResolvedPerson ResolvePersonFromInfo(int contactId, string personName, string[] phoneNumbers, string[] emails)
Parameters
Type | Name | Description |
---|---|---|
Int32 | contactId | The contact Id of the contact which the person belongs to. Cannot be 0. |
String | personName | The full name of the person to be resolved. Optional. |
String[] | phoneNumbers | Phone numbers registered on the person. Optional. |
String[] | emails | Email-addresses registered on the person. Optional. |
Returns
Type | Description |
---|---|
ResolvedPerson | The results of the resolve-operation. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SaveConsentPerson(ConsentPerson)
Updates the existing ConsentPerson or creates a new ConsentPerson if the id parameter is empty
Declaration
public ConsentPerson SaveConsentPerson(ConsentPerson consentPerson)
Parameters
Type | Name | Description |
---|---|---|
ConsentPerson | consentPerson | The ConsentPerson that is saved. |
Returns
Type | Description |
---|---|
ConsentPerson | New or updated ConsentPerson |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SavePersonEntity(PersonEntity)
Updates the existing PersonEntity or creates a new PersonEntity if the id parameter is empty
Declaration
public PersonEntity SavePersonEntity(PersonEntity personEntity)
Parameters
Type | Name | Description |
---|---|---|
PersonEntity | personEntity | The PersonEntity that is saved. |
Returns
Type | Description |
---|---|
PersonEntity | New or updated PersonEntity |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SendConsentConfirmationEmail(Int32, String, Int32, Int32, String)
Send confirmation email to the provided person, email address (id), using the document template
Declaration
public void SendConsentConfirmationEmail(int personId, string emailAddress, int emailTemplateId, int cultureLcidId, string subject)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id |
String | emailAddress | The email address to send to. |
Int32 | emailTemplateId | The id of the email template (doctmpl_id) |
Int32 | cultureLcidId | The id of the culture (LCID) |
String | subject | Optional email subject |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SendEmail(String, String, String, String, String, Int32[])
Inserts into outbox an email with specified details.
Declaration
public void SendEmail(string from, string to, string subject, string plainBody, string htmlBody, int[] attachmentIds)
Parameters
Type | Name | Description |
---|---|---|
String | from | Sender's email address. |
String | to | Recipient's email address. |
String | subject | Email's subject. |
String | plainBody | Email's plain body. |
String | htmlBody | Email's html body. |
Int32[] | attachmentIds | Ids of email's attachments. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SendEmailWithEventName(String, String, String, String, String, Int32[], String)
Inserts into outbox an email with specified details and event name.
Declaration
public void SendEmailWithEventName(string from, string to, string subject, string plainBody, string htmlBody, int[] attachmentIds, string eventName)
Parameters
Type | Name | Description |
---|---|---|
String | from | Sender's email address. |
String | to | Recipient's email address. |
String | subject | Email's subject. |
String | plainBody | Email's plain body. |
String | htmlBody | Email's html body. |
Int32[] | attachmentIds | Ids of email's attachments. |
String | eventName | Event name passed to outbound email trigger |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SetConsent(Int32, String, String, String, String)
Set a specified type of consent on the person.
Declaration
public void SetConsent(int personId, string purpose, string source, string legalBase, string comment)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id |
String | purpose | The Key of the purpose this affects. e.g. 'STORE' or 'EMARKETING'. |
String | source | The Key of the source of this consent. e.g. 'USER', 'WEBFORM' or 'API'. |
String | legalBase | The Key of the legal base for this consent. e.g. '61A', '61B', '61F' |
String | comment | A comment regarding this consent. May be null or empty. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SetPersonImage(Int32, Image)
Stores the person image that is displayed in the CRM application.
Declaration
public void SetPersonImage(int personId, Image image)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | The person id of the person the image belongs to. |
Image | image | The image that is stored on the person (System.Drawing.Image) |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
SetPersonRank(Int32, Int16)
Directly set the rank field of a person record, adjusting all other person records under the same contact as needed.<para/>This call may affect multiple records, potentially all person records belonging to one contact.<para/>You must have write access for to affected records for this method to succeed.
Declaration
public bool SetPersonRank(int personId, short desiredRank)
Parameters
Type | Name | Description |
---|---|---|
Int32 | personId | Id of person to change |
Int16 | desiredRank | Desired rank to set, legal values are from 1 to the number of person records on this contact. Out of range values will be moved to the closest valid value and processed. |
Returns
Type | Description |
---|---|
Boolean | If movement occurred, or the person already had exactly the desired rank value, then the return value will be true. If movement did not occur, for any other reason, the return value is false. |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
TryAddPersonsToEmailFlow(Int32, Int32[])
Try to add a participant to the EmailFlow, Same function available in WorkflowAgent
Declaration
public bool[] TryAddPersonsToEmailFlow(int emailFlowId, int[] personIds)
Parameters
Type | Name | Description |
---|---|---|
Int32 | emailFlowId | Primary key of EmailFlow |
Int32[] | personIds | Array of Person Ids |
Returns
Type | Description |
---|---|
Boolean[] | True if the corresponding participant was successfully added, false if it could not be added because of filter criteria or other reason |
Examples
using SuperOffice;
using SuperOffice.CRM.Services;
using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
using (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
Undelete(Int32)
This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
Declaration
public 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 (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}
ValidatePersonEntity(PersonEntity)
Check that entity is ready for saving, return error messages by field.
Declaration
public StringDictionary ValidatePersonEntity(PersonEntity personEntity)
Parameters
Type | Name | Description |
---|---|---|
PersonEntity | personEntity | 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 (PersonAgent agent = new PersonAgent())
{
// call methods on agent here...
}
}