> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to create an Entity

> Create entity with basic properties

To create a new instance of an Entity, we use the `CreateNew` method (of the `Entity` class that you are going to create). It must be saved using the `Save` method for the data to be stored in the database.

<Note>
  When calling `CreateNew()`, a new instance of the Entity is created with default values assigned to its properties. However, it will not be saved if you call `Save()` without changing its properties first. Therefore, to save an Entity, **you need to assign some new values to its properties**.
</Note>

## Syntax

```csharp theme={null}
using SuperOffice.CRM.Entities;
using SuperOffice;
using(SoSession mySession = SoSession.Authenticate("SAL0", ""))
{
  //Create a New Entity
  Contact newContact = Contact.CreateNew();

  //Assign values to an Entity
  newContact.Name = "Lois Lane";

  //Saving the Entity
  newContact.Save();
}
```

1. Create an Entity by calling the `CreateNew` method.
2. Assign a value to at least one of its properties.
3. Save it by calling Save().

## Create an Entity with basic properties

After you have created the Entity, you want to populate the various properties exposed by it. The types of properties in a given Entity can be different from one another. Thus populating them with data will also change depending on the property type.

In the following example, we create a `Sale` Entity and populate it with some very basic and simple properties.

```csharp theme={null}
using SuperOffice;
using SuperOffice.CRM.Entities;
using SuperOffice.CRM.Rows;
using(SoSession newSession = SoSession.Authenticate("SAL0", ""))
{
  //create an entity
  Sale mySale = Sale.CreateNew();
  mySale.SetDefaults();

  //assign some very basic and simple properties
  mySale.Amount = 20000;
  mySale.Heading = "This is my first sale";
  mySale.Status = SuperOffice.Data.SaleStatus.Open;
  mySale.Done = SuperOffice.Data.SaleDone.NotDone;
  mySale.Earning = 10000;
  mySale.EarningPercent = 50;
  mySale.Probability = 30;

  //finally save the entity
  mySale.Save();
}
```

By *simple and basic* we mean that the properties are either system-provided simple data types like `System.String` or `System.Double` or NetServer-defined enumerations.

In a typical NetServer Entity, there are many more properties that are of very complex data types.

## See also

* [Create an Entity through an Entity][1]
* [Create a Row as a property of an Entity][2]

[1]: ./create-entity-in-entity

[2]: ../rows/create-row-in-entity


## Related topics

- [How to create a list](/en/api/lists/services/how-to/create-list.md)
- [How to create a list item](/en/api/lists/services/how-to/create-list-item.md)
- [How to create an invitation (services)](/en/api/web-services/howto/diary/create-invitation-services.md)
- [How to create a new document in SO_ARC](/en/api/web-services/howto/document/services-create.md)
- [How to create a recurring appointment (services)](/en/api/web-services/howto/diary/create-recurring-appointment-services.md)
- [How to create a folder](/en/marketing/learn/create-folder.md)
- [How to create a user-defined field using the web services API](/en/api/web-services/howto/custom-objects/rest-create-udef-field.md)
