I`m getting getValue is not defined but it is defined. What am I doing wrong?

I have created form where in one place I`ve set up condition which says

getValue("GesComplexComponent74_GesRepeatableSection1_row0_GesComplexComponent74_GesCombobox1$label").length > 21

Yet I`m getting error saying

2023-12-03 23:46:46,874 CET [STKN_NUMBER] [] [http-nio-8080-exec-13] ERROR TIMELOG - [metricId=WFR56;timestamp=1701643606874;time=11][Evaluate legacy jsCondition][additional={widgetId=GesComplexComponent74.GesTextField33}]

and a follow up warn thats says

Problem evaluating V1 condition: org.mozilla.javascript.EcmaError: ReferenceError: "getValue" is not defined

Does anybody know what am I doing wrong?

There are two implementation of conditions in the platform:

  • V2 (which you intended to use) - accessing form field values through getValue(), eg. getValue("GesCheckbox1") === "true"
  • V1 - accessing form field values by their IDs, eg. GesCheckbox1 === "true"

By default, the conditions are evaluated using V2, but in case an error occurs, there will ba a fallback to V1 - there is no getValue() function in V1. This explains the log entry.

Probably the ID you provided (GesComplexComponent74_GesRepeatableSection1_row0_GesComplexComponent74_GesCombobox1) is incorrect - platform uses a period, not an underscore, as a separator. So, the correct ID you want to use is likely GesComplexComponent74.GesRepeatableSection1.row0.GesComplexComponent74.GesCombobox1.
However, returned value may be null or undefined so you should check it before calling .length.