Skip to content

Commit

Permalink
fix: result variable with output mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Dec 11, 2024
1 parent 8594822 commit 43276ba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion lib/zeebe/VariableResolver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getProcessVariables } from '@bpmn-io/extract-process-variables/zeebe';
import { BaseVariableResolver } from '../base/VariableResolver';
import { parseVariables } from './util/feelUtility';
import { parseVariables, getScriptExpression, getIoExpression } from './util/feelUtility';
import {
getBusinessObject,
is
Expand All @@ -26,6 +26,22 @@ export default class ZeebeVariableResolver extends BaseVariableResolver {

const bo = getBusinessObject(element);

// filter based on resultVariable if output exists.

const outputExists = variables.some(variable =>
getIoExpression(variable, variable.origin[0]) && variable.scope === bo
);

if (outputExists && !moddleElement) {

// remove script variable if exists from variables.
const filteredVariables = variables.filter(
variable => !getScriptExpression(variable, variable.origin[0])
);

return filteredVariables;
}

if (!moddleElement) {
return variables;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/zeebe/util/feelUtility.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function getExpressionDetails(variable, origin) {
* @param {djs.model.Base} origin
* @returns { expression: String}
*/
function getIoExpression(variable, origin) {
export function getIoExpression(variable, origin) {
const ioMapping = getExtensionElementsList(origin, 'zeebe:IoMapping')[0];

if (!ioMapping) {
Expand Down Expand Up @@ -215,7 +215,7 @@ function getIoExpression(variable, origin) {
* @param {djs.model.Base} origin
* @returns { expression: String}
*/
function getScriptExpression(variable, origin) {
export function getScriptExpression(variable, origin) {
const script = getExtensionElementsList(origin, 'zeebe:Script')[0];

if (!script) {
Expand Down

0 comments on commit 43276ba

Please sign in to comment.