protected override void Execute(CodeActivityContext executionContext) { #region Bolierplate IWorkflowContext context = executionContext.GetExtension <IWorkflowContext>(); IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>(); IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId); var tracing = executionContext.GetExtension <ITracingService>(); #endregion var parameterName = ParameterName.Get(executionContext); using (var ctx = new XrmServiceContext(service)) { var parameter = (from p in ctx.CreateQuery <ultra_systemparameter>() where p.ultra_name == parameterName select p.ultra_parametervalue) .FirstOrDefault(); if (parameter != null) { ParameterValue.Set(executionContext, parameter); } } }
string ICodingStyle.GetName(IParameter parameter) => ParameterName.Get(parameter);
// Module defining this command // Optional custom code for this activity /// <summary> /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// </summary> /// <param name="context">The NativeActivityContext for the currently running activity.</param> /// <returns>A populated instance of System.Management.Automation.PowerShell</returns> /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks> protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context) { System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create(); System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName); // Initialize the arguments if (Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if (Verb.Expression != null) { targetCommand.AddParameter("Verb", Verb.Get(context)); } if (Noun.Expression != null) { targetCommand.AddParameter("Noun", Noun.Get(context)); } if (Module.Expression != null) { targetCommand.AddParameter("Module", Module.Get(context)); } if (FullyQualifiedModule.Expression != null) { targetCommand.AddParameter("FullyQualifiedModule", FullyQualifiedModule.Get(context)); } if (CommandType.Expression != null) { targetCommand.AddParameter("CommandType", CommandType.Get(context)); } if (TotalCount.Expression != null) { targetCommand.AddParameter("TotalCount", TotalCount.Get(context)); } if (Syntax.Expression != null) { targetCommand.AddParameter("Syntax", Syntax.Get(context)); } if (ShowCommandInfo.Expression != null) { targetCommand.AddParameter("ShowCommandInfo", ShowCommandInfo.Get(context)); } if (ArgumentList.Expression != null) { targetCommand.AddParameter("ArgumentList", ArgumentList.Get(context)); } if (All.Expression != null) { targetCommand.AddParameter("All", All.Get(context)); } if (ListImported.Expression != null) { targetCommand.AddParameter("ListImported", ListImported.Get(context)); } if (ParameterName.Expression != null) { targetCommand.AddParameter("ParameterName", ParameterName.Get(context)); } if (ParameterType.Expression != null) { targetCommand.AddParameter("ParameterType", ParameterType.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }