因此,我正在尝试为动态CRM 2016中的功能区按钮编写javascript代码,该代码将从活动潜在客户窗口中可以看到的潜在客户列表中获取电话号码。Dynamics CRM 2016 Javascript for eachach不支持
然而,当我尝试运行它,我得到一个错误,告诉我
我踏入我的代码(我调试),我看到这个错误
这是我正在使用的代码。
function updateSelected(SelectedControlSelectedItemIds, SelectedEntityTypeName) {
// this should iterate through the list
SelectedControlSelectedItemIds.forEach(
function (selected, index) {
//this should get the id and name of the selected lead
getPhoneNumber(selected, SelectedEntityTypeName);
});
}
//I should have the lead ID and Name here, but it is returning null
function getPhoneNumber(id, entityName) {
var query = "telephone1";
Sdk.WebApi.retrieveRecord(id, entityName, query, "",
function (result) {
var telephone1 = result.telephone1;
// I'm trying to capture the number and display it via alert.
alert(telephone1);
},
function (error) {
alert(error);
})
}
任何帮助表示赞赏。
您确定没有在Ribbon Workbench中混淆参数吗?我认为你只需选择实体名称作为第一个参数,选择ID作为第二个参数。应该很容易调试 - SelectedControlSelectedItemIds是什么类型? –
我相信SelectedControlSelectedItemIds是一个字符串。 –
如果它是一个字符串,那么你必须已经混淆了你的参数 –