我想做以下事情:
当销售人员将自定义实体(我们将其称为“主要专业知识”)分配给MS CRM 4.0中的商机时,系统将与定义为关联“主要专业知识”的所有者的用户共享商机记录。
我想通过工作流程自动完成,但无法找到可以实现这一目标的工作流程步骤。是的,我在一些论坛上看到它实际上还不可能,只能通过.NET程序集。
经验,有人吗?
答案 0 :(得分:4)
答案 1 :(得分:3)
正确,只能通过.NET程序集。但是,您可以(如果使用CRM 4)将工作流程更改为活动所有者,并使用“以前所有者共享”选项启用旧所有者对自定义实体的访问权限?
答案 2 :(得分:3)
只能通过调用自定义工作流活动来实现。在自定义工作流活动中,您可以通过配置GrantAccessRequest and GrantAccessResponse对象来调用PrincipalAccess。
有关详细信息,请参阅此“Sharing Object”部分。
答案 3 :(得分: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);