在Dynamics 2011中调用对话框,并将多个recordID传递给它 [英] Calling a dialog in Dynamics 2011 and passing multiple recordIDs to it

查看:208
本文介绍了在Dynamics 2011中调用对话框,并将多个recordID传递给它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想允许用户从联系实体中选择一个或多个联系人,然后启动一个接受记录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)
{

//获取所选对象
var allItems = new Array
var allItems = SelectedControlSelectedItemReferences

//刚刚获取第一个项目,因为对话框似乎只接受一个I​​D
var personId = allItems [0] .Id;
personId = personId.replace(/ \ {/ g,);
personId = personId.replace(/ \} / g,);

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

//所选联系人中的第一个项目
window.showModalDialog(mypath);

//重新加载表单。
window.location.reload(true);
}


解决方案

您需要指定该按钮的功能区中的SelectedControlAllItemIds参数。这是一个描述它的链接:



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



- 修改 -



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



CRM对话框不能在设计的多个记录上使用,因此您将无法使用它们。



但是,您应该可以创建一个HTML网络资源文件,您可以从功能区启动,传入SelectedControlAllItemIds参数。那么那个HTML网页资源就会有一些JavaScript,可以使用REST端点来更新选定的联系人(参见SDK了解更多信息)。



希望有帮助! >

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);
}

解决方案

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!

这篇关于在Dynamics 2011中调用对话框,并将多个recordID传递给它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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