
Hi all,
maybe i dont get it, but i have a new wf-problem, which i never had before ...
I have a workflow, where as part of it, i need to compare, if the looged in User or the wf-user who made the changes is not the admin and not another User.
But in the if-condition-step of the worklow i only find the values of the primary entity and its related entitis and a local value "process" .. but in none of these i can find f.e. the loggend in user.
either I'm just beside me or this is really no otb-functionality. maybe i need to create a custom-wf-step?
Or does someone had a similar problem, and there is maye be wf-steps-compilation, which has this feature?
THX, Greets PeB
*This post is locked for comments
I have the same question (0)Hi PeB,
You can get the user running the workflow but you need to call a custom workflow activity that returns the user as an Output parameter. Then you can reference the worklfow user in the rest of your workflow. This will only work if the workflow is synchronous though.
I used code like this all the time, super easy to do:
[Output("Workflow User")]
[ReferenceTarget("systemuser")]
public OutArgument<EntityReference> WorkflowUser { get; set; }
protected override void Execute(CodeActivityContext context)
{
IWorkflowContext workflowContext = context.GetExtension<IWorkflowContext>();
this.WorkflowUser.Set(context, new EntityReference("systemuser", workflowContext.InitiatingUserId));
}
Hope this helps! I'd appreciate if you'd mark this as a Verified answer.
Thanks,
Aiden