Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

PowerObjects Blog 

for Microsoft Business Applications


How to Show or Hide a Field in Dynamics CRM 2013 with Portable Business Logic

Post Author: Joe D365 |

The Microsoft Dynamics CRM 2013 release is a few short months away, and it will come with some great new features. In this blog we'll discuss one of these new features—portable business logic. Then we'll show how you can use it to create rules that hide and show fields on a form.

Portable business logic allows you to define business rules for each record type. You can use it to do any of the following:

  • Show a message to the user
  • Change a field value
  • Set a field as business required/not business required
  • Show or hide a field
  • Lock or unlock a field

You can set all of these actions to occur based on conditions you set in the business rule. Conditions can be based on one of the following:

  • If a field contains data or doesn't contain data
  • If a field contains a certain value or doesn't contain a certain value
  • If a field equals or does not equal another field value

In previous version of CRM, you would have to know JavaScript to do these things. Now you can define these business rules through a configuration tools, and CRM 2013 creates the JavaScript for you. The reason these business rules are referred to as "portable business logic" is because the rules can be used on multiple forms once they are created (such as in the user of role based forms for an entity).

Getting Started

Let's take a look at an example of how this works. In this scenario, we want two custom fields—Role with Vendor and Priority—to show if a Contact is of Relationship Type Vendor.

We already have the two custom fields added to the form with their visibility disabled. Now we just need to setup the new Business Rule. Use the following steps create a new Business Rule for the Contact:

  1. Go to Settings > Customizations > Customize the System and navigate to contact entity.
  2. Under Business Rules, click New. CRM will pop up a window.

    show-hide-field

  3. Name the business rule. We will call it 'Relationship Type = Vendor'
  4. To add a condition, click the plus sign under Condition. Here we enter the condition translates to "Relationship Type equals value Vendor".
  5. Click the Check icon to save the condition.

  6. To add an action, click the plus sign near Action and choose Set Visibility. In this case, we need two actions: Field: Priority–Status Show Field; and Field: Role with Vendor—Status Show Field.
  7. To save the action, click the Check icon.

  8. Once complete, Save the new business rule and don't forget to Activate. Also, make sure to Publish the changes.

NOTE: Keep in mind you may need to create inverse Business Rules to hide the fields if a different value is selected. In this case, you may want to make sure the 'Role with Vendor' and 'Priority' fields stay hidden if a different 'Relationship Type' is selected. Here would be the appropriate business rule:

There you go! Showing and hiding fields is now much simpler to implement using the new business rules.

If this was helpful, you can also check out our other blogs and resources for Microsoft Dynamics CRM 2013.

Happy CRM'ing!

Joe CRM
By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

2 comments on “How to Show or Hide a Field in Dynamics CRM 2013 with Portable Business Logic”

PowerObjects Recommends