We are using D365 Workflow Tools: https://github.com/demianrasko/Dynamics-365-Workflow-Tools and in one of our instances the output for GetInitatingUser is always empty. I have tried to reimplement the activity with the following code:
protected override void Execute(CodeActivityContext executionContext)
{
ITracingService tracer = executionContext.GetExtension<ITracingService>();
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
tracer.Trace($"Initating User: {context.InitiatingUserId}");
UserResult.Set(executionContext, new EntityReference("systemuser", context.InitiatingUserId));
}
[Output("UserResult")]
[ReferenceTarget("systemuser")]
public OutArgument<EntityReference> UserResult { get; set; }
I can see the user id in the trace log but the property returned is empty too. The activity worked fine last week. Does anyone have any idea or tips?
Thank you!