問題:如何通過JS獲取列表中所選記錄信息? 解決辦法: The CRM2011 Ribbon has a special set of parameters called 'CrmParameters' that provide information about the current sessi ...
問題:如何通過JS獲取列表中所選記錄信息?
解決辦法:
The CRM2011 Ribbon has a special set of parameters called 'CrmParameters' that provide information about the current session such as the selected rows in a sub-grid. We can use the 'SelectedControlSelectedItemReferences' parameter to pass an array of selected items in the grid to our custom JavaScript function. Each object in the array contains the following fields:
Field Name | Type | Example |
Id | string | {2D080FA6-8D18-E211-9DB7-000C299FFE7D} |
Name | string | Some Account |
TypeCode | Number | 1 |
TypeName | string | account |
實例:
function run(selectedItems) { var selectedItem = selectedItems[0]; // Here you can use the information below to open a new window or whatever! alert("Id=" + selectedItem.Id + "\nName=" + selectedItem.Name + "\nTypeCode=" + selectedItem.TypeCode.toString() + "\nTypeName=" + selectedItem.TypeName); }