web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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 515

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

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • SashM Profile Picture
    10 on at

    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);

  • SivaR Profile Picture
    69 on at
    You can use flow and webhook to achieve this. 

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 60 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 51

#3
Satyam Prakash Profile Picture

Satyam Prakash 42

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans