Hi,
Plugin code:
try
{
QueryExpression endpointQuery = new QueryExpression("serviceendpoint");
endpointQuery.ColumnSet = new ColumnSet("url");
ConditionExpression urlCond = new ConditionExpression("url", ConditionOperator.EndsWith, "MyWebHook");
endpointQuery.Criteria.AddCondition(urlCond);
var endpointColl = Service.RetrieveMultiple(endpointQuery);
if (endpointColl.Entities.Count == 0)
{
throw new InvalidPluginExecutionException("Failed to retrieve the endpoint");
}
var endpoint = endpointColl[0];
Tracing.Trace($"Taking Enpoint URL: {endpoint["url"]}");
Tracing.Trace($"Endpoint: {endpoint.Id}");
Tracing.Trace("Posting the execution context.");
string response = cloudService.Execute(new EntityReference("serviceendpoint", endpoint.Id), Context);
//**ISSUE IS HERE STRING IS ALWAYS NULL
if (!String.IsNullOrEmpty(response))
{
Tracing.Trace("Response = {0}", response);
}
Tracing.Trace("Done.");
}
Web hook:
[FunctionName("MyWebHook")]
public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Function, "post", WebHookType = "genericJson", Route = null)]HttpRequestMessage req, TraceWriter log)
{
IOrganizationService service = null;
log.Info("In CheckAttachment");
var contextJson = await req.Content.ReadAsStringAsync();
var context = contextJson.GetContext();
return req.CreateResponse(HttpStatusCode.OK, "Created");
}
In postman I can see "Created" is returned but not in the plugin trace:
Posting the execution context.
Done.
Completed plugin execution
It goes straight to null instead of tracing the string that should be in the response.