How to retrieve an Entity
Some tooltip text!
• 1 minute to read
• 1 minute to read
We need to retrieve an Entity for several purposes, viewing the properties of an Entity is one such purpose.
Syntax
The following example shows the use of the GetFromIdx
function to retrieve an Entity.
using SuperOffice.CRM.Entities;
using SuperOffice;
using(SoSession mySession = SoSession.Authenticate("SAL0", ""))
{
//Retrieving a Property of PersonEntity
Person newPerson = Person.GetFromIdxPersonId(20);
string personName = newPerson.Firstname;
}
Retrieve an Entity with basic properties
Retrieving basic properties of a Contact
Entity implies obtaining properties that are neither Entities nor Rows.
The following example demonstrates how to retrieve properties of basic data type of an Entity.
using SuperOffice.CRM.Entities;
using SuperOffice.CRM.Rows;
using SuperOffice;
using(SoSession mySession = SoSession.Authenticate("SAL0", ""))
{
//Retrieving an Entity
Contact newContact = Contact.GetFromIdxContactId(11);
//Retrieving Basic properties of an Entity
string aInterests = newContact.ActiveInterests.ToString();
string depart = newContact.Department;
string kName = newContact.Kananame;
string cName = newContact.Name;
string cNum1 = newContact.Number1;
string cNum2 = newContact.Number2;
string orgNum = newContact.OrgNr;
string cRegDate = newContact.Registered.ToString();
}
Here, the Registered
property is of Datetime data type. All the other properties (Department, Kananame, Name, Number1, Number2, OrgNr) are of type String.