2009-09-11 86 views
2

我在CRM中創建了一個創建任務的自定義工作流程活動。工作流附加到一個機會。當我創建我的任務時,我想將「合適的眼光」設置爲相關機會的指導。創建任務的CRM中的自定義工作流程活動

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

這可能嗎?我認爲這很簡單。

回答

2

假設您的活動的前幾行是這樣的:

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

那麼你應該能夠做到這一點:

entity.regardingobjectid = new Lookup("opportunity", context.PrimaryEntityId); 
+0

謝謝馬特。那只是訣竅。 – 2009-09-12 13:48:40

相關問題