Interface IPersonAgent
Interface for the Person Agent Person data services.
Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Person Agent", "Interface for the Person Agent. Person data services.")]
public interface 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...
}
}
Methods
AddBounceAsync(string, CancellationToken)
Add a bounce count on the email address if it exists
Declaration
Task AddBounceAsync(string emailAddress, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | emailAddress | The email address which we want to add a bounce count to |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
AddBounceWithCountAsync(string, int, CancellationToken)
Add a number of bounce counts on the email address if it exists
Declaration
Task AddBounceWithCountAsync(string emailAddress, int counts, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | emailAddress | The email address which we want to add bounce counts to |
| int | counts | The number of bounce counts to add |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
AddBounceWithDetailsAsync(string, int, int, string, CancellationToken)
Add a number of bounce counts on the email address if it exists, and with possible bounce code and reason
Declaration
Task AddBounceWithDetailsAsync(string emailAddress, int counts, int code, string reason, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | emailAddress | The email address which we want to add bounce counts to |
| int | counts | The number of bounce counts to add |
| int | code | A numeric code representing the bounce reason |
| string | reason | A textual tag representing the bounce reason |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
AddEmailAddressToPersonAsync(int, string, bool, CancellationToken)
Sets the primary email address on person, possibly re-ranking email addresses accordingly.
Declaration
Task AddEmailAddressToPersonAsync(int personId, string emailAddress, bool setAsPrimaryEmail, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | Person id of the person |
| string | emailAddress | The email address to set as primary email address |
| bool | setAsPrimaryEmail | True if the address shall be primary email address (have rank == 1) |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ChangeCountryAsync(PersonEntity, int, CancellationToken)
Change country regenerates the default values and localized information such as phone number and address format for this entity.
Declaration
Task<PersonEntity> ChangeCountryAsync(PersonEntity personEntity, int toCountryId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| PersonEntity | personEntity | The PersonEntity to change country on |
| int | toCountryId | The country to switch to |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> | The PersonEntity |
ChangePersonRankAsync(int, bool, CancellationToken)
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
Task<int> ChangePersonRankAsync(int personId, bool moveUp, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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. |
| bool | 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). |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<int> | 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. |
CheckTemporaryKeyAsync(string, CancellationToken)
Check a temporary key for validity, and in case it is valid, return its domain, targetId and personId
Declaration
Task<TemporaryKeyInfo> CheckTemporaryKeyAsync(string temporaryKey, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | temporaryKey | The base64 encoded key value, as returned by CreateTemporaryKey |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TemporaryKeyInfo> | The info about the temporary key. Domain will be Unknown if key is not valid. |
CreateDefaultByContactIdAsync(int, CancellationToken)
Creates a PersonEntity with default values based on the contactId.
Declaration
Task<PersonEntity> CreateDefaultByContactIdAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | Contact id of the person |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> |
CreateDefaultConsentPersonAsync(CancellationToken)
Loading default values into a new ConsentPerson.
Declaration
Task<ConsentPerson> CreateDefaultConsentPersonAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ConsentPerson> | New ConsentPerson with default values |
CreateDefaultFromCredentialAsync(int, string, string, string, CancellationToken)
Creates a PersonEntity with default values based on the contactId and credentials.
Declaration
Task<PersonEntity> CreateDefaultFromCredentialAsync(int contactId, string credentialType, string credentialValue, string credentialDisplayValue, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> |
CreateDefaultPersonEntityAsync(CancellationToken)
Loading default values into a new PersonEntity.
Declaration
Task<PersonEntity> CreateDefaultPersonEntityAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> | New PersonEntity with default values |
CreateDefaultPersonImageAsync(CancellationToken)
Loading default values into a new PersonImage.
Declaration
Task<PersonImage> CreateDefaultPersonImageAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonImage> | New PersonImage with default values |
CreateOrUpdateUserCandidateAsync(int, string, bool, CancellationToken)
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
Task<UserCandidate> CreateOrUpdateUserCandidateAsync(int personId, string username, bool accessAllRequests, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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. |
| bool | accessAllRequests | Determines if Custom Center User has access to all requests created for all Contacts in the company. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<UserCandidate> | UserCandidate created or updated. |
CreateTemporaryKeyAsync(TemporaryKeyDomain, int, int, DateTime, CancellationToken)
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
Task<string> CreateTemporaryKeyAsync(TemporaryKeyDomain domain, int targetId, int personId, DateTime expires, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TemporaryKeyDomain | domain | The domain this key is for |
| int | targetId | The primary key of the entity this is for. Depends on domain. |
| int | personId | The person this key is for. May be null. |
| DateTime | expires | When the key will expire (servers local time) |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string> | The key as base64, ready to be used e.g. in a URL |
CreateTemporaryKeyWithPayloadAsync(TemporaryKeyDomain, int, int, DateTime, string, CancellationToken)
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
Task<string> CreateTemporaryKeyWithPayloadAsync(TemporaryKeyDomain domain, int targetId, int personId, DateTime expires, string payload, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TemporaryKeyDomain | domain | The domain this key is for |
| int | targetId | The primary key of the entity this is for. Depends on domain. |
| int | 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 |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string> | The key as base64, ready to be used e.g. in a URL |
DeleteConsentPersonAsync(int, CancellationToken)
Deletes the ConsentPerson
Declaration
Task DeleteConsentPersonAsync(int consentPersonId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | consentPersonId | The identity of the ConsentPerson |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteExpiredAsync(CancellationToken)
Trigger deletion of persons that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).
Declaration
Task DeleteExpiredAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
DeletePersonEntityAsync(int, CancellationToken)
Deletes the PersonEntity. This table supports Soft Delete; records will be marked as deleted and disappear from the GUI and API results, but will not be physically deleted by this (and any other) method.
Declaration
Task DeletePersonEntityAsync(int personEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personEntityId | The identity of the PersonEntity |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
DeleteTemporaryKeysOfDomainAsync(TemporaryKeyDomain, int, CancellationToken)
Delete all temporary keys for a given domain and person
Declaration
Task DeleteTemporaryKeysOfDomainAsync(TemporaryKeyDomain domain, int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TemporaryKeyDomain | domain | The domain type to delete |
| int | personId | The person for which to delete the keys |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
GetAddressAsync(int, CancellationToken)
Gets the person's localized address.
Declaration
Task<Address> GetAddressAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Address> | The address as LocalizedField[][]. |
GetAddressByCountryAsync(int, int, CancellationToken)
Gets the person's localized address.
Declaration
Task<Address> GetAddressByCountryAsync(int personId, int countryId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id |
| int | countryId | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Address> | The address as LocalizedField[][]. |
GetBestSoLanguageForTemplateAsync(int, int, CancellationToken)
Get the best language for this person on this template
Declaration
Task<string> GetBestSoLanguageForTemplateAsync(int personId, int templateId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The id of the person |
| int | templateId | The id of the template to find languages on |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<string> | The solang code for best language, empty string if no best language found |
GetColleaguesAsync(CancellationToken)
Gets the persons working in the same company as the logged on user.
Declaration
Task<Person[]> GetColleaguesAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person[]> | Colleagues. |
GetColleaguesByDepartmentAsync(int, CancellationToken)
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
Task<Person[]> GetColleaguesByDepartmentAsync(int departmentId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | departmentId | The department id. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person[]> | PersonList with colleagues. |
GetColleaguesBySourceAsync(AssociateSourceType, int, CancellationToken)
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
Task<Person[]> GetColleaguesBySourceAsync(AssociateSourceType sourceType, int count, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| AssociateSourceType | sourceType | The “source” the colleagues should be retrieved from. <see cref="AssociateSourceType"/> for more information. |
| int | count | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person[]> | Colleagues. |
GetConsentInfosAsync(int, CancellationToken)
Get all consent information for a given person. May include withdrawn consents (check
Declaration
Task<ConsentInfo[]> GetConsentInfosAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id to get consents for |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ConsentInfo[]> | List of consents recorded on this person |
GetConsentPersonAsync(int, CancellationToken)
Gets a ConsentPerson object.
Declaration
Task<ConsentPerson> GetConsentPersonAsync(int consentPersonId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | consentPersonId | The identifier of the ConsentPerson object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ConsentPerson> | A single ConsentPerson |
GetCustomerCentrePasswordReplyTemplateAsync(int, CancellationToken)
Gets a parsed Customer Centre password reply template for a particular customer
Declaration
Task<ReplyTemplateParsed> GetCustomerCentrePasswordReplyTemplateAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | Person/customer id to get the template for. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ReplyTemplateParsed> | A parsed Customer Centre password reply template. |
GetMyOwnerAsync(CancellationToken)
Get the owner of the logged in person.
Declaration
Task<Person> GetMyOwnerAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person> | Person |
GetMyPersonAsync(CancellationToken)
Gets the person info belonging to the currently logged on user.
Declaration
Task<PersonEntity> GetMyPersonAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> | The PersonEntity |
GetOwnerOnPersonIdAsync(int, CancellationToken)
Get the owner of the person by id.
Declaration
Task<Person> GetOwnerOnPersonIdAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person> | Person |
GetPersonAsync(int, CancellationToken)
Gets a Person object.
Declaration
Task<Person> GetPersonAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The identifier of the Person object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person> | A single Person |
GetPersonEntityAsync(int, CancellationToken)
Gets a PersonEntity object.
Declaration
Task<PersonEntity> GetPersonEntityAsync(int personEntityId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personEntityId | The identifier of the PersonEntity object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> | A single PersonEntity |
GetPersonImageAsStreamAsync(int, CancellationToken)
Returns the person image that is displayed in the CRM application.
Declaration
Task<Stream> GetPersonImageAsStreamAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id of the person the image belongs to. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Stream> | The person image. |
GetPersonImageAsync(int, CancellationToken)
Returns the person image that is displayed in the CRM application.
Declaration
Task<Image> GetPersonImageAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id of the person the image belongs to. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<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.) |
GetPersonImagesAsync(int[], int, int, CancellationToken)
Get the image for a set of persons scaled to a specific size. Returned images are in PNG format.
Declaration
Task<PersonImage[]> GetPersonImagesAsync(int[] personIds, int scaledWidth, int scaledHeight, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | personIds | List of persons to get images for. |
| int | scaledWidth | Returned images are scaled to this width |
| int | scaledHeight | Returned images are scaled to this height |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonImage[]> | List of person images. Persons without an image are not present in this list. |
GetPersonListAsync(int[], CancellationToken)
Gets an array of Person objects.
Declaration
Task<Person[]> GetPersonListAsync(int[] personIds, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | personIds | The identifiers of the Person object |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person[]> | Array of Person |
GetPersonSummaryAsync(int, int, CancellationToken)
Get summary of person and recent activity.
Declaration
Task<PersonSummary> GetPersonSummaryAsync(int personId, int limit, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id to summarize. |
| int | limit | Max number of items to include in summary lists. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonSummary> | Summary of person, with recent requests, sales, follow-ups, chats. |
GetPersonsFromContactAsync(int, CancellationToken)
Returns all the persons belonging to a contact.
Declaration
Task<Person[]> GetPersonsFromContactAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | The project id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person[]> | The persons belonging to a contact. |
GetPersonsFromProjectAsync(int, CancellationToken)
Returns all the persons belonging to a project.
Declaration
Task<Person[]> GetPersonsFromProjectAsync(int projectId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | projectId | The project id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<Person[]> | The persons belonging to a project. |
GetPhonesAsync(int, CancellationToken)
Returning all phones that belong to a person, ordered by the phone type.
Declaration
Task<EntityElement[]> GetPhonesAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<EntityElement[]> | An array of Phones |
GetSalesRepAsync(string, string, string, string, string, CancellationToken)
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
Task<PersonEntity> GetSalesRepAsync(string contactName, string personFirstname, string personLastname, string emailAddress, string phoneNumber, CancellationToken cancellationToken = default)
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. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> | The PersonEntity of the sales rep. |
GetUserCandidateByPersonAsync(int, CancellationToken)
Gets user candidate linked to a person.
Declaration
Task<UserCandidate> GetUserCandidateByPersonAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | Person related to requested UserCandidate. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<UserCandidate> | UserCandidate linked to a person. |
GetUtmParametersAsync(int, CancellationToken)
Get all UTM parameters for a given person.
Declaration
Task<UtmParameters> GetUtmParametersAsync(int personId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id to get UTM parameters for |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<UtmParameters> | UTM parameters recorded on this person |
HasConsentAsync(int, string, CancellationToken)
Check if consent has been given by a specified person, for a specific purpose. Withdraw consents return FALSE.
Declaration
Task<bool> HasConsentAsync(int personId, string purpose, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id |
| string | purpose | The key of the purpose to check. (e.g. 'STORE' or 'EMARKETING') |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if the person has consented to the given purpose. |
IsNumberValidAsync(int, string, CancellationToken)
Checks if the number is unique or required. The setting is configured from admin under system options.
Declaration
Task<bool> IsNumberValidAsync(int contactId, string number, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | |
| string | number | Number to check. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | True if number is ok (passes uniqueness/required checks) |
MergeAsync(int, int, DateTime, bool, bool, CancellationToken)
Merge two persons. The destination person will remain. You must specify the date after which activities will be moved along with the person.
Declaration
Task MergeAsync(int sourcePersonId, int destinationPersonId, DateTime moveAfterDate, bool deleteSource, bool replaceEmptyFieldsOnDestination, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | sourcePersonId | The identifier for the person which will be merged into the destination person. The source person is deleted/marked retired after the merge. |
| int | 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. |
| bool | deleteSource | If true, the source person will be deleted after the merge. If false, it will have its retired flag set |
| bool | replaceEmptyFieldsOnDestination | If true, empty fields on destination will be replaced by values from source. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
MoveAsync(int, int, DateTime, CancellationToken)
Move a person to a specified contact. You must specify the date after which activities will be moved along with the person.
Declaration
Task MoveAsync(int personId, int destinationContactId, DateTime moveAfterDate, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The identifier for the person |
| int | 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. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
NormalizeRanksAsync(int, CancellationToken)
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
Task<bool> NormalizeRanksAsync(int contactId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contactId | Id of contact whose persons are to be rank normalized |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | 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. |
RemoveConsentAsync(int, string, CancellationToken)
Turn off consent for a specified person and purpose.
Declaration
Task RemoveConsentAsync(int personId, string purpose, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id |
| string | purpose | The key of the purpose to remove. (e.g. 'STORE' or 'EMARKETING') |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
ResolvePersonFromInfoAsync(int, string, string[], string[], CancellationToken)
Get a person from the provided information. If the person does not exist, it will be created on demand.
Declaration
Task<ResolvedPerson> ResolvePersonFromInfoAsync(int contactId, string personName, string[] phoneNumbers, string[] emails, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ResolvedPerson> | The results of the resolve-operation. |
SaveConsentPersonAsync(ConsentPerson, CancellationToken)
Updates the existing ConsentPerson or creates a new ConsentPerson if the id parameter is 0.
Declaration
Task<ConsentPerson> SaveConsentPersonAsync(ConsentPerson consentPerson, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ConsentPerson | consentPerson | The ConsentPerson that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<ConsentPerson> | New or updated ConsentPerson |
SavePersonEntityAsync(PersonEntity, CancellationToken)
Updates the existing PersonEntity or creates a new PersonEntity if the id parameter is 0.
Declaration
Task<PersonEntity> SavePersonEntityAsync(PersonEntity personEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| PersonEntity | personEntity | The PersonEntity that is saved |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<PersonEntity> | New or updated PersonEntity |
SendConsentConfirmationEmailAsync(int, string, int, int, string, CancellationToken)
Send confirmation email to the provided person, email address (id), using the document template
Declaration
Task SendConsentConfirmationEmailAsync(int personId, string emailAddress, int emailTemplateId, int cultureLcidId, string subject, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id |
| string | emailAddress | The email address to send to. |
| int | emailTemplateId | The id of the email template (doctmpl_id) |
| int | cultureLcidId | The id of the culture (LCID) |
| string | subject | Optional email subject |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SendCustomerCentrePasswordEmailAsync(int, string, string, string, CancellationToken)
Sends a Customer Centre password email based on the reply template.
Declaration
Task SendCustomerCentrePasswordEmailAsync(int personId, string from, string to, string subject, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | Person id associated to email's reply template. |
| string | from | Sender's email address. |
| string | to | Recipient's email address. |
| string | subject | Email's subject. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
SendEmailAsync(string, string, string, string, string, int[], CancellationToken)
Inserts into outbox an email with specified details.
Declaration
Task SendEmailAsync(string from, string to, string subject, string plainBody, string htmlBody, int[] attachmentIds, CancellationToken cancellationToken = default)
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. |
| int[] | attachmentIds | Ids of email's attachments. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
SendEmailWithEventNameAsync(string, string, string, string, string, int[], string, CancellationToken)
Inserts into outbox an email with specified details and event name.
Declaration
Task SendEmailWithEventNameAsync(string from, string to, string subject, string plainBody, string htmlBody, int[] attachmentIds, string eventName, CancellationToken cancellationToken = default)
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. |
| int[] | attachmentIds | Ids of email's attachments. |
| string | eventName | Event name passed to outbound email trigger |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
SetConsentAsync(int, string, string, string, string, CancellationToken)
Set a specified type of consent on the person.
Declaration
Task SetConsentAsync(int personId, string purpose, string source, string legalBase, string comment, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SetPersonImageAsync(int, Image, CancellationToken)
Stores the person image that is displayed in the CRM application.
Declaration
Task SetPersonImageAsync(int personId, Image image, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id of the person the image belongs to. |
| Image | image | The image that is stored on the person (System.Drawing.Image) |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SetPersonImageFromStreamAsync(int, Stream, CancellationToken)
Stores the person image that is displayed in the CRM application.
Declaration
Task SetPersonImageFromStreamAsync(int personId, Stream image, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | The person id of the person the image belongs to. |
| Stream | image | The person image. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
SetPersonRankAsync(int, short, CancellationToken)
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
Task<bool> SetPersonRankAsync(int personId, short desiredRank, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | personId | Id of person to change |
| short | 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. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool> | 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. |
SetUtmCreatedPersonContactForFormSubmissionAsync(int, int, int, CancellationToken)
Set created person and optinally contact on an UTM Parameters row related to a form submission.
Declaration
Task SetUtmCreatedPersonContactForFormSubmissionAsync(int formSubmissionId, int personId, int contactId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | formSubmissionId | Id of Form submission row related to UTM Parameters row |
| int | personId | Person id to set |
| int | contactId | Contact id to set. Can be 0. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
TryAddPersonsToEmailFlowAsync(int, int[], CancellationToken)
Try to add a participant to the EmailFlow, Same function available in WorkflowAgent
Declaration
Task<bool[]> TryAddPersonsToEmailFlowAsync(int emailFlowId, int[] personIds, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | emailFlowId | Primary key of EmailFlow |
| int[] | personIds | Array of Person Ids |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<bool[]> | True if the corresponding participant was successfully added, false if it could not be added because of filter criteria or other reason |
UndeleteAsync(int, CancellationToken)
This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
Declaration
Task UndeleteAsync(int id, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The primary key of the entity to undelete |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task | This method has no return value |
ValidatePersonEntityAsync(PersonEntity, CancellationToken)
Check that entity is ready for saving, return error messages by field.
Declaration
Task<StringDictionary> ValidatePersonEntityAsync(PersonEntity personEntity, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| PersonEntity | personEntity | Entity to be checked for errors. |
| CancellationToken | cancellationToken |
Returns
| Type | Description |
|---|---|
| Task<StringDictionary> | Error messages tagged by field. |