Issue
I am trying to create a form where the list of values for selectC and selectD depends on the selected value of selectB and possibly the value of b_id in the existing entity A that I'm editing. I have managed to make it work on onOptionChange for B, but I am having trouble doing it specifically on A.b_id. The b_id value is going out as null in the query path, even though it is present in GetA.data. I need to figure out how to use Async/Await in this scenario since the object function is being called onOptionChange and runs the GetC query.
Resolution
The goal is to create a dependency between queries in a web application using a json form for EntityA, which has EntityB-Id, EntityC-Id, and EntityD-Id as properties. The list of values for EntityB is fetched from another API, while the list of values for EntityC and EntityD are dependent on the selected value of EntityB. The solution is to run queries for C/D using Async/Await and onOptionChange for B and onChange for A b_id, with the use of sourceData and formData.
To implement the solution, the onOptionChange for B and onChange for A b_id should be invoked to run the queries for C/D. This can be done using Async/Await to ensure that the latest values are being used. The query URL for loading list of Bs should be /v1/getAllBs, while the query URL for loading C/D should be /v1/getAllCsFor/{{ModifyForm.formData.selectB || GetA.data.b_id}}, with fallback to the values loaded in GetA.data if b_id is null.
The object function can be called onOptionChange, with GetC running the queries for C/D. The default value for selectB is {{sourceData.b_id}}, while the default value for selectC and selectD are {{sourceData.c_id}} and {{sourceData.d_id}} respectively. This will create a dependency between the queries, where the C/D list is reloaded on change of value for selectB by the user or when editing A.