Untitled
unknown
plain_text
a year ago
3.1 kB
6
Indexable
WS.CheckDuplicateRecord = async function(executionContext) { "use strict"; try { if(global.getFormType() === 1) { var _parentGroupIDPrefixAccountID = global.getAttribute(homeArrangementsConstItems.ParentGroupIDPrefixAccountID); var masterPlanCodeID = global.getLookupId(homeArrangementsConstItems.MasterPlanCode); var _prefix = global.getAttribute(homeArrangementsConstItems.Prefix); var _activeOrFuture = global.getAttribute(homeArrangementsConstItems.ActiveOrFuture); var _effectiveEndDate = global.getAttribute(homeArrangementsConstItems.EffectiveEndDate); //alert("_effectiveEndDate : " + _effectiveEndDate.getValue()); if((_parentGroupIDPrefixAccountID !== null && _parentGroupIDPrefixAccountID !== undefined && _parentGroupIDPrefixAccountID.getValue() !== null) && (masterPlanCodeID !== null) && (_prefix !== null && _prefix !== undefined && _prefix.getValue() !== null) && (_effectiveEndDate.getValue() === null || _effectiveEndDate.getValue() === '') && (_activeOrFuture !== null && _activeOrFuture !== undefined && (_activeOrFuture.getValue() === 865590000))){ var fetchSimilarRecords = "<fetch mapping='logical'>" + "<entity name='wm_homearrangement'>" + " <attribute name='wm_homearrangementid' />" + " <attribute name='wm_name' />" + " <order attribute='wm_name' descending='false' />" + " <filter type='and'>" + " <condition attribute='wm_parentgroupidprefixaccountid' operator='eq' value='" + _parentGroupIDPrefixAccountID.getValue() + "' />" + " <condition attribute='wm_masterplancode' operator='eq' value='{" + masterPlanCodeID + "}' />" + " <condition attribute='wm_prefix' operator='eq' value='" + _prefix.getValue() + "' />" + " <condition attribute='wm_effectiveenddate' operator='null' />" + " <condition attribute='wm_activeorfuture' operator='eq' value='865590000' />" + " </filter>" + "</entity>" + "</fetch>"; await Xrm.WebApi.retrieveMultipleRecords("wm_homearrangement", "?fetchXml=" + fetchSimilarRecords).then( function success(result) { if(result !== null && result !== undefined){ if(result.entities.length > 0){ global.openAlertDialog("OK", homeArrangementsConstItems.DuplicateRecordMessage); } } }, function(e) { global.openAlertDialog("OK", e.message); } ); } } } catch (error) { global.openAlertDialog("OK", e.message); } };
Editor is loading...
Leave a Comment