What is mean current.isNew()

SS64
Tera Contributor

What is mean current.isNew()?

What is mean current.isNew() and current.isNewRecord()?

6 REPLIES 6

AbhishekGardade
Giga Sage

Hello SS,

isNewRecord() basically says "The information you are looking at hasn't been saved to the database yet.", not "This is a brand new record saved to the database."

isNewRecord() validates true if its validated _before_ insert into the db.

isValidRecord() validates if the record exists in the table (gr) - this can evaluate false even though a given record is not new (is inserted)

I dont think so there is any function called isNew().

We have following functions available:

current.newRecord()

Thanks,
Abhishek Gardade

Thank you,
Abhishek Gardade

Priyanka Chandr
Mega Guru

Hi,

isNewRecord()

Determines whether the current record has been inserted into the database. This method returns true only if the newRecord() method has been called. This method is useful for scripted ACL, and in the condition of UI actions, but should not be used in background scripts.

Note: This method returns true for any new record during a business rule, or if the newRecord() method is used to initialize a record with default values and a unique ID (sys_id). In all other cases, it returns false.

Return:

TypeDescription
BooleanTrue if the current record is new (has not been inserted into the database.)

Example

 answer = gs.hasRole("filter_admin") || current.isNewRecord()
 
Please mark it corect and helpful
Thanks,

Bhagyashri Sort
Kilo Guru

Hi, 

isNewRecord() determines whether the current record has been inserted into the database. This method returns true only if the newRecord() method has been called. This method is useful for scripted ACL, and in the condition of UI actions, but should not be used in background scripts.

This method returns true for any new record during a business rule, or if the newRecord() method is used to initialize a record with default values and a unique ID (sys_id). In all other cases, it returns false.

 

If my response helps you, mark it correct and helpful.

Thanks

Bhagyashri Sorte.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Don't actually know of a current.isNew. Do know about a current.isNewRecord().

Can you explain how/where you came up with current.isNew()? Did you find it somewhere in your instance?

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn