【问题标题】:Microsoft Dynamics CRM Workflow Tutorial not WorkingMicrosoft Dynamics CRM 工作流教程不起作用
【发布时间】:2018-06-27 04:21:24
【问题描述】:

我正在尝试按照教程进行操作: https://msdn.microsoft.com/en-us/library/gg509012.aspx

但是,当我排队时:

protected override void Execute(CodeActivityContext executionContext)
{
    IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();

    //Create an Organization Service
    IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
    IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);

    //Retrieve the contact id
    Guid contactId = this.Contact.Get(executionContext).Id;
}

它在 C# 中给出错误。

C#“程序”不包含“联系人”的定义,并且找不到接受“程序”类型的第一个参数的扩展方法“联系人”您是否缺少 using 指令或程序集引用?

this.Contact 是什么?

【问题讨论】:

    标签: c# sdk dynamics-crm microsoft-dynamics


    【解决方案1】:

    联系人是自定义活动工作流的一个参数

    //Define the properties
    [RequiredArgument]
    [Input("Update Next Birthdate for")]
    [ReferenceTarget("contact")]
    
    public InArgument<EntityReference> Contact { get; set; }
    
    protected override void Execute(CodeActivityContext executionContext)
    {
        IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
    
        //Create an Organization Service
        IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
        IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
    
        //Retrieve the contact id
        Guid contactId = this.Contact.Get(executionContext).Id;
    }
    

    当您从工作流或操作调用自定义时,您必须发送所需的输入参数,例如联系人。

    【讨论】:

    • 好的,谢谢。那么我如何使用它来引用我的自定义实体呢?带有字段 new_entityID 的 New_MyEntity?我在哪里发送所需的输入?
    • @Techcrium [ReferenceTarget("contact")] 是您的实体名称,应该是 [ReferenceTarget("new_myentity")]。您从工作流或操作调用自定义活动工作流,因此创建其中一个并调用自定义发送您需要的实体。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多