Hi Ingolme,
Here is my code :
function callRetrievePList() { var field = Xrm.Page.data.entity.attributes.get("new_taxincl"); if ((field == null) || (field.getValue() == null) || (field.getValue()[0] == null) || (field.getValue()[0].id == null)) return; var plistfield = Xrm.Page.data.entity.attributes.get("pricelevelid"); if (plistfield != null && plistfield.getValue() != null) return; var options = "$select=PriceLevelId,Name&$filter=new_vergidahil/Id eq (guid'" + (field.getValue()[0]).id + "')"; SDK.REST.retrieveMultipleRecords("PriceLevel", options, retrievePListCallBack, errorCallBack, completeCallBack);}function retrievePListCallBack(retrievedStock) { var kdvgost = Xrm.Page.data.entity.attributes.get("new_taxincl"); var deger = kdvgost.getValue(); if (deger == "0") { var plistfield = Xrm.Page.data.entity.attributes.get("pricelevelid"); if (plistfield != null && plistfield.getValue() != null) return; for (var i = 0; i < retrievedStock.length; i++) { var stock = retrievedStock[i]; var lookupReference = []; lookupReference[0] = {}; lookupReference[0].id = stock.PriceLevelId; lookupReference[0].entityType = "pricelevel"; lookupReference[0].name = stock.Name; plistfield.setValue(lookupReference); } }}function errorCallBack(errorObject) {}function completeCallBack() {}