D365 V9{Upgrade}: Ribbon Button Enable Rule Custom JS Code gives error “Cannot read property ‘getFormContext’ of undefined”

Ajit Patra

While working on upgrade activities of D365 V9 from D365 V8, we faced one weird issue related to Enable Rule of  Ribbon button.

We had one form where we were using Enable Rule for a button which was defined using custom JS code. As part of client side scripting changes related to D365 V9 upgrade, we passed Primary Control as first CRM parameter in Ribbon Workbench for that Enable Rule as explained here and in JS we passed executionContext as a parameter as shown below:

While testing after making the above changes, we got the error “Cannot read property ‘getFormContext’ of undefined”


While debugging the code using Developer Tools in browser, we found that executionContext is undefined


Then, continuing execution, we found that the method/debugger was hit again and this time we got the value in executionContext


This was a strange behavior that custom JS code for Enable Rule…

View original post 45 more words

Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Please share your thoughts

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

WordPress.com Logo

You are commenting using your WordPress.com 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.