Skip to content

FOUR-5348: 4.2.- Variable is not created if has default value dependent#1186

Merged
ryancooley merged 3 commits intodevelopfrom
bugfix/FOUR-5348
Feb 25, 2022
Merged

FOUR-5348: 4.2.- Variable is not created if has default value dependent#1186
ryancooley merged 3 commits intodevelopfrom
bugfix/FOUR-5348

Conversation

@danloa
Copy link
Copy Markdown
Contributor

@danloa danloa commented Feb 17, 2022

Issue & Reproduction Steps

The problem was produced because for the default value was used a JavaScript expression that didn't return any value. By default JavaScript returns "undefined".

Expected behavior:
Even if the the expression used for the default value of a select list is undefined, its value should be able to be set.

Actual behavior:
The select list variable with the undefined default value it is not updated when an item is selected.

Solution

If the JavaScript function returns undefined, by default the variable is initialized with a null value.

How to Test

Steps to Reproduce:

Create Screen

Add select list 1 with default values

[{"content":"1","value":"1"},{"content":"2","value":"2"}]

Put default value = 2

Add select list 2 with data connector

Put default value JS

if (this.form_select_list_2 != 2) {

return null;

}

Press preview button

Select an option in the second select list and verify that this 2nd dropdown variable update its corresponding variable.

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@danloa danloa changed the title Set variable to null if default expression is undefined FOUR-5348: 4.2.- Variable is not created if has default value dependent Feb 17, 2022
@eiresendez eiresendez self-requested a review February 17, 2022 16:59
Copy link
Copy Markdown
Contributor

@eiresendez eiresendez left a comment

Choose a reason for hiding this comment

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

Working perfectly. Tests passed.

Screen.Recording.2022-02-17.at.12.46.35.p.m.mov

@ryancooley ryancooley merged commit 5586403 into develop Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants