Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Unanswered

Writing SQL data rows into dataverse table by hitting a command bar button

(0) ShareShare
ReportReport
Posted on by

Hey y'all,

 

we would like to sync some sql data on-demand into dataverse tables as child records.

The scenario is:

The user is in the form of a record in a model driven app. The record has child records shown in a subgrid. The user wants to refresh the child records from a sql database, so that all of the missing data rows will be written into the dataverse table for the child records and connected via lookup to the parent record.

We use the following setup: An Azure function that requests the data via Hybrid Connection Manager from On-Premises SQL database.

Now we need the ad-hoc request by hitting a command bar button. How would you solve this? We need to request the Azure Function by hitting the button and the Azure Function (or a plugin?!) needs to write data to the dataverse table. After writing all of the data, the form should refresh with the newly created child records in a subgrid.

 

Thanks in advance for your ideas 🙂

  • manojpatel20dec Profile Picture
    17 on at
    Re: Writing SQL data rows into dataverse table by hitting a command bar button

    @Anonymous here's a simplest approach that I would have done:

    - Install On-Premise data gateway on your sql machine and register it Use the on-premises data gateway app | Microsoft Learn

     

    Sign-In with your dynamics AD account

     

    - Create a instant flow, use action either execute SQL query or stored procedure

    - Configure the connection details to be windows/ SQL authentication and select the gateway you configured previously

    manojpatel20dec_0-1680199150306.png

    -Enter the sql query/ procedure

    -use request response and return the query results from previous action as json string

    manojpatel20dec_1-1680199592612.png

     

    - Save the flow and get the http URL

    - Create a webresource with a function to call http flow url and get response json back, parse json object and loop through the data and create it as records setting the current lookup too, on completion call

    formContext.data.refresh(save).then(successCallback, errorCallback);

    -Use ribbon workbench and call the webresource method on custom button to sync DB records

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 75 Most Valuable Professional

#2
mmbr1606 Profile Picture

mmbr1606 51 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 36

Overall leaderboard