Query Execution:
Dynamics 365 triggers an Azure Function by passing the SQL query or relevant query parameters. Azure Function receives the query and initiates the execution.
Long-Running Query Execution in Azure Function:
Azure Function connects to the SQL database using appropriate database connectors or libraries. The SQL query is executed within the Azure Function environment.
Handling Query Results:
Azure Function receives the query results from the SQL database. If the query execution completes within the timeout limit, the results are returned to Dynamics 365 directly. If the query execution exceeds the timeout limit, a partial result or a notification indicating the ongoing query execution is returned to Dynamics 365.
Continuation and Result Retrieval:
Dynamics 365 acknowledges the partial result or notification received from the Azure Function. Dynamics 365 triggers subsequent requests to the Azure Function to retrieve the remaining query results. Azure Function continues the query execution from where it left off and returns additional results as requested by Dynamics 365. This process continues until the complete query result is received by Dynamics 365.