org.mozilla.javascript.WrappedException: Wrapped TypeError: Cannot read property "success" from null

Rooma1
Tera Contributor

Hi,

We are getting error as stated above in the workflow activity. Not able to debug what is the issue. Screenshot attached for the workflow activity.

 

answer = ifScript();

function ifScript() {
if (workflow.scratchpad.addMemberResult.success) {
return 'yes';
}
return 'no';
}

 

Thanks,

Rooma

3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

workflow.scratchpad.addMemberResult.success is only valid if workflow.scratchpad.addMemberResult is valid.  This error is indicating that workflow.scratchpad.addMemberResult is not known / null, therefore the object named success within it is unknown.  You'll have to start from the beginning of the workflow and confirm:

1) workflow.scratchpad.addMemberResult is declared as an object with a line in a run script somewhere like this:

workflow.scratchpad.addMemberResult = {};

unless there's a typo/syntax issue with this if statement and what you really meant was something more like:

if (workflow.scratchpad.addMemberResult == 'success') {

2) You'll also need to find where workflow.scratchpad.addMemberResult is getting assigned a value, and also where workflow.scratchpad.addMemberResult.success is getting assigned a value (unless this is not an object as explained above).  To confirm the value of the variables in this particular test case, add a line like

workflow.info('addMemberResult = ' + workflow.scratchpad.addMemberResult);

after the assignments.  You can view this log on the Log tab when clicking the Workflow Context related link on the RITM.

Hi Brad,

I have checked the workflow and workflow.scratchpad.addMemberResult.success is getting assigned a value of 'false'  in the "verify inputs" activity in the subflow. Screenshot attached.

 

Let me know if the script mentioned in the issue details is correct.

 

Thanks,

Rooma

Scratchpad variables can only hold string values, so in this the assignment is likely not working, so the value of workflow.scratchpad.addMemberResult.success is undefined/null. Try changing these assignment lines to ...='false' or 'true' then in your If activity test the string value

if (workflow.scratchpad.addMemberResult.success == 'true') {