Dynamics CRM 2011-如何关联两个不同的实体 [英] Dynamics CRM 2011 - How to relate two different entities

查看:99
本文介绍了Dynamics CRM 2011-如何关联两个不同的实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个不同的自定义实体。我使用表格手动创建的第一个(付款)。付款创建后,它会执行一个插件,该插件将创建一个或多个凭证。该插件可以毫无问题地创建凭证。问题是当我转到付款并单击优惠券时,没有看到我刚刚创建的优惠券的列表。如果我查看所有的凭单,我可以看到我刚刚创建的一张。从付款到凭证有一对多的关系。对于关联的实体,我需要在我的插件中做什么?

I have two different custom entities. The first one (payment) I create manually using a form. When the payment is created it executes a plugin that will create one or more vouchers. The plugin creates the voucher without a problem. The problem is when I go to the payment and click on vouchers, I don't see the voucher I just created listed. If I go look at all the vouchers I can see the one I just created. There is a 1 to many relationship from payment to voucher. What do I need to do in my plugin for the entities to be related?

谢谢

推荐答案

听起来像您在创建代金券时尚未将关系设置回触发付款。

Sounds like you just haven't setup the relationship back to the triggering payment when you create the voucher.

给出了1:N关系,由于您是在付款插件的上下文中创建凭证,因此可以将凭证上的查询设置为该插件当前针对其执行的付款(目标)。

Given the 1:N relationship and since you're creating the voucher in the context of a payment plugin you can set the lookup on the voucher to the payment for which the plugin is currently executing (target).

new_voucher.new_paymentid = new EntityReference(...);

new_paymentid 是凭证的查找属性(很明显,在您的情况下,它将被称为其他名称)。对于 EntityReference ,您需要定义产品的EntityName和ID,您可以从目标中读取它们。

new_paymentid is the lookup attribute on voucher (obviously it'll be called something else in your case). For the EntityReference you'll need to define the EntityName and Id of the product, which you can read from the target.

这篇关于Dynamics CRM 2011-如何关联两个不同的实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆