How to override the default form open behavior

Lets be honest: nobody need role-based forms! Most of customers want to have condition-based forms instead of role-based. The reason is simple: same people are used to work with different kind of data stored in the same entity. For example, call center operators or front-office workers used to work with different types of customers (natural persons, legal entity, corporate customers, etc.) and/or with wide range of case types.

It’s allays a good idea to avoid dealing with heavily customized entities but unfortunately it’s a common practice for industries such as telecommunication or banking. Different types of Customers/Accounts or Cases can really have more more differences than similarities. But… this is still a customer who need to be serviced and still a case that require resolution. And fast! This is a front line after all.

Approaches to deal with this challenges can be different: God-form, custom UI, switching form using script, or even using some unsupported ways. But what if I tell you that there is a simple supported way to override the default form open behavior? This small but very powerful feature was missed from documentation for some reason, but is still available in “what’ new”:

The idea here is to create/override new Ribbon command named Mscrm.OpenRecordItem. Then this command will be executed instead of opening the entity record. This phenomenon requires further research, but this seems to be ordinary grid command so we should be available to get SelectedControlSelectedItemIds parameter to find out entity id. Then we can use Xrm.Navigation.openFormto open specific form.

Doc suppose this feature to be used to open non native URLs such as SharePoint site, but the truth here is that we can use it to finally fix OOB forms to make them condition-based. Off cause this is not silver bullet! There is still a lot of challenges when you deal with multiple forms, but now you have one more option.

Use it carefully and don’t forget to properly document such things in your TDD’s! šŸ™‚

3 thoughts on “How to override the default form open behavior

  1. Pingback: Open proper form based on record’s data – UCI way – Andrew Butenko's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.