값이 다른 경우 양식 1의 필드가 필드 값이 다른 양식에있는 것으로 설정되도록 두 개의 다른 엔티티의 필드를 비교합니다. 문제는 로직 이전 값이 변경되지 않는 한 다음 if/else 블록으로 계속 진행하는 것을 거부하는 블록 중 일부는 올바르게 보입니다.다른 엔티티의 필드 비교
국가 또는 국가가 변경된 경우에도 문제가없는 상태로 국가 및 국가를 확인하는 블록으로 이동합니다. 주 또는 국가가 변경되지 않으면 (또는 국가를 주석 처리하지 않은 경우) 얻을 수있는 주요 전문 분야가 계속되지 않습니다. 그 값을 확인하십시오. 내가 여기서 무엇을 놓치고 있는지 확실하지 않습니다. 나는 아무것도 중첩되어 있지 않고 모든 논리가 실제로 작동하는지 확인했습니다.
Xrm.Utility.alertDialog("about to check state");
if (getFieldValue("hc_stateid") == null && result["_hc_state_value"] != null) {// checling if value is null on tni becacuse the else if wouldnt execute b/c no id
Xrm.Utility.alertDialog("its null");
Xrm.Page.getAttribute("hc_stateid").
setValue([
{
id: result["_hc_state_value"],
name: result["[email protected]"],
entityType: result["[email protected]"]
}]);
Xrm.Utility.alertDialog("state changes");
}
else if (result["_hc_state_value"] != getFieldValue("hc_stateid")[0].id.replace("{", "").replace("}", "").toString().toLowerCase()) {//tni has a value
if (result["_hc_state_value"] == null) {
Xrm.Page.getAttribute("hc_stateid").setValue(null);
}
else {
Xrm.Page.getAttribute("hc_stateid").
setValue([
{
id: result["_hc_state_value"],
name: result["[email protected]"],
entityType: result["[email protected]"]
}]);
Xrm.Utility.alertDialog("state changes");
}
}
Xrm.Utility.alertDialog("about to check country");
/*if (getFieldValue("hc_countryid") == null && result["_hc_country_value"] != null)
{
Xrm.Page.getAttribute("hc_countryid").
setValue([
{
id: result["_hc_country_value"],
name: result["[email protected]"],
entityType: result["[email protected]"]
}]);
Xrm.Utility.alertDialog("country changed");
}
else if (result["_hc_country_value"] != getFieldValue("hc_countryid")[0].id.replace("{", "").replace("}", "").toString().toLowerCase()) {
if (result["_hc_country_value"] == null) {
Xrm.Page.getAttribute("hc_countryid").setValue(null);
}
else {
Xrm.Page.getAttribute("hc_countryid").
setValue([
{
id: result["_hc_country_value"],
name: result["[email protected]"],
entityType: result["[email protected]"]
}]);
Xrm.Utility.alertDialog("country changed");
}
} */
Xrm.Utility.alertDialog("about to check prim spec");
Xrm.Utility.alertDialog("prim specialty: " + (result["_hc_primaryspecialty_value"] != getFieldValue("hc_primaryspecialtyid")[0].id.replace("{", "").replace("}", "").toString().toLowerCase()).toString());
if (getFieldValue("hc_primaryspecialtyid") == null && result["_hc_primaryspecialty_value"] != null) {
Xrm.Page.getAttribute("hc_primaryspecialtyid").
setValue([
{
id: result["_hc_primaryspecialty_value"],
name: result["[email protected]alue"],
entityType: result["[email protected]ame"]
}]);
}
else if (result["_hc_primaryspecialty_value"] != getFieldValue("hc_primaryspecialtyid")[0].id.replace("{", "").replace("}", "").toString().toLowerCase()) {
Xrm.Utility.alertDialog("inside else if");
if (result["_hc_primaryspecialty_value"] == null) {
Xrm.Page.getAttribute("hc_primaryspecialtyid").setValue(null);
}
else {
Xrm.Utility.alertDialog("prime spec");
Xrm.Page.getAttribute("hc_primaryspecialtyid").
setValue([
{
id: result["_hc_primaryspecialty_value"],
name: result["[email protected]alue"],
entityType: result["[email protected]ame"]
}]);
}
}
else {
}
Xrm.Utility.alertDialog("after prim spec");
디버깅 할 수 있었습니까? 오류가 있습니까? –
나는 그것을 디버깅 할 수 있었고 오류는 전혀 없었다. 그것은 일부 조건을 완전히 뛰어 넘는 이상한 일이었다. 아무 래도 나는 진술과 그것이 계속되는 경우 빈 else else를 추가함으로써 그것을 해결했다. 아무 의미가 있지만 그것을 가져 가라. – amberl