Important Update: Archer Community Scheduled Maintenance on November 23–24 - New Community Launching Soon! Learn More..
2022-08-19 01:55 PM
<script type="text/javascript">
const dateIdentifiedId = 19854;
const firstPublishedId = 2275;
Sys.Application.add_load(function () {
// Clone the "Save" button.
$('#master_btnApply1').clone().attr('id', 'master_customBtnSave').insertBefore('#master_btnApply1');
$('#master_btnApply1').hide();
$('#master_customBtnSave').unbind('click').prop("onclick", null).click(function () { validateDate("save"); return false; });
// Clone the "Save and Close" button.
$('#master_btnSave1').clone().attr('id', 'master_customBtnSaveAndClose').insertBefore('#master_btnSave1');
$('#master_btnSave1').hide();
$('#master_customBtnSaveAndClose').unbind('click').prop("onclick", null).click(function () { validateDate("save_close"); return false; });
// Clone the "Continue to Finding" item
// $("div:contains('Continue to Finding')").clone().attr('id', 'master_customContinueItem').insertBefore("div:contains('Continue to Finding')");
// $("div:contains('Continue to Finding')").hide();
// $('#master_customContinueItem').unbind('click').prop("onclick", null).click(function () { validateDate("continue"); return false; });
// Clone the "Continue to Finding" item
$('#master_4958:CUST').clone().attr('id', 'master_customContinueItem').insertBefore('#master_4958:CUST');
$('#master_4958:CUST').hide();
$('#master_customContinueItem').unbind('click').prop("onclick", null).click(function () { validateDate("continue"); return false; });
});
function validateDate(action) {
var dateIdentifiedValue = $CM.getFieldValue(dateIdentifiedId); //CM = Client Manager
var firstPublishedValue = $CM.getFieldById(firstPublishedId).value;
//alert(dateIdentifiedValue);
//alert(firstPublishedValue);
if (dateIdentifiedValue == null || dateIdentifiedValue == "") {
alert("Date Identified cannot be empty");
}
else {
if (dateIdentifiedValue.getTime() <= firstPublishedValue.getTime()) {
if (action == "save") {
//Perform actual "Save" function
$("#master_btnApply1").click();
} else if (action == "save_close") {
//Perform "Save and Close" function
$("#master_btnSave1").click();
}
else {
//Perform "Continue to Finding" function
// $("div:contains('Continue to Finding')").click();
$("#master_4958:CUST").click();
}
}
else {
alert("Date Identified cannot be greater than First Published date");
}
}
}
</script>