0

此函数buttonBuzz()在实体帐户,联系人和潜在客户的表单中工作。但不在机会表单中。 主要是因为没有telephone1属性。然而,在具有电话号码的部分内部添加了“快速查看”的联系人实体。使用javaScript访问Dynamics CRM/365表单中的其他实体属性

View of the Opportunity Form w/ Contact Quick View marked in red

我认为它可以与telephone1访问如干脆不Xrm.page

任何想法如何,我可以从“快速查看”里抢属性?

我不知道“快速浏览”窗口是否是iFrame的一种形式。而如果是我不知道如何与Xrm.Page.getAttribute("telephone1").getValue();

function buttonBuzz(exObj) { 
var phoneNumber; 

// Here i store the "telephone1" Attribute from the current .page 
phoneNumber = Xrm.Page.getAttribute("telephone1").getValue(); 

if (phoneNumber != null) {  **Sends phonenumber**   } ... 
+0

而顺便说一句表格只是填充虚拟信息。所以当然没有显示任何保密信息。 –

回答

1

快速查看显示的数据访问它从查找字段中选择一个记录,在这种情况下联系。您可以使用OData端点从相关记录查询数据。

你首先需要获得选择的记录的GUID:

var contactId = Xrm.Page.getAttribute("parentcontactid")[0].id || null; 

然后,您需要发送一个SDK.REST请求,传递参数的记录的ID(contactIdentityNamecolumns

var entityName = "Contact"; 
var columns = "Address1_Telephone1, FirstName, LastName";  

SDK.REST.retrieveRecord(contactId, entityName, columns, null, function(result) { 
    // Success, logic goes here. 
    var address1_Telephone1 = result.Address1_Telephone1; 
}, function(e) { 
    console.error(e.message); 
}); 

,以及你的JavaScript文件,您将需要包括SDK.REST.js文件THA t包含在您的商机表单库中的MS CRM SDK download中。

相关问题