diff --git a/process/Entity_lib/process.js b/process/Entity_lib/process.js index afdfbfaa023b96d119e17ac92fa64920562076db..79d573a823f600868921b8cfd0ea9894109bfd00 100644 --- a/process/Entity_lib/process.js +++ b/process/Entity_lib/process.js @@ -504,10 +504,28 @@ EntityConsumerRowsHelper.prototype.fetchRowsFromConsumer = function (pFields) */ EntityConsumerRowsHelper.prototype.applyConsumerRowChanges = function () { - var insertedRows = vars.get("$field." + this._consumer + ".insertedRows"); - var changedRows = vars.get("$field." + this._consumer + ".changedRows"); - var deletedRows = vars.get("$field." + this._consumer + ".deletedRows"); + var insertedRows = null; + var changedRows = null; + var deletedRows = null; + // As soon as you're in a Lookup, the consumer might not be available. + // Therefore, the existence check for each variable is necessary to prevent an exception. + + if (vars.exists("$field." + this._consumer + ".insertedRows")) + { + insertedRows = vars.get("$field." + this._consumer + ".insertedRows") + } + + if (vars.exists("$field." + this._consumer + ".changedRows")) + { + changedRows = vars.get("$field." + this._consumer + ".changedRows") + } + + if (vars.exists("$field." + this._consumer + ".deletedRows")) + { + deletedRows = vars.get("$field." + this._consumer + ".deletedRows") + } + if (deletedRows && deletedRows.length > 0) this.removeRows(deletedRows); if (changedRows && changedRows.length > 0)