org.mozilla.javascript.WrappedException: Wrapped TypeError: Cannot read property "success" from null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 07:14 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 08:36 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2022 11:42 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2022 08:19 AM - edited 12-04-2022 04:49 AM
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') {