我在点击自定义功能区按钮时尝试复制事件实体。一切都还可以,但我对某些领域有疑问。我将分享以下代码。 当我删除导致问题的字段一切正常时,我的Web资源打开一个新实体并填充字段。如果我不删除那些字段我得到错误。奇怪的情况是,如果我创建另一个网络资源与我从我的第一个Wresource删除的字段,它也可以正常工作。我错过了什么或是否有字段限制?
代码工作正常: 评论出局部分正在制造问题。
function test() {
if (Xrm.Page.data.entity.attributes.get("customerid").getValue() != null) {
var CustomerId = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].id;
var CustomerName = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].name;
var CustomerType = Xrm.Page.data.entity.attributes.get("customerid").getValue()[0].entityType;
}
if (Xrm.Page.data.entity.attributes.get("new_malzeme").getValue() != null) {
var MatNumbId = Xrm.Page.data.entity.attributes.get("new_malzeme").getValue()[0].id;
var MatNumbName = Xrm.Page.data.entity.attributes.get("new_malzeme").getValue()[0].name;
}
if (Xrm.Page.data.entity.attributes.get("new_satisburosu").getValue() != null) {
var SatBurId = Xrm.Page.data.entity.attributes.get("new_satisburosu").getValue()[0].id;
var SatBurName = Xrm.Page.data.entity.attributes.get("new_satisburosu").getValue()[0].name;
}
var Talep = Xrm.Page.data.entity.attributes.get("new_talep").getValue();
var ilgiliKisi = Xrm.Page.data.entity.attributes.get("new_ilgilikisi").getValue();
var UrunAdi = Xrm.Page.data.entity.attributes.get("new_urunadi").getValue();
var Zamanlama = Xrm.Page.data.entity.attributes.get("new_zamanlama").getValue();
var Email = Xrm.Page.data.entity.attributes.get("new_mail").getValue();
if (Xrm.Page.data.entity.attributes.get("new_siparis").getValue() != null) {
var SiparisId = Xrm.Page.data.entity.attributes.get("new_siparis").getValue()[0].id;
var SiparisName = Xrm.Page.data.entity.attributes.get("new_siparis").getValue()[0].name;
}
var Adet = Xrm.Page.data.entity.attributes.get("new_adet").getValue();
var Durumu = Xrm.Page.data.entity.attributes.get("incidentstagecode").getValue();
var telefon = Xrm.Page.data.entity.attributes.get("new_telefon").getValue();
var SrvOzt = Xrm.Page.data.entity.attributes.get("title").getValue();
if (Xrm.Page.data.entity.attributes.get("new_mhyetkilisi").getValue() != null) {
var MHyetkilisiId = Xrm.Page.data.entity.attributes.get("new_mhyetkilisi").getValue()[0].id;
var MHyetkilisiName = Xrm.Page.data.entity.attributes.get("new_mhyetkilisi").getValue()[0].name;
}
var islemBelgNo = Xrm.Page.data.entity.attributes.get("new_islembelgeno").getValue();
var Garanti = Xrm.Page.data.entity.attributes.get("new_garanti").getValue();
var SerTalTuru = Xrm.Page.data.entity.attributes.get("casetypecode").getValue();
var Sevkiyat = Xrm.Page.data.entity.attributes.get("new_sevkiyatsekli").getValue();
var SerAdrs = Xrm.Page.data.entity.attributes.get("new_servisadresi").getValue();
var Oncelik = Xrm.Page.data.entity.attributes.get("prioritycode").getValue();
var SemtIlce = Xrm.Page.data.entity.attributes.get("new_semt_ilce").getValue();
if (Xrm.Page.data.entity.attributes.get("new_sehir").getValue() != null) {
var SehirId = Xrm.Page.data.entity.attributes.get("new_sehir").getValue()[0].id;
var SehirName = Xrm.Page.data.entity.attributes.get("new_sehir").getValue()[0].name;
}
var TespitSnc = Xrm.Page.data.entity.attributes.get("new_tespitsonucu").getValue();
var HataKay = Xrm.Page.data.entity.attributes.get("new_mhhatakaynagi").getValue();
var HataAdi = Xrm.Page.data.entity.attributes.get("new_hatasebebi").getValue();
var HataliBrm = Xrm.Page.data.entity.attributes.get("new_hatalibirim").getValue();
var YplnHata = Xrm.Page.data.entity.attributes.get("new_hataadi").getValue();
var MHTop = Xrm.Page.data.entity.attributes.get("new_mhtoplanti").getValue();
var KapanisNdn = Xrm.Page.data.entity.attributes.get("new_kapansnedeni").getValue();
if (Xrm.Page.data.entity.attributes.get("new_satissor").getValue() != null) {
var SatSorId = Xrm.Page.data.entity.attributes.get("new_satissor").getValue()[0].id;
var SatSorName = Xrm.Page.data.entity.attributes.get("new_satissor").getValue()[0].name;
}
var Uygunsuzluk = Xrm.Page.data.entity.attributes.get("new_uygunsuzlukmaliyeti").getValue();
if (Xrm.Page.data.entity.attributes.get("new_departman").getValue() != null) {
var DepartmanId = Xrm.Page.data.entity.attributes.get("new_departman").getValue()[0].id;
var DepartmanName = Xrm.Page.data.entity.attributes.get("new_departman").getValue()[0].name;
}
var SerTalKay = Xrm.Page.data.entity.attributes.get("caseorigincode").getValue();
var SatFyt = Xrm.Page.data.entity.attributes.get("new_satisfiyati2").getValue();
if (Xrm.Page.data.entity.attributes.get("new_anketiyapan").getValue() != null) {
var AnketiYapanId = Xrm.Page.data.entity.attributes.get("new_anketiyapan").getValue()[0].id;
var AnketiYapanName = Xrm.Page.data.entity.attributes.get("new_anketiyapan").getValue()[0].name;
}
var AnketSonucu = Xrm.Page.data.entity.attributes.get("customersatisfactioncode").getValue();
var MusteriGors = Xrm.Page.data.entity.attributes.get("new_musterigorusleri").getValue();
var tekraronl = Xrm.Page.data.entity.attributes.get("new_tekraronleme").getValue();
var Aciklama = Xrm.Page.data.entity.attributes.get("description").getValue();
var parameters = {};
if (CustomerId != null && CustomerName != null) {
parameters["customerid"] = CustomerId;
parameters["customeridname"] = CustomerName;
parameters["customeridtype"] = CustomerType;
}
if (MatNumbId != null && MatNumbName != null) {
parameters["new_malzeme"] = MatNumbId;
parameters["new_malzemename"] = MatNumbName;
}
if (SatBurId != null && SatBurName != null) {
parameters["new_satisburosu"] = SatBurId;
parameters["new_satisburosuname"] = SatBurName;
}
if (Talep != null) {
parameters["new_talep"] = Talep;
}
if (ilgiliKisi != null) {
parameters["new_ilgilikisi"] = ilgiliKisi;
}
if (UrunAdi != null) {
parameters["new_urunadi"] = UrunAdi;
}
if (Zamanlama != null) {
parameters["new_zamanlama"] = Zamanlama;
}
if (Email != null) {
parameters["new_mail"] = Email;
}
if (SiparisId != null && SiparisName != null) {
parameters["new_siparis"] = SiparisId;
parameters["new_siparisname"] = SiparisName;
}
if (Adet != null) {
parameters["new_adet"] = Adet;
}
if (Durumu != null) {
parameters["incidentstagecode"] = Durumu;
}
if (telefon != null) {
parameters["new_telefon"] = telefon;
}
if (SrvOzt != null) {
parameters["title"] = SrvOzt;
}
if (MHyetkilisiId != null && MHyetkilisiName != null) {
parameters["new_mhyetkilisi"] = MHyetkilisiId;
parameters["new_mhyetkilisiname"] = MHyetkilisiName;
}
if (islemBelgNo != null) {
parameters["new_islembelgeno"] = islemBelgNo;
}
if (Garanti != null) {
parameters["new_garanti"] = Garanti;
}
if (SerTalTuru != null) {
parameters["casetypecode"] = SerTalTuru;
}
if (Sevkiyat != null) {
parameters["new_sevkiyatsekli"] = Sevkiyat;
}
if (SerAdrs != null) {
parameters["new_servisadresi"] = SerAdrs;
}
if (Oncelik != null) {
parameters["prioritycode"] = Oncelik;
}
if (SemtIlce != null) {
parameters["new_semt_ilce"] = SemtIlce;
}
if (TespitSnc != null) {
parameters["new_tespitsonucu"] = TespitSnc;
}
if (HataKay != null) {
parameters["new_mhhatakaynagi"] = HataKay;
}
if (HataAdi != null) {
parameters["new_hatasebebi"] = HataAdi;
}
if (HataliBrm != null) {
parameters["new_hatalibirim"] = HataliBrm;
}
if (YplnHata != null) {
parameters["new_hataadi"] = YplnHata;
}
if (MHTop != null) {
parameters["new_mhtoplanti"] = MHTop;
}
if (KapanisNdn != null) {
parameters["new_kapansnedeni"] = KapanisNdn;
}
/*if (SatSorId != null && SatSorName != null) {
parameters["new_satissor"] = SatSorId;
parameters["new_satissorname"] = SatSorName;
}*/
if (Uygunsuzluk != null) {
parameters["new_uygunsuzlukmaliyeti"] = Uygunsuzluk;
}
if (DepartmanId != null && DepartmanName != null) {
parameters["new_departman"] = DepartmanId;
parameters["new_departmanname"] = DepartmanName;
}
Xrm.Utility.openEntityForm("incident", null, parameters);
}