通过Homegrid视图上的功能区按钮通过JavaScript更新CRM 2011中的字段 [英] Updating field in CRM 2011 through javascript from ribbon button on homegrid view
问题描述
我正在尝试在销售线索的初始列表或本地网格视图上创建一个按钮,该按钮将每次为选定的销售线索将特定字段的值设置为相同的值。有人知道我如何通过JavaScript做到这一点吗?
I am trying to create a button on the initial list or homegrid view of leads that will set the value of a specific field to the same value every time for the lead that is selected. Anyone know how i can do this through javascript?
谢谢!
推荐答案
要基于詹姆斯的答案,您可以使用 CrmParameter
SelectedControlSelectedItemIds
获取在首页网格中选择的所有潜在客户的列表。有在MSDN论坛上的答案,解释了如何执行此操作,复制如下。您可以在Xml源代码中或在我认识的两个CRM功能区编辑器中执行此操作。
To build on James's answer, you can use the CrmParameter
SelectedControlSelectedItemIds
to get a list of all the leads selected in a homepage grid. There is an answer on the MSDN forums that explains how to do this, copied below. You can do this in the Xml source or in the two CRM ribbon editors I know of.
在那之后,您将需要使用其中一种CRM Web服务的Update
方法循环遍历 Guid
数组并相应地更新每个实体/数据库行。我已经提到 Avanade的出色Web资源链接两个记录,MSDN也对此进行了补充说明。
After that, you would then need to use the Update
method of one of the CRM webservices to loop through the Guid
array and update each entity/database row accordingly. I've mentioned Avanade's excellent web resource before, and MSDN has some additional documention on this as well.
- Walkthrough: Use the SOAP Endpoint for Web Resources with JScript
- Sample: Create, Retrieve, Update and Delete Using the REST Endpoint with JavaScript
<CommandDefinition Id="Account.Form.CustomGroup.Button.A.Command">
<Actions>
<JavaScriptFunction Library="$webresource:AccountFormLibrar"
FunctionName="CreateNewAccount">
<CrmParameter Value="SelectedControlSelectedItemIds"/>
</JavaScriptFunction>
</Actions>
</CommandDefinition>
function CreateNewAccount (prmRecordGUID) {
//prmRecordGUID will recieve all GUIDS in comma seperated i.e. GUID1,GUID2,GUID3
}
这篇关于通过Homegrid视图上的功能区按钮通过JavaScript更新CRM 2011中的字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!