Dynamics2011よく使っていたデータの取得方法
function GetEntityDetails() {
var result = new Array();
var lookupFieldId = "";
if (Xrm.Page.getAttribute("new_entity").getValue() != null) {
lookupFieldId = Xrm.Page.getAttribute("new_entity").getValue()[0].id;
}
if (lookupFieldId != "") {
var field1Value = "";
var field2Value = "";
//医療機関のオブジェクト取得
XrmServiceToolkit.Rest.Retrieve(lookupFieldId, "new_entityNameSet", null, null, function (result) { entityName = result; }, XrmServiceToolkit.Common.ShowError, false);
if (!IsNull(entityName.field1)) {
result[0] = entityName.field1;
}
if (!IsNull(entityName.field2)) {
result[1] = entityName.field2;
}
}
}
//*****************************************************参考
//https://www.patrickschadler.com/retrieve-entity-xrmservicetoolkit/
var cols = ["name", "value1"];
var retrievedCampaign = XrmServiceToolkit.Soap.Retrieve("campaign", campaignId, cols);
if (retrievedCampaign.attributes["name"] != undefined) {
var name = retrievedCampaign.attributes["name"].value;
}
//取得項目確定
XrmServiceToolkit.Rest.Retrieve(product[0].id, "new_productSet", "new_category", null, function (result) { productresult = result }, XrmServiceToolkit.Common.ShowError, false);
var category = productresult.new_category != null ? productresult.new_category.Value : null;
if (category == 1) {
// 定期非常勤の場合
Xrm.Page.ui.tabs.get("tab_approach_t").setVisible(true); //
}