In Oracle Visual Builder Cloud Service (VBCS), a Customize Fetch Action for an SDP (Service Data Provider) is a way to override the default data fetching behavior and write custom logic (typically JavaScript) to control how and what data the SDP retrieves from a service or other sources.
In this post, we will see how to implement custom fetch action chain for SDP in VBCS.
Let us consider below Select (Single) components. The SDP variable is assigned to Single Select components. The SDP is based on Fusion REST API endpoint for AP Invoice.

Search Invoice Number by partial type as “test”

This will show all invoice numbers starting with “test”.
Let us search with “test CM”.

This will also provide you with the result.
Let us search now with “test cm”.

No result was found.
Hence the Search is case sensitive.
If we want to make search case-insensitive, we can do it using custom fetch action chain for SDP.
Follow the steps below to achieve this.
Select (Single) component is associated with SDP variable as shown:

Navigate to this SDP variable.

Click on Customize Fetch Action chain.
This will open a new action chain.

This action chain will consist of one REST API call and return component.
Also action chain is having parameter as “configuration”.
This configuration parameter captures value which we type in Select Single field.
We can capture value which is typed in select Single combo box using “configuration.hookHandler.context.fetchOptions.filterCriterion.text”.
Let us capture the value and add Fire Notification to display the value.
Navigate to code of action chain.

Add below code:
- let searchText = “”;
- if (configuration &&
- configuration.hookHandler &&
- configuration.hookHandler.context &&
- configuration.hookHandler.context.fetchOptions &&
- configuration.hookHandler.context.fetchOptions.filterCriterion &&
- configuration.hookHandler.context.fetchOptions.filterCriterion.text) {
- searchText = configuration.hookHandler.context.fetchOptions.filterCriterion.text;
- searchText=searchText.toUpperCase();
- }

Now add fire notification and assign searchText local variable.

Run the application.

Now we will build query parameter to remove case sensitivity and will pass to REST API call.

Click on query parameter.

Add below expression for query parameter:
- “upper(InvoiceNumber) LIKE ‘” + searchText + “%'”
Click on save.
Add return to return response.

Add else condition to display all records if user is not selecting any value.
We don’t need to pass query parameter for else condition.

Run the application.

Search with test cm.

Using customize fetch action chain for SDP, we have removed case sensitivity for search text.