DMFDefinitionGroupExecution dmfDefGrpExec;
DMFDefinitionGroup dmfDefGrp;
System.Net.Http.HttpClient httpClient = new System.Net.Http.HttpClient();
while select forupdate dmfDefGrpExec
join dmfDefGrp
where dmfDefGrp.DefinitionGroupName == dmfDefGrpExec.DefinitionGroup
&& dmfDefGrp.TriggerWebHook
{
System.IO.StringWriter stringWriter;
Newtonsoft.Json.JsonTextWriter jsonWriter;
stringWriter = new System.IO.StringWriter();
jsonWriter = new Newtonsoft.Json.JsonTextWriter(stringWriter);
str sJSON = "";
jsonWriter.WriteStartObject();
jsonWriter.WritePropertyName("ExecutionId");
jsonWriter.WriteValue(dmfDefGrpExec.ExecutionId);
jsonWriter.WriteEndObject();
sJSON = stringWriter.ToString();
System.Net.Http.HttpContent content = new System.Net.Http.StringContent(sJSON,
System.Text.Encoding::UTF8,
"application/json");
var task = httpClient.PostAsync("https://xxxxxxxxx-functionapp.azurewebsites.net/api/SyncStatus?code=5XBiPd0z_HCZpENuNAUabeXFAu5a-Lg7j_K5MWwOQpahAzFucoyn0w==",content);
task.Wait();
System.Net.Http.HttpResponseMessage msg = task.Result;
System.Net.Http.HttpContent ct = msg.Content;
var result = ct.ReadAsStringAsync();
result.Wait();
System.String s = result.Result;
mapEnumerator mapEnumerator;
Map data;
data = RetailCommonWebAPI::getMapFromJsonString(s);
mapEnumerator = data.getEnumerator();
while (mapEnumerator.moveNext())
{
if (mapEnumerator.currentKey() == "message")
{
ttsbegin;
dmfDefGrpExec.Status = mapEnumerator.currentValue();
dmfDefGrpExec.doUpdate();
ttscommit;
}
}
}
adsenseheader
Monday, November 14, 2022
Construct JSON and Webhook trigger from Dynamics 365 finance and operations through x++
Subscribe to:
Comments (Atom)