2008-11-24 117 views
3

分享在MS Dynamics CRM中的記錄,我想做到以下幾點:如何使用工作流

當銷售人員指定的自定義實體(讓我們這一次的專業'的調用)的機會就在MS CRM 4.0系統將與被定義爲相關「主要專業知識」記錄的所有者的用戶共享商機。

我想通過工作流程自動執行此操作,但無法找到能夠完成此操作的工作流程步驟。是的,我在一些論壇上看到,它實際上不可能,只能通過.NET程序集。

經驗,有人嗎?

回答

3

正確,它只能通過.NET程序集。但是,您可以(如果您使用CRM 4)將工作流程更改爲活動的所有者,並使用與先前所有者共享的選項來使舊所有者能夠訪問您的自定義實體?

3

如果你決定使用自定義插件,你的代碼可能是這樣的:

var rights = AccessRights.ReadAccess | AccessRights.WriteAccess; 

var principalAccess = new PrincipalAccess 
{ 
    // Gives the principal read write access 
    AccessMask = rights, 

    // Set the PrincipalAccess Object's Properties 
    Principal = sharingTarget.Key 
}; 

// Create the Request Object 
var grantAcessRequest = new GrantAccessRequest(); 
// Set the Request Object's properties 
grantAcessRequest.PrincipalAccess = principalAccess; 
// Set the Target. In my case it is account record 
var entityReference = new EntityReference(localContext.PluginExecutionContext.PrimaryEntityName, 
              localContext.PluginExecutionContext.PrimaryEntityId); 
//throw new InvalidPluginExecutionException("EntityReference"); 
grantAcessRequest.Target = entityReference; 

// Execute the Request 
localContext.OrganizationService.Execute(grantAcessRequest); 
相關問題