My Oracle Support Banner

TypeError: Cannot read properties of undefined (reading 'context') (Doc ID 3050107.1)

Last updated on SEPTEMBER 30, 2024

Applies to:

Visual Builder Studio - Version 24.10.2 and later
Information in this document applies to any platform.

Symptoms

When attempting to implement Elasticsearch using the select single component with a service data provider to be able to pass user-entered text to the REST query parameter, an error occurred. The customization that was used:

$functions.getSDPFilterCriteria($variables.configuration.hookHandler)
$variables.configuration.hookHandler: Passes the hook handler.
getSDPFilterCriteria: A custom function designed to retrieve the filter criteria.
Goal: Ensure the configuration parameter is correctly passed within the action chain.

Issue Encountered: The JavaScript-based action chain is not passing the configuration parameter correctly, resulting in the following error message:


ERROR
-----------------------
<method>TypeError: Cannot read properties of undefined (reading 'context')
  at PageModule.getSDPFilterCriteria (<>-page.js:9:35)
  at <method>.run (<page>.js:27:34)
  at baseChainRunner.js:80:1

STEPS:
---------

1. Login to a VBCS instance
2. Create a new application based on the CookBook template
3. Open the cookbook and Go to Select-single-start
4. Run the application and check select single first LOV is working fine (Select Single Demo Recipe)
5. Customize the Service data provider action chain by Opening the variable tab and selecting EmployeeListSDP -> Click on Customize Fetch Action chain. It creates an action chain for developers to customize.
6. You will run into the issue described in <bug 37097481>. 
7. As per <bug 37097481>, apply the following workaround:

In the affected action chain, change the following code from

=======================From ================================


10. Now, go to the action chain, map the q parameter, and add the following expression:

$functions.getSDPFilterCriteria($variables.configuration.hookHandler)

11. Click save.

12. Run the application and Click on the employee dropdown

13. In the console log, You can see the error below

log.js:42 [VB (ERROR), /vb/action/actionChain]: Chain getall_EmployeeFetch failed. TypeError: Cannot read properties of undefined (reading 'hookHandler')
at getall_EmployeeFetch.run (getall_EmployeeFetch.js:25:71)
at baseChainRunner.js:80:1

The javascript based action chain is unable to pass the ($variables.configuration.hookHandler)


Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.