Update a basic property of an Entity
Some tooltip text!
• 1 minute to read
• 1 minute to read
Before updating an Entity, it must be retrieved by using the Idx
class.
Updating a basic property of an Entity means changing the values that are stored in properties of basic data types, such as integer or string.
using SuperOffice.CRM.Entities;
using SuperOffice.CRM.Rows;
using SuperOffice;
using(SoSession mySession = SoSession.Authenticate("SAL0", ""))
{
//Retrieving a Sale using the index of a Sale
Sale newSale = Sale.GetFromIdxSaleId(2);
//Update Sale properties directly
newSale.ActiveLinks = 2;
newSale.Amount = 100000.0;
newSale.Earning = 50000;
newSale.EarningPercent = 15;
newSale.Heading = "Test edited for testing.";
newSale.Status = SuperOffice.Data.SaleStatus.Sold;
if (newSale.IsDirty == true)
{
//Saving the Sale Entity
newSale.Save();
}
}
- Get an Entity from the
sale
table with row ID 2. - Update properties of the sale (see below)
- Set the
IsDirty
property to true if there is any change made to that Entity. - Call
Save()
to update any changed data in the database.
Property | Type |
---|---|
ActiveLinks | Unsigned Integer |
Amount | Double |
Earning | Double |
EarningPercentage | Double |
Heading | String |
Status | SuperOffice.Data.SaleStatus |