在 Dynamics 2011 中调用对话框并向其传递多个 recordID

发布于 2024-12-07 09:30:57 字数 1304 浏览 0 评论 0原文

我希望允许用户从联系人实体中选择一个或多个联系人,然后启动一个接受记录 ID 的对话框。这个想法是向联系人添加一些自定义配置。

我目前在功能区按钮上有一个自定义操作,可以启动一个对话框,但它只接受一个记录 ID。我可以访问所选记录 ID 的列表,这不是问题,它是使用 JavaScript 将列表传递到对话框。

我似乎在 SDK 或代码片段中找不到任何内容。 我发现的最近的东西是这样的:

http ://crmmongrel.blogspot.com/2011/06/launch-dialog-from-ribbon-button-in-crm.html

有人知道这是否可能吗?我知道开箱即用的“发送直接电子邮件”允许将电子邮件发送到所选项目,因此我需要类似的东西。

我应该使用对话框还是其他东西?

以下是单击功能区按钮时调用的 javascript 代码片段:

function LaunchModalDialog(SelectedControlSelectedItemReferences,dialogID, typeName)
{

// Get selected objects
var allItems = new Array
var allItems = SelectedControlSelectedItemReferences

// Just get first item for now as dialog only seems to accept one ID
var personId = allItems[0].Id;
personId = personId.replace(/\{/g, "");
personId = personId.replace(/\}/g, "");

// Load modal
var serverUri = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');
var mypath = serverUri + '?DialogID={' + dialogID + '}&EntityName=' + typeName + '&ObjectId={' +personId + '}';
mypath = encodeURI(mypath);

// First item from selected contacts only
window.showModalDialog(mypath);

// Reload form.
window.location.reload(true);
}

I want to allow the user to select one or many contacts from the contact entity, and then launch a dialog that accepts the record IDs. The idea is to add some custom configuration to the contacts.

I've currently got a custom action on a ribbon button that launches a dialog, but it only accepts one record Id. I can get access to the list of selected record Ids, thatisn't the problem, it is passing a list to the dialog using JavaScript.

I can't seem to find anything in the SDK or code snippets.
The nearest thing I found was this:

http://crmmongrel.blogspot.com/2011/06/launch-dialog-from-ribbon-button-in-crm.html

Anyone know if this is possible? I know the out of the box Send Direct E-Mail allows an email to be sent to the selected items, so I need something similar.

Should I be using dialogs or something else?

Here is a code snippet of the javascript that is called on the click of the ribbon button:

function LaunchModalDialog(SelectedControlSelectedItemReferences,dialogID, typeName)
{

// Get selected objects
var allItems = new Array
var allItems = SelectedControlSelectedItemReferences

// Just get first item for now as dialog only seems to accept one ID
var personId = allItems[0].Id;
personId = personId.replace(/\{/g, "");
personId = personId.replace(/\}/g, "");

// Load modal
var serverUri = Mscrm.CrmUri.create('/cs/dialog/rundialog.aspx');
var mypath = serverUri + '?DialogID={' + dialogID + '}&EntityName=' + typeName + '&ObjectId={' +personId + '}';
mypath = encodeURI(mypath);

// First item from selected contacts only
window.showModalDialog(mypath);

// Reload form.
window.location.reload(true);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隐诗 2024-12-14 09:30:57

您需要在功能区中为该按钮指定 SelectedControlAllItemIds 参数。以下是描述它的链接:

http://social.microsoft.com/Forums/en/crm/thread/79f959ac-0846-472f-bff1-4f5afe692a56

--编辑--

我抱歉,我误解了 - 您的意思是启动一个实际的 CRM 对话框,而不仅仅是一个普通的 HTML 弹出对话框窗口。

根据设计,CRM 对话框不能用于多个记录,因此您将无法使用它们来实现此目的。

但是,您应该能够创建一个可以从功能区启动的 HTML Web 资源文件,并传入 SelectedControlAllItemIds 参数。然后,该 HTML Web 资源将具有一些 javascript,可使用 REST 端点更新选定的联系人(有关更多信息,请参阅 SDK)。

希望有帮助!

You'll need to specify the SelectedControlAllItemIds parameter in your Ribbon for that button. Here is a link that describes it:

http://social.microsoft.com/Forums/en/crm/thread/79f959ac-0846-472f-bff1-4f5afe692a56

--Edit--

I'm sorry, I misunderstood - you meant launch an actual CRM Dialog, not just a normal HTML pop-up dialog window.

CRM Dialogs can't be used on multiple records by design, so you aren't going to be able to use them for this.

However, you should be able to create an HTML web resource file that you can launch from the Ribbon, passing in the SelectedControlAllItemIds parameter. That HTML web resource would then have some javascript that would update the selected contacts using the REST endpoints (see the SDK for more information).

Hope that helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文