Reputation: 1
We have requirement with one of our search API to make the input criteria dynamic for searching the records (Account or contacts).
Current functionality:
An API has a input request that contains set of fields for example: Name, Email and Mobile
The input can have multiple sets of these values like:
conDetails:{
[Name:abc, Email:[email protected], Mobile:9999999999],
[Name:def, Email:[email protected], Mobile:8888888888],
[Name:ghi, Email:[email protected], Mobile:7777777777]
}
As soon as the input is received we create separate lists of string 1st containing entire list of name, 2nd containing entire list of emails and 3rd containing entire list of mobile.
These lists are now passed to the Dynamic query to get all the matching records and the records are further processed as per business logic.
Expected functionality:
In the above example we want to make the request dynamic and configurable where going ahead if we add additional fields to filter then we don’t need to make any code changes and the functionality should handle the additional fields using some config from metadata.
The modified/updated input request would look like:
conDetails:{
[Name:abc, Email:[email protected], Mobile:9999999999,Address:abc Street],
[Name:def, Email:[email protected], Mobile:8888888888, Address:def Street],
[Name:ghi, Email:[email protected], Mobile:7777777777, Address:ghi Street]
}
Problem to achieve expected functionality:
We need help to make the functionality dynamic so that it can handle any number of inputs that can vary in future without any code change. Also, please suggest if there is any alternate mechanism to achieve the searching functionality through API without declaring and using separate lists.
We tried to use different types of structures to hold the data but as the inputs changes we need to write some code to declare the lists and populate the data every time a new input is added.
Upvotes: 0
Views: 33