Whatever message this page gives is out now! Go check it out!

EntityNew

Last update:
May 18, 2026
NOTE
This function has been enhanced in ColdFusion 9.0.1 to support multiple data sources in the same application.

Description

Creates an instance of the persistent CFC with the entity name that you provide.

Returns

Object

Category

Function Syntax

EntityNew(entityName,[properties="",ignoreExtras=false])

Parameters

Parameter
Description
entityName
Entity name of the persistent CFC.
properties
Key-value pair (ColdFusion struct) of property names and values.

See Also

EntityLoadEntityLoadByExampleEntityDeleteColdFusion ORM chapter in Developing ColdFusion Applications

History

ColdFusion 9: Added this function.

Usage

The enhancement in ColdFusion 9.0.1 allows the application to initialize the object that is being created. properties takes a struct with key being the property name. When the object is created, all the properties are populated with the passed struct.For example,
<cfset artistObj = entityNew("Artists",{FirstName="Tom",LastName="Ron"})>

Example

newArtistObj = EntityNew("Artists");

newArtistObj.setfirstname("John");

newArtistObj.setlastname("Smith");

newArtistObj.setaddress("5 Newport lane");

newArtistObj.setcity("San Francisco");

newArtistObj.setstate("CA");

newArtistObj.setPostalCode("90012");

newArtistObj.setphone("612-832-2343");

newArtistObj.setfax("612-832-2344");

newArtistObj.setemail("jsmith@company.com");

newArtistObj.setThePassword("jsmith");

EntitySave(newartistobj);

ormflush();

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page