I'm using Microsoft Dynamics CRM 2016 online and trying to use Azure Service Bus relay from custom workflow activity.
I created a custom activity (based on AzureAwareWorkflowActivity from CRM SDK) and registered an endpoint (details below). Workflow execution ends with the following error:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: 50200: Bad Gateway, Resource:sb://****.servicebus.windows.net/update*****. TrackingId:b7681665-**** SystemTracker:NoSystemTracker, Timestamp:10/10/2016 2:15:45 PM (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault).
Do you know how to fix this problem?
Workflow activity
namespace Microsoft.Crm.Sdk.Samples
{
/// <summary>
/// This class is able to post the execution context to the Windows Azure
/// Service Bus.
/// </summary>
public class AzureAwareWorkflowActivity : CodeActivity
{
/// <summary>
/// This method is called when the workflow executes.
/// </summary>
/// <param name="executionContext">The data for the event triggering
/// the workflow.</param>
protected override void Execute(CodeActivityContext executionContext)
{
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IServiceEndpointNotificationService endpointService =
executionContext.GetExtension<IServiceEndpointNotificationService>();
endpointService.Execute(ServiceEndpoint.Get(executionContext), context);
}
/// <summary>
/// Enables the service endpoint to be provided when this activity is added as a
/// step in a workflow.
/// </summary>
[RequiredArgument]
[ReferenceTarget("serviceendpoint")]
[Input("Input id")]
public InArgument<EntityReference> ServiceEndpoint { get; set; }
}
}
Endpoint