Class NSPersonAgent
Syntax
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
Constructors
NSPersonAgent()
Declaration
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
Methods
AddBounce(String)
Adds a bounce count on the email address if it exists
Declaration
Void AddBounce(String emailAddress)
Parameters
Type |
Name |
Description |
String |
emailAddress |
|
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
AddBounceWithCount(String,Integer)
Adds a number of bounce counts on the email address if it exists
Declaration
Void AddBounceWithCount(String emailAddress, Integer counts)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
AddEmailAddressToPerson(Integer,String,Bool)
Sets the primary email address on person, possibly re-ranking email addresses accordingly.
Declaration
Void AddEmailAddressToPerson(Integer personId, String emailAddress, Bool setAsPrimaryEmail)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
ChangeCountry(NSPersonEntity,Integer)
Changes country and regenerates the default values and localized information such as phone number and address format for this entity.
Declaration
NSPersonEntity ChangeCountry(NSPersonEntity personEntity, Integer toCountryId)
Parameters
Returns
Examples
NSPersonAgent agent;
NSPersonEntity personEntity;
Integer toCountryId;
NSPersonEntity res = agent.ChangeCountry(personEntity, toCountryId);
ChangePersonRank(Integer,Bool)
Moves one person up or down in the ranking in the Person Archive, if possible. Corresponds to the move up/move down functions in the person archive in the contact panel.
Declaration
Integer ChangePersonRank(Integer personId, Bool moveUp)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer personId;
Bool moveUp;
Integer res = agent.ChangePersonRank(personId, moveUp);
CheckTemporaryKey(String)
Checks a temporary key for validity, and in case it is valid, return its domain, targetId and personId
Declaration
NSTemporaryKeyInfo CheckTemporaryKey(String temporaryKey)
Parameters
Type |
Name |
Description |
String |
temporaryKey |
|
Returns
Examples
NSPersonAgent agent;
String temporaryKey;
NSTemporaryKeyInfo res = agent.CheckTemporaryKey(temporaryKey);
Creates an NSPersonEntity with default values based on the contactId.
Declaration
NSPersonEntity CreateDefaultByContactId(Integer contactId)
Parameters
Type |
Name |
Description |
Integer |
contactId |
|
Returns
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
CreateDefaultConsentPerson()
Sets default values into a new NSConsentPerson.
Declaration
NSConsentPerson CreateDefaultConsentPerson()
Returns
Type |
Description |
NSConsentPerson |
A new NSConsentPerson with default values.
|
Examples
NSPersonAgent agent;
NSConsentPerson thing = agent.CreateDefaultConsentPerson();
thing = agent.SaveConsentPerson(thing);
CreateDefaultFromCredential(Integer,String,String,String)
Creates an NSPersonEntity with default values based on the contactId and credentials.
Declaration
NSPersonEntity CreateDefaultFromCredential(Integer contactId, String credentialType, String credentialValue, String credentialDisplayValue)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
CreateDefaultPersonEntity()
Sets default values into a new NSPersonEntity.
Declaration
NSPersonEntity CreateDefaultPersonEntity()
Returns
Type |
Description |
NSPersonEntity |
A new NSPersonEntity with default values.
|
Examples
NSPersonAgent agent;
NSPersonEntity thing = agent.CreateDefaultPersonEntity();
thing = agent.SavePersonEntity(thing);
CreateTemporaryKey(Integer,Integer,Integer)
Creates 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
String CreateTemporaryKey(Integer domain, Integer targetId, Integer personId, DateTime expires)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer domain;
Integer targetId;
Integer personId;
DateTime expires;
String res = agent.CreateTemporaryKey(domain, targetId, personId, expires);
DeleteConsentPerson(Integer)
Deletes the NSConsentPerson
Declaration
DeleteConsentPerson(Integer consentPerson)
Parameters
Type |
Name |
Description |
Integer |
consentPerson |
|
Returns
Examples
NSPersonAgent agent;
agent.DeleteConsentPerson(123);
DeleteExpired()
Trigger deletion of persons that has been (soft) deleted and have timed out the expiry period (the SoftDeleteRetention preference).
Declaration
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
DeletePersonEntity(Integer)
Deletes the NSPersonEntity
Declaration
DeletePersonEntity(Integer personEntity)
Parameters
Type |
Name |
Description |
Integer |
personEntity |
|
Returns
Examples
NSPersonAgent agent;
agent.DeletePersonEntity(123);
DeleteTemporaryKeysOfDomain(Integer,Integer)
Deletes all temporary keys for a given domain and person
Declaration
Void DeleteTemporaryKeysOfDomain(Integer domain, Integer personId)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
GetAddress(Integer)
Gets the person's localized addressGets the person's localized address.
Declaration
NSLocalizedField[][] GetAddress(Integer personId)
Parameters
Type |
Name |
Description |
Integer |
personId |
The person Id.
|
Returns
Type |
Description |
|
The address.
|
Examples
NSPersonAgent agent;
Integer personId;
NSAddress res = agent.GetAddress(personId);
GetAddressByCountry(Integer,Integer)
Gets the person's localized addressGets the person's localized address.
Declaration
NSLocalizedField[][]GetAddressByCountry(Integer personId, Integer countryId)
Parameters
Type |
Name |
Description |
Integer |
personId |
The person ID
|
Integer |
countryId |
The country Id.
|
Returns
Type |
Description |
|
The address.
|
Examples
NSPersonAgent agent;
Integer personId;
Integer countryId;
NSAddress res = agent.GetAddressByCountry(personId, countryId);
GetBestSoLanguageForTemplate(Integer,Integer)
Gets the best language for this person on this template
Declaration
String GetBestSoLanguageForTemplate(Integer personId, Integer templateId)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer personId;
Integer templateId;
String res = agent.GetBestSoLanguageForTemplate(personId, templateId);
GetColleagues()
Gets the persons working in the same company as the logged-on user.
Declaration
NSPerson[] GetColleagues()
Returns
Examples
NSPersonAgent agent;
NSPerson[] res = agent.GetColleagues();
GetColleaguesByDepartment(Integer)
Gets the persons working in a specific department in the same company as the logged-on user
Declaration
NSPerson[] GetColleaguesByDepartment(Integer departmentId)
Parameters
Type |
Name |
Description |
Integer |
departmentId |
|
Returns
Examples
NSPersonAgent agent;
Integer departmentId;
NSPerson[] res = agent.GetColleaguesByDepartment(departmentId);
GetColleaguesBySource(Integer,Integer)
Gets the persons working in the same company as the logged-on user.
Declaration
NSPerson[] GetColleaguesBySource(Integer sourceType, Integer count)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer sourceType;
Integer count;
NSPerson[] res = agent.GetColleaguesBySource(sourceType, count);
GetConsentInfos(Integer)
Gets all consent information for a given person. May include withdrawn consents (check)
Declaration
NSConsentInfo[] GetConsentInfos(Integer personId)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Returns
Examples
NSPersonAgent agent;
Integer personId;
NSConsentInfo[] res = agent.GetConsentInfos(personId);
GetConsentPerson(Integer)
Gets an NSConsentPerson object.
Declaration
NSConsentPerson GetConsentPerson(Integer consentPersonId)
Parameters
Type |
Name |
Description |
Integer |
consentPersonId |
|
Returns
Examples
NSPersonAgent agent;
NSConsentPerson thing = agent.GetConsentPerson(123);
GetMyOwner()
Gets the owner of the logged in person.
Declaration
Returns
Examples
NSPersonAgent agent;
NSPerson res = agent.GetMyOwner();
GetMyPerson()
Gets the person info belonging to the currently logged-on user.
Declaration
NSPersonEntity GetMyPerson()
Returns
Examples
NSPersonAgent agent;
NSPersonEntity res = agent.GetMyPerson();
GetOwnerOnPersonId(Integer)
Gets the owner of the person by ID.
Declaration
NSPerson GetOwnerOnPersonId(Integer personId)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Returns
Examples
NSPersonAgent agent;
Integer personId;
NSPerson res = agent.GetOwnerOnPersonId(personId);
GetPerson(Integer)
Declaration
NSPerson GetPerson(Integer personId)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Returns
Examples
NSPersonAgent agent;
NSPerson thing = agent.GetPerson(123);
GetPersonEntity(Integer)
Gets an NSPersonEntity object.
Declaration
NSPersonEntity GetPersonEntity(Integer personEntityId)
Parameters
Type |
Name |
Description |
Integer |
personEntityId |
|
Returns
Examples
NSPersonAgent agent;
NSPersonEntity thing = agent.GetPersonEntity(123);
GetPersonImage(Integer)
Returns the person image that is displayed in the CRM application.
Declaration
NSImage GetPersonImage(Integer personId)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Returns
Examples
NSPersonAgent agent;
Integer personId;
NSImage res = agent.GetPersonImage(personId);
GetPersonList(Integer[])
Gets an array of NSPerson objects.
Declaration
NSPerson[] GetPersonList(Integer[] personIds)
Parameters
Type |
Name |
Description |
Integer[] |
personIds |
|
Returns
Examples
Integer[] ids;
NSPersonAgent agent;
agent.GetPersonList(ids);
Returns all the persons belonging to a contact.
Declaration
NSPerson[] GetPersonsFromContact(Integer contactId)
Parameters
Type |
Name |
Description |
Integer |
contactId |
|
Returns
NSPersonAgent agent;
Integer contactId;
NSPerson[] res = agent.GetPersonsFromContact(contactId);
GetPersonsFromProject(Integer)
Returns all the persons belonging to a project.
Declaration
NSPerson[] GetPersonsFromProject(Integer projectId)
Parameters
Type |
Name |
Description |
Integer |
projectId |
|
Returns
Examples
NSPersonAgent agent;
Integer projectId;
NSPerson[] res = agent.GetPersonsFromProject(projectId);
GetPersonSummary(Integer,Integer)
Gets summary of person and recent activity.
Declaration
NSPersonSummary GetPersonSummary(Integer personId, Integer limit)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer personId;
Integer limit;
NSPersonSummary res = agent.GetPersonSummary(personId, limit);
GetPhones(Integer)
Returns all phones that belong to a person, ordered by the phone type.
Declaration
NSEntityElement[] GetPhones(Integer personId)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Returns
Examples
NSPersonAgent agent;
Integer personId;
NSEntityElement[] res = agent.GetPhones(personId);
GetSalesRep(String,String,String,String,String)
Returns the sales representative for an external user.
Declaration
NSPersonEntity GetSalesRep(String contactName, String personFirstname, String personLastname, String emailAddress, String phoneNumber)
Parameters
Returns
Examples
NSPersonAgent agent;
String contactName;
String personFirstname;
String personLastname;
String emailAddress;
String phoneNumber;
NSPersonEntity res = agent.GetSalesRep(contactName, personFirstname, personLastname, emailAddress, phoneNumber);
HasConsent(Integer,String)
Checks if consent has been given by a specified person, for a specific purpose. Withdraw consents return FALSE.
Declaration
Bool HasConsent(Integer personId, String purpose)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer personId;
String purpose;
Bool res = agent.HasConsent(personId, purpose);
IsNumberValid(Integer,String)
Checks if the number is unique or required.
Declaration
Bool IsNumberValid(Integer contactId, String number)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer contactId;
String number;
Bool res = agent.IsNumberValid(contactId, number);
Merge(Integer,Integer,DateTime,Bool,Bool)
Merges two persons. The destination person will remain. You must specify the date after which activities will be moved along with the person.
Declaration
Void Merge(Integer sourcePersonId, Integer destinationPersonId, DateTime moveAfterDate, Bool deleteSource, Bool replaceEmptyFieldsOnDestination)
Parameters
Type |
Name |
Description |
Integer |
sourcePersonId |
|
Integer |
destinationPersonId |
|
|
moveAfterDate |
|
Bool |
deleteSource |
|
Bool |
replaceEmptyFieldsOnDestination |
|
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
Move(Integer,Integer,DateTime)
Moves a person to a specified contact. You must specify the date after which activities will be moved along with the person.
Declaration
Void Move(Integer personId, Integer destinationContactId, DateTime moveAfterDate)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Integer |
destinationContactId |
|
|
moveAfterDate |
|
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
NormalizeRanks(Integer)
Normalize 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
Bool NormalizeRanks(Integer contactId)
Parameters
Type |
Name |
Description |
Integer |
contactId |
|
Returns
Examples
NSPersonAgent agent;
Integer contactId;
Bool res = agent.NormalizeRanks(contactId);
RemoveConsent(Integer,String)
Turns off consent for a specified person and purpose.
Declaration
Void RemoveConsent(Integer personId, String purpose)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
ResolvePersonFromInfo(Integer,String,String[],String[])
Gets a person from the provided information. If the person does not exist, it will be created on demand.
Declaration
NSResolvedPerson ResolvePersonFromInfo(Integer contactId, String personName, String[] phoneNumbers, String[] emails)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer contactId;
String personName;
String[] phoneNumbers;
String[] emails;
NSResolvedPerson res = agent.ResolvePersonFromInfo(contactId, personName, phoneNumbers, emails);
SaveConsentPerson(NSConsentPerson)
Updates the existing NSConsentPerson or creates a new NSConsentPerson if the id parameter is 0
Declaration
NSConsentPerson SaveConsentPerson(NSConsentPerson consentPerson)
Parameters
Type |
Name |
Description |
NSConsentPerson |
consentPerson |
The NSConsentPerson to save.
|
Returns
Examples
NSPerson agent;
NSConsentPerson thing = agent.CreateDefaultConsentPerson();
thing = agent.SaveConsentPerson(thing);
SavePersonEntity(NSPersonEntity)
Creates or updates an NSPersonEntityUpdates the existing NSPersonEntity or creates a new NSPersonEntity if the ID parameter is 0.
Declaration
NSPersonEntity SavePersonEntity()
Parameters
Returns
Examples
NSPerson agent;
NSPersonEntity thing = agent.CreateDefaultPersonEntity();
thing = agent.SavePersonEntity(thing);
SendConsentConfirmationEmail(Integer,String,Integer,Integer,String)
Sends a confirmation email to the provided person, email address (id), using the document template
Declaration
Void SendConsentConfirmationEmail(Integer personId, String emailAddress, Integer emailTemplateId, Integer cultureLcidId, String subject)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
SetConsent(Integer,String,String,String,String)
Sets a specified type of consent on the person.
Declaration
Void SetConsent(Integer personId, String purpose, String source, String legalBase, String comment)
Parameters
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
SetPersonImage(Integer)
Stores the person image that is displayed in the CRM application.
Declaration
Void SetPersonImage(Integer personId, NSImage image)
Parameters
Type |
Name |
Description |
Integer |
personId |
|
Returns
Examples
NSPersonAgent agent;
agent.callMethod(arg1, arg2);
SetPersonRank(Integer,Integer)
Directly sets the rank field of a person record, adjusting all other person records under the same contact as needed.
Declaration
Bool SetPersonRank(Integer personId, Integer desiredRank)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer personId;
Integer desiredRank;
Bool res = agent.SetPersonRank(personId, desiredRank);
TryAddPersonsToEmailFlow(Integer,Integer[])
Attempts to add multiple persons to an email flow, returning an array of boolean values indicating success for each person.
Declaration
Bool[] TryAddPersonsToEmailFlow(Integer flowId, Integer[] personIds)
Parameters
Type |
Name |
Description |
Integer |
flowId |
The ID of the email flow to which persons will be added.
|
Integer[] |
personIds |
An array of person IDs to be added to the email flow.
|
Returns
Type |
Description |
Bool[] |
An array of boolean values indicating whether each person was successfully added to the email flow.
|
Examples
NSPersonAgent agent;
Integer[] personIds;
personIds.pushBack(2);
agent.TryAddPersonsToEmailFlow(1, personIds);
Undelete(Integer)
This entity supports Soft Delete. Call this method to Undelete a previously soft-deleted record
Declaration
Void Undelete(Integer id)
Parameters
Returns
Examples
NSPersonAgent agent;
Integer id;
agent.Undelete(id);
ValidatePersonEntity(NSPersonEntity)
Checks that entity is ready for saving, return error messages by field.
Declaration
Map ValidatePersonEntity(NSPersonEntity personEntity)
Parameters
Returns
Examples
NSPersonAgent agent;
NSPersonEntity personEntity;
Map res = agent.ValidatePersonEntity(personEntity);