Document.prototype.is_new_record >= 1.1.0

Description

Is this a new & unsaved record?

Flags

Client
This will also be available on the client-side, in the browser.

Type

Boolean

True if it's new, false otherwise

Examples

Creating a new document

// Get a model
let page_model = Model.get('Page');

// Create a new document
let page = page_model.createDocument();

// is_new_record will now be true
page.is_new_record === true;

// Set some fields
page.title = 'Some title';

// Save the document
await page.save();

// is_new_record will now be false
page.is_new_record === false;