Javascript Sample:-
Only Change the Field name
//if the Credit Recommendation status is Review Completed then Credit Recommendation Status” must contain data, and the “Max Credit Approved Usage (MWh)” must contain data.
function oncreditreviewstatus() {
if (Xrm.Page.getAttribute("lpc_credit_review_status").getValue() != null) {
var currentVal = Xrm.Page.getAttribute("lpc_credit_review_status").getValue();
if (currentVal != null && currentVal == 100000001) {
if (Xrm.Page.getAttribute("lpc_credit_recommendation_status").getValue() == null || Xrm.Page.getAttribute("lpc_mwh_credit_approved_usage").getValue() == null)
{
alert("Please ensure the Credit Recommendation Status and Max Credit Approved Usage (MWh) are populated before completing your review");
Xrm.Page.getAttribute("lpc_credit_recommendation_status").setRequiredLevel("required");
Xrm.Page.getAttribute("lpc_mwh_credit_approved_usage").setRequiredLevel("required");
}
else
{
Xrm.Page.getAttribute("lpc_credit_recommendation_status").setRequiredLevel("none");
Xrm.Page.getAttribute("lpc_mwh_credit_approved_usage").setRequiredLevel("none");
}
}
}
}
Only Change the Field name
//if the Credit Recommendation status is Review Completed then Credit Recommendation Status” must contain data, and the “Max Credit Approved Usage (MWh)” must contain data.
function oncreditreviewstatus() {
if (Xrm.Page.getAttribute("lpc_credit_review_status").getValue() != null) {
var currentVal = Xrm.Page.getAttribute("lpc_credit_review_status").getValue();
if (currentVal != null && currentVal == 100000001) {
if (Xrm.Page.getAttribute("lpc_credit_recommendation_status").getValue() == null || Xrm.Page.getAttribute("lpc_mwh_credit_approved_usage").getValue() == null)
{
alert("Please ensure the Credit Recommendation Status and Max Credit Approved Usage (MWh) are populated before completing your review");
Xrm.Page.getAttribute("lpc_credit_recommendation_status").setRequiredLevel("required");
Xrm.Page.getAttribute("lpc_mwh_credit_approved_usage").setRequiredLevel("required");
}
else
{
Xrm.Page.getAttribute("lpc_credit_recommendation_status").setRequiredLevel("none");
Xrm.Page.getAttribute("lpc_mwh_credit_approved_usage").setRequiredLevel("none");
}
}
}
}
0 Comments