Last active
July 17, 2019 04:52
-
-
Save muhammad-naderi/3fdbe9ac3f2cc43809f1d4f62ff0e44a to your computer and use it in GitHub Desktop.
Get running / initiating user in Dynamics 365
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Activities; | |
using Microsoft.Xrm.Sdk; | |
using Microsoft.Xrm.Sdk.Workflow; | |
namespace GeneralTools | |
{ | |
public class GetRunningUser : CodeActivity | |
{ | |
protected override void Execute(CodeActivityContext executionContext) | |
{ | |
base.Execute(executionContext); | |
UserArgument.Set(executionContext, new EntityReference("systemuser", context.UserId)); | |
InitiatingUserArgument.Set(executionContext, new EntityReference("systemuser", context.InitiatingUserId)); | |
} | |
[Output("Running User")] | |
[ReferenceTarget("systemuser")] | |
public OutArgument<EntityReference> UserArgument { get; set; } | |
[Output("Initiating User")] | |
[ReferenceTarget("systemuser")] | |
public OutArgument<EntityReference> InitiatingUserArgument { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment