Hello All,
Can we programatically access data from dynamics maketing insights in power automate?
Kind Regards
Abhilash Reddy
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.
Dear Protim,
Thank you for the information.
I also checked the blog and found that
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.
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 .
André Arnaud de Cal...
292,160
Super User 2025 Season 1
Martin Dráb
230,962
Most Valuable Professional
nmaenpaa
101,156