In our scenario, we want Dynamics 365 to display a specific Form based on the Account Name field on the Account Entity. If the Account Name meets our condition, we want to display a specific Form. Otherwise, the Form will display the System Default.
Creating a Function
Form ID and Attribute Value
After we have added our standard code, we then define a variable to get the current Form Id using the getId method. We also use a line of code to get the attribute value of our variable using the getValue method. In this case we are using the name field attribute.
Web Resource and Form Properties
Once code is complete, create a Web Resource file with your code. Select Type as Script(Jscript) and use the Text Editor to paste your code.
From your form builder, add your Web Resource file to the Form Properties on your Account Form. Once Added to the Form Properties, add your Web Resource file in the Event Handler on an Onload Event. Include your function name, and check both boxes. Be sure to Save and Publish All Customizations.