2

タスクを作成するカスタム ワークフロー アクティビティを CRM で作成しました。ワークフローは商談に関連付けられています。タスクを作成するときに、「regardingobjectid」を関連する機会の GUID に設定したいと考えています。

        ICrmService crmService = context.CreateCrmService();
        task entity = new task();
        entity.subject = taskSubject;
        entity.regardingobjectid.Value = ??????
        crmService.Create(entity);

これは可能ですか?シンプルだろうと思いました。

4

1 に答える 1

2

アクティビティの最初の数行が次のようになっていると仮定します。

IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));   
IWorkflowContext context = contextService.Context;

次に、これを実行できるはずです。

entity.regardingobjectid = new Lookup("opportunity", context.PrimaryEntityId);
于 2009-09-11T12:15:16.890 に答える