The undefined value has no properties. 140522

allen_pitts
Giga Expert

Hello Implementation Forum,

 

The Ops Project form is creating Ops Project Tasks and associating
the tasks correctly with the projects. Also got some of the project values
like facility and short description to write to tasks fields to eliminate duplication of input.

 

Code herewith below.

The line that begins
new_task.u_ops_project_task.start_date

is causing me some heartburn.

 

Getting error message:

Error running business rule 'Ops_project_create_runbook' on u_ops_project:OPS0000075, exception: org.mozilla.javascript.EvaluatorException:
The undefined value has no properties. (sys_script.af45d51ee4b0250027cd50546da909f6; line 😎

 

Research says that in JavaScript undefined property indicates that a variable has not been assigned a value.
So used message log to write current.u_request_date to the System log. Result:

'Log message written by OPS0000076 at 05-22-2014 for facility 2014-05-29 21:29:49'

It looks like current.u_request is getting a value.

 

Thought that maybe it is a timing issue with the data being written to the database
so tried the When on the business rule from 'before' to 'after'. No change.

 

Running out of ideas.

 

Thanks.

 

Allen Pitts
LHP Hospital System

 

++++++++++++++++++begin business rule code+++++++++++++++++

// write message to log 140520 acp (take this out after test)

var msg = "Log message written by "   + current.number + " at " + gs.now() + " for facility " + current.u_request_date;

gs.log(msg);

 

// create new task, associate with ops project, auto populate fields 140522 acp

var new_task = new GlideRecord("u_ops_project_task");

new_task.initialize();

new_task.u_ops_project_task.start_date = current.u_request_date;

new_task.u_facility = current.company;

new_task.short_description = current.short_description + " - Create Runbook";

new_task.parent = current.sys_id;

new_task.insert();

 

++++++++++++++++++end business rule code+++++++++++++++++++

1 ACCEPTED SOLUTION

new_task.u_ops_project_task.start_date = current.u_request_date;


It looks like you are dot walking here to u_ops_project_task.   Is this a valid field/variable? The rest of new_task is only updating on the first   level, ex: new_task.parent =, new_task.short_description =



Why does line 8 have an extra level/object?



Can you just do:


new_task.start_date = current.u_request_date;


?


View solution in original post

8 REPLIES 8

justin_drysdale
Mega Guru

What is line 8 in the original business rule (before log statements) ?



Is it:


new_task.u_ops_project_task.start_date = current.u_request_date;


??


Yes, that is line 8:


++++++++++++++++++begin business rule code+++++++++++++++++


1 // write message to log 140520 acp (take this out after test)


2 var msg = "Log message written by "   + current.number + " at " + gs.now() + " for facility " + current.u_request_date;


3 gs.log(msg);


4


5 // create new task, associate with ops project, auto populate fields 140522 acp


6 var new_task = new GlideRecord("u_ops_project_task");


7 new_task.initialize();


8 new_task.u_ops_project_task.start_date = current.u_request_date;


9 new_task.u_facility = current.company;


10 new_task.short_description = current.short_description + " - Create Runbook";


11 new_task.parent = current.sys_id;


12 new_task.insert();



++++++++++++++++++end business rule code+++++++++++++++++++


new_task.u_ops_project_task.start_date = current.u_request_date;


It looks like you are dot walking here to u_ops_project_task.   Is this a valid field/variable? The rest of new_task is only updating on the first   level, ex: new_task.parent =, new_task.short_description =



Why does line 8 have an extra level/object?



Can you just do:


new_task.start_date = current.u_request_date;


?


Justin,



Sometimes one gets his nose so close
to the code he can't see a mistake.



Thanks



Allen