Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Simple GlideRecord insert fails

John L_
Giga Contributor

Hello.

A script in one of my workflows is not creating Tasks, so I pasted it into a Fix Script to test it out. It doesn't work there either, and I am utterly baffled as to why, it is the simplest possible insert:

Fix Script:

var gr = new GlideRecord('task');
gr.initialize();
gr.short_description = 'do it';
gr.insert();

Generates the following error:

Error.png

I've never had any problem like this with GlideRecord before.

Thank you for any help.

-John

1 ACCEPTED SOLUTION

Erik Stolberg
Tera Guru

Works for me. Is it possible you have a default value script (or script include reference) on a field on Task that is trying to set a value? Where might the "getValue" be coming from? Seems specific to your instance unfortunately.


View solution in original post

2 REPLIES 2

Erik Stolberg
Tera Guru

Works for me. Is it possible you have a default value script (or script include reference) on a field on Task that is trying to set a value? Where might the "getValue" be coming from? Seems specific to your instance unfortunately.


Erik - thank you, that is exactly what it was, a default value in one of the Task fields had a malformed script.