Bhubaneswar, Odisha, India
+91-8328865778
support@softchief.com

Use namespaces in javascript power apps dataverse sample code

Use namespaces in javascript power apps dataverse sample code

var InvestmentEntity = InvestmentEntity || {};
InvestmentEntity.ROI = InvestmentEntity.ROI || {};

InvestmentEntity.ROI.AutoPupulateROI = function (executioncontext) {
var FormContext = executioncontext.getFormContext();

var InvestmentType = FormContext.getAttribute("metro_investmenttype").getValue();

var flag=false;

if(InvestmentType==900410000) // RD
{
    FormContext.getAttribute("metro_rateofinterest").setValue(7);
    flag = true;
}
else if (InvestmentType==900410001) // FD
{
    FormContext.getAttribute("metro_rateofinterest").setValue(8);
    flag = true;
}
else
{
    FormContext.getAttribute("metro_rateofinterest").setValue(null);
    flag = false;
}

FormContext.getControl("metro_rateofinterest").setDisabled(flag);

}

InvestmentEntity.ROI.ValidateAmount = function (executioncontext) {
var FormContext = executioncontext.getFormContext();
var amount = FormContext.getAttribute(“metro_amount”).getValue();

    var uniqueId = "MYID";
    if(amount >= 10000000)
    {
        FormContext.ui.setFormNotification("Amount of Deposit cannot be more or equal to 1 Cr.", "ERROR", uniqueId);

        executioncontext.getEventArgs().preventDefault();


    }
    else{
        FormContext.ui.clearNotification(uniqueId);

    }

}