Saves or updates data of the entity and all related entities to the database.
entitySave(entity [, forceInsert])
returns void
Name | Type | Required | Default | Description |
---|---|---|---|---|
entity | variableName | Yes | Name of the entity that must be saved in the database. | |
forceInsert | boolean | No | false | If true, then ColdFusion always tries to insert the entity as a new record. |
Use entitySave to save a newly created entity.
var company = entityNew("Company");
company.setName(form.companyName);
company.setIndustry(form.industry);
company.setEmployees(form.employeeCount);
company.setWebsite(form.companyWebsite);
entitySave(company);