Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Triggered a Power Automate Flow when a subgrid is added to or deleted from

(0) ShareShare
ReportReport
Posted on by 513

Hi

I've a subgrid on a form for a model driven up.

I need to be able to trigger that flow whenever that subgrid is added to or deleted from

The relationship is N:N

Does anyone have any tips?

Thanks
Lee

  • SivaR Profile Picture
    34 on at
    Triggered a Power Automate Flow when a subgrid is added to or deleted from
    You can use flow and webhook to achieve this. 
  • SashM Profile Picture
    10 on at
    RE: Triggered a Power Automate Flow when a subgrid is added to or deleted from

    You can do something like this.

    Create a new field that tracks the number of records added to the sub grid.

    For example: no_of_records

    Create and add below function onload of the form with function name "Sdk.formOnLoad"

    Run the workflow or power automate when "no_of_record" field is updated.

    var Sdk = window.Sdk || {};

    (function () {

    this.formOnLoad = function ()

    {

    debugger;

    var gridContext = Xrm.Page.getControl("your_subgrid_name_here"); // sub grid name

    gridContext.addOnLoad(Sdk.gridOnLoad);

    }

    this.gridOnLoad = function()

    {

    debugger;

    var gridContext = Xrm.Page.getControl("your_subgrid_name_here");

    var grid = gridContext.getGrid();

    var totalNumberOfRecord = grid.getTotalRecordCount();//no of record

    var rows = grid.getRows();

    if(totalNumberOfRecord == 0)

    {

    setTimeout(Sdk.gridOnLoad, 3000);

    }

    if ( totalNumberOfRecord != null){

    Xrm.Page.getAttribute("no_of_records").setValue(totalNumberOfRecord);

    }else{

    Xrm.Page.getAttribute("no_of_records").setValue(0);

    }

    }

    }).call(Sdk);

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Triggered a Power Automate Flow when a subgrid is added to or deleted from

    Hello,

    Check this post - crmtipoftheday.com/.../

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 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans