Hi All,
I need to make field mandatory for which am using below script
On Lead form in a tab we are showing form component control of fields from different entity ex application entity.
Which is working fine until unless am clicking on the tab is there any way without clicking tab it should throw notification for making field mandatory.
And how can we check the control null /undefined ? like if( FormContext.getControl(attributes.PRODUCTAPPLICATION).getAttribute(attributes.APPLICATIONFORMNO) !== null && FormContext.getControl(attributes.PRODUCTAPPLICATION).getAttribute(attributes.APPLICATIONFORMNO) !== undefined) Is it correct as while debugging its not working
/// Make Application fields mandatory based on lead status Push to onboarding
Deal_Retail.makeMortgageApplicationFieldsMandatory = async function () {
"use strict";
try {
if (FormContext !== undefined && FormContext !== null) {
var formType = common_Retail.getFormType();
if (formType === 2) {
var lineofbusiness = common_Retail.getAttributeValue(attributes.LINE_OF_BUSINESS);
if (lineofbusiness !== null && lineofbusiness !== undefined) {
var lineOfBusinessVal = common_Retail.getAttribute(attributes.LINE_OF_BUSINESS).getValue()[0].name;
if (lineOfBusinessVal === LOB.MORTAGAGE) {
var leadStatusAttribute = FormContext.getControl(attributes.Header_ProspectSubStage).getAttribute();
if (leadStatusAttribute !== undefined && leadStatusAttribute !== null) {
var leadStatusValue = leadStatusAttribute.getValue();
if (leadStatusValue !== undefined && leadStatusValue !== null) {
var leadStatusName = leadStatusValue[0].name;
}
}
if (leadStatusName === "Push to Onboarding") {
var applicationEntity = FormContext.getAttribute(attributes.PRODUCTAPPLICATION);
if (applicationEntity !== null && applicationEntity !== undefined) {
var prodAppID = applicationEntity.getValue()[0].id.replace("{", "").replace("}", "");
if (prodAppID !== null && prodAppID !== undefined) {
setTimeout(function () {
FormContext.getControl(attributes.PRODUCTAPPLICATION).getAttribute(attributes.APPLICATIONFORMNO).setRequiredLevel("required");
FormContext.getControl(attributes.PRODUCTAPPLICATION).getAttribute(attributes.APPLICATIONDATE).setRequiredLevel("required");
}, 200);
}
}
}
}
}
}
}
} catch (e) {
common_Retail.openAlertDialog("Ok", e.message);
}
};
Thanks,
Jharana
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156