0
0

More than 1 year has passed since last update.

Retrieve Entity Record With JavaScript

Last updated at Posted at 2022-10-28

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); //
}
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0