Skip to main content

Dynamics V9 Show/Hide Webresources

Quick reusable JavaScript for showing or hiding webresource on a form based on a field value. For example show a disability flag image when a check box is checked.

Robert Peledie also describes a very usable scenario this and in more detail over at his blog.

 
function disability (executionContext) {
var formContext = executionContext.getFormContext();
var disability = formContext.getAttribute("new_disability").getValue();
if (disability === true) {
formContext.getControl("WebResource_DisabilityImg").setVisible(true);
}
else {
formContext.getControl("WebResource_DisabilityImg").setVisible(false);
}
}

Don’t forget to pass the execution context to the script!

Charles Osei

Dynamics 365 Consultant @ RSM MCSE Business Applications Computer Science – University of Lincoln 2017 Nottingham D365/CRM user group Chapter Leader TDG – Community leader Twitter @charliedevxyz LinedIn https://www.linkedin.com/in/charlesosei/

Leave a Reply

%d bloggers like this: