Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Workflow: System does not set systemuser EntityReference in custom workflow activity

$
0
0

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!


Viewing all articles
Browse latest Browse all 79901

Trending Articles