Skip to content

Creating and Updating Records

Dan Lively edited this page Jul 14, 2017 · 2 revisions

Create Records

Create records through anonymous objects

string returnID = "";

try
{
  returnID = Sugar.Create("Accounts", new
  {
      name = "Acme Inc",
      description = "full text description",
      phone_office = "555-555-5555",
  });
}
catch (SugarException E)
{
  //handle exception
}

Updating Records

string recordID = "<<record_id>>";

try
{
  Sugar.Update("Accounts",recordID, new {
    description = "Add fields to update in anonymous object",
    phone_office = "555-333-3333"
  });
}
catch (SugarException E)
{
  //handle Exception
}
Clone this wiki locally