Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.38 KB

create-row.md

File metadata and controls

44 lines (35 loc) · 1.38 KB
title uid description author so.date keywords so.topic
Create a Row with basic properties
create_row
Create row with basic properties
github-id
11.05.2016
howto

Create a Row with basic properties

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();
}
  1. Get a CountryRow using the IdxName method.
  2. Get countryId from the countryRow.
  3. Assign a value to the CountryId property of the ContactRow.

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.