【问题标题】:In CRM Setting Value of two fields在两个字段的CRM设置值
【发布时间】:2015-12-10 04:00:56
【问题描述】:

在表格中我有日期(今天日期)和延迟(整数)和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);

但它给出了更新需要id的错误,我不知道如何获取当前记录的id。

【问题讨论】:

    标签: c# dynamics-crm workflow crm


    【解决方案1】:

    IWorkflowContext 上下文 = executionContext.GetExtension();

    Guid Id= context.PrimaryEntityId;

    【讨论】:

    • ent.Id = context.PrimaryEntityId;
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-07-13
    • 2020-08-22
    • 1970-01-01
    • 2012-10-10
    • 1970-01-01
    • 2020-03-03
    • 1970-01-01
    相关资源
    最近更新 更多