Anyone notice current.isNewRecord() no longer works?

DrewW
Mega Sage
Mega Sage

Anyone notice current.isNewRecord() no longer works?   I have tested this using the below run as a background script in several instances including in a developer instance.   The instances where running Helsinki Patch 5 and Istanbul Patch 1 and also Patch 2.

Just thought I would share just in case my marbles have finally rolled away...

var x = new GlideRecord("incident"); x.initalize(); x.setValue("caller", "2a6f81b60a0a3c2601ddac0243417d02"); x.insert(); gs.print(x.isNewRecord());

If other find otherwise on a Helsinki or Istanbul instance I would love to know the version.

var x = new GlideRecord("incident");

x.initalize();

x.setValue("caller", "2a6f81b60a0a3c2601ddac0243417d02");

gs.print(x.isNewRecord());

If

1 ACCEPTED SOLUTION

DrewW
Mega Sage
Mega Sage

Ok, so apparently something was "fixed" and this is not supposed to work for the script that I wrote and I am blind because the documentation says "but should not be used in background scripts" to indicate this.


View solution in original post

8 REPLIES 8

DrewW
Mega Sage
Mega Sage

Oops, posted the wrong script



var x = new GlideRecord("incident");


x.initalize();


x.setValue("caller", "2a6f81b60a0a3c2601ddac0243417d02");


gs.print(x.isNewRecord());


Hi Drew!



I'm not sure what's wrong with testing it this way but the function still works in general. I'm using them in UI actions, business rules etc and it works pretty much the same. I'm running Helsinki patch 7.


I don't know either but I have a script include that uses it and its clearly being impacted.   I had to change the code to !current.isValidRecord() to get it to work again.


Could you share your script include? May be there's some other reason for it not to work?