Yes i have set, below is my full code
using Microsoft.Xrm.Sdk.Query;
using System.Activities;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk;
using System;
//using Microsoft.Crm.Sdk.Messages;
namespace Workflow_Activity
{
public class LeadAssignment : CodeActivity
{
// Declare input/output variable of string type and declare it’s property like below
[Input("Topic")]
public InArgument<string> Topic { get; set; }
[Output("Day of Week")]
public OutArgument<String> DayofWeek { get; set; }
protected override void Execute(CodeActivityContext Execution)
{
string Day = "Test";
DateTime _Date = DateTime.MinValue;
//get context
IWorkflowContext context = Execution.GetExtension<IWorkflowContext>();
ITracingService tracing = Execution.GetExtension<ITracingService>();
tracing.Trace("1");
//create iorganization service object
IOrganizationServiceFactory serviceFactory = Execution.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
//get created date of the lead
Entity _lead = (Entity)service.Retrieve("lead", context.PrimaryEntityId, new ColumnSet(new string[] { "createdon" }));
if (_lead.Contains("createdon"))
{
//get day of the week based on created on date
Day = ((DateTime)_lead.Attributes["createdon"]).DayOfWeek.ToString();
}
//set value to output variable
DayofWeek.Set(Execution, Day);
//new_createdday
tracing.Trace("completed execution");
}
}
}