Create a Row with basic properties
Some tooltip text!
• 1 minute to read
• 1 minute to read
This example shows how to create a Row and populate some very basic properties.
using SuperOffice;
using SuperOffice.CRM.Rows;
using(SoSession newSession = SoSession.Authenticate("SAL0", ""))
{
//Create a New Row
ContactRow myContactRow = ContactRow.CreateNew();
myContactRow.SetDefaults();
//Assign values to its basic properties
myContactRow.Name = "SuperOffice ASA";
myContactRow.Department = "ABC Dept";
//Retrieve a country row and assign the country id of that row
CountryRow myCountry = CountryRow.GetFromIdxName("Algeria");
myContactRow.CountryId = myCountry.CountryId;
// Finally save the row
myContactRow.Save();
}
- Get a
CountryRow
using theIdxName
method. - Get
countryId
from thecountryRow
. - Assign a value to the
CountryId
property of theContactRow
.
You can even assign an integer value to the property directly.
Note
If you assign an ID of a non-existing countryRow
to the CountryId
property of the ContactRow
, no exception will be thrown and that value will be stored in the database. But when you retrieve the CountryId
property through ContactEntity
, you will always get 0 if it’s a non-existing row.