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中。

相關問題