Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Power Automate Dynamics Marketing Insights

(0) ShareShare
ReportReport
Posted on by 90

Hello All,

Can we programatically access data from dynamics maketing insights in power automate?

Kind Regards

Abhilash Reddy

  • Abhilash_Reddy Profile Picture
    Abhilash_Reddy 90 on at
    RE: Power Automate Dynamics Marketing Insights

    Able to capture the count of the Dynamics insights using below code in browser console.

    var data = {

    WidgetRequest: '{"WidgetId":"MessageEmailOpenedByContactList",' +

       '"Top":15,' +

       '"SkipToken":"",' +

       '"LanguageId":"1033",' +

       '"OffsetFromUtcInMinutes":120,' +

       '"Filter":' +

       '{"DateFrom":"2020-11-17T18:20:34.711Z",' +

       '"DateTo":"2020-12-29T18:20:34.711Z",' +

       '"Properties":[' +

       '{"Name":"MessageId",' +

       //'"Value":"8fba7c3c-1b39-eb11-a813-000d3ab29b65"' +

    //'"Value":"4aec99e2-d93e-eb11-a813-000d3ab29b65"' +

    '"Value":"242473a8-c32d-eb11-a813-000d3ab29b65"' +

       '}' +

       ']}' +

       '}'

    };

    var req = new XMLHttpRequest();

    req.open("POST", Xrm.Page.context.getClientUrl() + "/api/data/v9.1/msdyncrm_ListWidgetData", true);

    console.log("URL : " + Xrm.Page.context.getClientUrl() + "/api/data/v9.1/msdyncrm_ListWidgetData");

    req.setRequestHeader("OData-MaxVersion", "4.0");

    req.setRequestHeader("OData-Version", "4.0");

    req.setRequestHeader("Accept", "application/json");

    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");

    req.onreadystatechange = function() {

     if (this.readyState === 4) {

         req.onreadystatechange = null;

       if (this.status === 204 || this.status === 200) {

         var results = JSON.parse(this.response);

    console.log(typeof results );

    var finalresult=results.WidgetData ;

    console.log(typeof finalresult);

    var jsonData = JSON.parse(finalresult);

    console.log("Json Length : " + jsonData.data.length);

       } else {

         var error = JSON.parse(this.response).error;

         Xrm.Utility.alertDialog("Error in Action: " + error.message);

       }

     }

    };

    req.send(JSON.stringify(data));

    Now we want to create new dashboard with the values from the dynamics insights

    What is the best approach for this

    We are thinking to have custom fields on the Marketing Email Form and update them whenever there is an update on the dynamics insight

    Is it possible to use either

    1) Javascript ?

    Or

    2) Plugin ?

    Also what should be the triggering points when we use any one of the above approaches.

    If we go via JS route when should the Javascript trigger on which fields?

    If we go via Plugin route what are the fields to be considered?

    Or there is any other approach for this?

    Kind Regards

    Abhilash Reddy.

  • Abhilash_Reddy Profile Picture
    Abhilash_Reddy 90 on at
    RE: Power Automate Dynamics Marketing Insights

    Dear Protim,

    Thank you for the information.

    I also checked the blog and found that

    pkoval.com/.../

    community.dynamics.com/.../performing-organization-requests-from-c-for-dynamics-365

    OrganizationRequest request = new OrganizationRequest("msdyncrm_ListWidgetData"); request.Parameters.Add("WidgetRequest",

       "{\"WidgetId\":" +

        "\"MessageEmailDeliveredByContactList\"," +

        "\"Top\":25," +

        "\"SkipToken\":\"\"," +

        "\"LanguageId\":\"1033\"," +

        "\"OffsetFromUtcInMinutes\":120," +

        "\"Filter\":" +

            " {\"DateFrom\":\"2019-07-25T09:57:39.486Z\"," +

            " \"DateTo\":\"2019-08-25T09:57:39.486Z\"," +

            " \"Properties\":[{\"Name\":\"MessageId\"," +

            " \"Value\":\"47bd8737-f67a-e911-a972-000d3aba0352\"}]}}");

    var response = _service.Execute(request);

    So we should use this OrganizationRequest("msdyncrm_ListWidgetData") in a plugin on Contact update/create with inputs of language,datefrom, dateto?

    Is there any possibility to use javascript for the same? Any idea?

    Kind Regards

    Abhilash.

  • Suggested answer
    protc Profile Picture
    protc on at
    RE: Power Automate Dynamics Marketing Insights

    HI Abhilash,

    Thank you for your query.

    Marketing Insights are not available to access through Web API hence it is not possible to access it through Power Automate or a customer connector.

    Please refer to this post for more info. on how to programmatically access Marketing Insights: https://community.dynamics.com/365/marketing/f/dynamics-365-for-marketing-forum/408077/marketing-insight-api-data-for-plugin .

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,160 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans