Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: script task result variable scope redefines if output mapping exists #30

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

abdul99ahad
Copy link

@abdul99ahad abdul99ahad commented Dec 16, 2024

Related to: camunda-modeler #4737

Proposed Changes

Script Task

  • If output mapping exists, result variable scope should be local.
    Dec-16-2024 23-10-38

  • If output mapping doesn't exist, result variable scope is global.
    Dec-16-2024 23-09-56

You can test the implementation by running this command: npx @bpmn-io/sr bpmn-io/variable-resolver#variable-scoping -l bpmn-io/extract-process-variables#script-variable-scope

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

Comment on lines 39 to 51
// Checks if output variable exists, the scope gets redefined
if (processVariables.some(x => x.origin[0] === element && x.scope === containerElement)) {

// result variable will have local scope
containerElement = element;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[suggestion] Let's add an example to the functions JSDoc

@barmac
Copy link
Member

barmac commented Dec 17, 2024

Since this pull request applies to Business Rule Task implemented as a DMN decision, I'd suggest to add a respective test case, and document it in the pull request. When this is done, I think it's ready to merge. Great job :)

Copy link
Member

@barmac barmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with comment above :)

@abdul99ahad abdul99ahad force-pushed the script-variable-scope branch from 3322ea3 to cbad563 Compare December 23, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Review pending
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants