Understanding Entity Relationship Behaviors in Microsoft Dynamics 365/CRM

本文介绍如何在Microsoft Dynamics CRM中调整1:N关系的行为设置,特别是针对重新分配账户时接触人所有权的变化。通过更改关系类型为可配置级联,可以独立设置各种操作行为,如分配、共享等,以更好地适应组织需求。

Relationships are one of the core pieces of functionality in Microsoft Dynamics CRM. From time-to-time, I see customers who end up getting surprised by how an action they apply to a record, affects the related records.

A common example of this would be re-assigning an account and how it affects the ownership of the related contacts.

By default, this relationship is configured as a Parental relationship, so in this scenario, all the related contacts are also assigned to the new account owner. In many instances, this is the desired outcome, but in some cases, you’d rather keep the contact ownership the same.

Luckily you are not locked into this behavior if it doesn’t suit your organization’s needs.

In the customization’s area under each entity, you’ll see the lists of 1:N relationships and N:1 relationships. In the earlier example you would find the relationship under 1:N, and then you’d be looking for the relationship whose parent entity is account and related entity is contact.

Once you’ve opened that up you can see the type of behavior for the relationship is configurable. In this case, we can change the behavior from Parental to Configurable Cascading. This would allow you to alter the Assign behavior to another option so it doesn’t update the owners of the child records.

Here are the options that are available, but keep in mind that not all types are available for all relationships in the system.

Type of Behavior

  • Parental: this forces the Cascade All effect to all the individual behaviors
  • Referential: this forces the Cascade None effect to all the individual behaviors except Delete which is locked to Remove Link
  • Referential, Restrict Delete: this forces the Cascade None effect to all the individual behaviors except Delete which is locked to Restrict
  • Configurable Cascading: this allows you to define the individual behaviors independently

Individual Behaviors

  • Assign – the record owner changes
  • Share  – the record is shared with another user
  • Unshare – the record is unshared with another user
  • Reparent – the referencing attribute of a parental relationship is changed
  • Delete – the record is deleted
  • Merge – the record is merged with another record

For Assign, Share, Unshare, and Reparent the options are:

  • Cascade All – the change is applied to all associated records
  • Cascade Active – the change is applied to all associated records that are active
  • Cascade User Owned – the change is applied to all associated records owned by the user who owns the original record
  • Cascade None – the change is not applied to any other records

For Delete the options are:

  • Cascade All
  • Remove Link – the link between the original and referenced records is removed
  • Restrict – prevents the original record from being deleted when related to child records

For Merge the options are:

  • Cascade All
  • Cascade None

 

### 在 Dynamics 365 CRM 中隐藏注释输入框的方法 在 Dynamics 365 CRM 中,隐藏注释输入框可以通过多种方式实现,具体取决于用户的需求以及场景。以下是几种常见的方法: #### 方法一:通过自定义表单字段属性 在 Dynamics 365 中,可以通过设置字段的可见性来隐藏注释输入框。此操作可以在实体表单编辑器中完成。 1. 打开实体表单编辑器,找到包含注释输入框的字段。 2. 使用“字段属性”中的“安全性和可见性”选项,将该字段的可见性设置为“不可见”。 3. 保存并发布更改以使设置生效[^2]。 #### 方法二:使用 JavaScript 脚本 如果需要动态控制注释输入框的显示或隐藏,可以使用 JavaScript 脚本来实现。以下是一个示例代码片段,用于在页面加载时隐藏注释输入框: ```javascript function hideNotesField(executionContext) { var formContext = executionContext.getFormContext(); var notesControl = formContext.getControl("notes"); // 替换为实际字段名称 if (notesControl) { notesControl.setVisible(false); } } ``` 将上述脚本绑定到表单的 `OnLoad` 事件中即可生效[^3]。 #### 方法三:通过业务规则 Dynamics 365 提供了内置的业务规则功能,允许用户根据特定条件设置字段的可见性。例如,可以创建一条规则,当某个条件满足时隐藏注释输入框。 1. 进入实体的“业务规则”配置界面。 2. 创建一条新规则,并选择注释字段作为目标。 3. 设置规则条件(如无需条件则直接隐藏)。 4. 发布规则以应用更改[^4]。 #### 方法四:通过 Power Automate 或插件 对于更复杂的场景,可以使用 Power Automate 或编写自定义插件来隐藏注释输入框。这种方式通常适用于需要结合其他逻辑的操作。 - **Power Automate**:可以触发自动化流程,在特定条件下更新字段的可见性。 - **插件**:编写 C# 插件以拦截表单加载事件并修改字段状态[^5]。 ```csharp protected void ExecutePreAccountUpdate(LocalPluginContext localPluginContext) { if (localPluginContext == null) { throw new ArgumentNullException(nameof(localPluginContext)); } var targetEntity = localPluginContext.PluginExecutionContext.InputParameters["Target"] as Entity; if (targetEntity.Contains("notes")) { targetEntity.Attributes.Remove("notes"); } } ``` ### 注意事项 - 隐藏注释输入框可能会影响用户体验,请确保此操作符合业务需求。 - 在使用 JavaScript 或插件时,需测试其兼容性以避免潜在问题。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值