PublicAPI.CRM.Objects.SaleProduct.Create ELMA API Documentation
Create New Entity (without a Database entry)
 
 
Syntax

public SaleProduct Create()

Return Value

Type: SaleProduct
Entity
Examples

//For example, create a "Contact" object 
//Create object 
var contact = PublicAPI.CRM.Contact.Create();

//For the object to be valid (to work correctly) you must fill in required fields, before saving the object to database 
//You can find all the required fields in the web part 
//For the Contact, the required fields are "Last Name", "Name", "Contractor", "Date Created", "Created By" 

//Enter the current system user in the "Created By" field
contact.CreationAuthor = PublicAPI.Portal.Security.User.GetCurrentUser();

//Enter the current date in the "Date Created Field"
contact.CreationDate = DateTime.Now;

//Fill in the "Name" field
contact.Firstname = "John";

//Fill in the "Last Name" field
contact.Surname= "Smith";

//Fill in the "Contractor" field, upload a contractor from the database
contact.Contractor = PublicAPI.CRM.Contractor.Load(3);

//You can save the contact to the database only after you have filled these fields
contact.Save();
See Also