current.isNewRecord() gives false when used in calculation field

ryadavalli
Tera Expert

current.isNewRecord() gives false when used in calculated value on a field on a change record for create newswhen used in calculation field on a change record for create new

18 REPLIES 18

Some users do not see the Correct Answer link (per this video at 20:00 https://community.servicenow.com/thread/224893). Let me know if you do not see it and I can get a community moderation to assist.


I donot see the correct flag   Chuck


Sorry for the problem Ravali. I'm adding one of our community moderators to assist.



+dan.bruhn


Markus Kraus
Kilo Sage

Even though this is a pretty old thread I've decided to bump this because I've run into the same issue and this is the very first hit on google if you search for this topic.

The answer/workaround for "current.isNewRecord()" is quite simple: 

(function calculatedFieldValue(current) {

	if (current.getUniqueValue() == null) { // use this instead of current.isNewRecord()
		return 'newRecord=true'; // this can be used by an UI-Policy
	} else {
		return 'newRecord=false';
	}

})(current);