Hi everyone,
Using Jscript, I want to hide/show a section based on:
- Whether a single choice column equals 1
- Whether the value in a Dataverse currency column is greater than 20,000,000
I have the first part working:
function ShowHideLabel() {
var choiceType = Xrm.Page.getAttribute("new_businesscasecategory").getValue(); //replace with the logical name of the choice field
if (choiceType != null) {
if (choiceType == "1") { // replace with the Value for which you want to display webresource. This would be the associated integer value for the choice field in dataverse
Xrm.Page.ui.tabs.get("tab_businesscase").sections.get("section_pic").setVisible(true); // replace with TabName and sectionName
} else {
Xrm.Page.ui.tabs.get("tab_businesscase").sections.get("section_pic").setVisible(false); // replace with TabName and sectionName
}
}
else { // For null value webresource will not display
Xrm.Page.ui.tabs.get("tab_businesscase").sections.get("section_pic").setVisible(false); // replace with TabName and sectionName
}
}
But my code is incorrect for the second condition. Could anyone help? Unfortunately my expertise with JScript is lacking.
function Show_UnderToleranceSection() {
var choiceType = Xrm.Page.getAttribute("new_businesscasecategory").getValue(); //replace with the logical name of the choice field
var costvalue = Xrm.Page.getAttribute("cr37a_costcovered").getValue();
if (choiceType != null || costvalue != null) {
if (choiceType == "1" && costvalue < 20000000) { // replace with the Value for which you want to display webresource. This would be the associated integer value for the choice field in dataverse
Xrm.Page.ui.tabs.get("tab_businesscase").sections.get("section_under_tolerance").setVisible(true); // replace with TabName and sectionName
} else {
Xrm.Page.ui.tabs.get("tab_businesscase").sections.get("section_under_tolerance").setVisible(false); // replace with TabName and sectionName
}
}
else { // For null value webresource will not display
Xrm.Page.ui.tabs.get("tab_businesscase").sections.get("section_under_tolerance").setVisible(false); // replace with TabName and sectionName
}
}