在 CRM 中设置两个字段的值
In CRM Setting Value of two fields
在表格中我有日期(今天的日期)和延迟(整数)和 NextDate (=Today + delay)
我只想从用户那里获取延迟并自动设置其他延迟
这是我的代码:
[Input("Delay")]
[Default("12")]
public InArgument<double> Delay { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
Entity ent = new Entity("bartar_callcenterreport");
ent.Id = Delay.Get(executionContext).Id;
int delay = (int)Delay.Get(executionContext);
ent["bartar_date"] = DateTime.Today;
ent["bartar_nextcall"] = DateTime.Today.AddDays(delay);
service.Update(ent);
但是报错update需要id,不知道怎么获取当前记录的id
IWorkflowContext 上下文 = executionContext.GetExtension();
Guid ID= context.PrimaryEntityId;
在表格中我有日期(今天的日期)和延迟(整数)和 NextDate (=Today + delay)
我只想从用户那里获取延迟并自动设置其他延迟
这是我的代码:
[Input("Delay")]
[Default("12")]
public InArgument<double> Delay { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
Entity ent = new Entity("bartar_callcenterreport");
ent.Id = Delay.Get(executionContext).Id;
int delay = (int)Delay.Get(executionContext);
ent["bartar_date"] = DateTime.Today;
ent["bartar_nextcall"] = DateTime.Today.AddDays(delay);
service.Update(ent);
但是报错update需要id,不知道怎么获取当前记录的id
IWorkflowContext 上下文 = executionContext.GetExtension();
Guid ID= context.PrimaryEntityId;