Friday, June 1, 2012

Add Context Sensitivity to Navigation Links

Just as you can embed a web resource into a form you can similarly embed a web resource into a form navigation link. However there is an important difference. In the former case you can pass parameters which can be interrogated by the web resource to add context sensitive logic. Whereas when you define a Navigation Link you are presented with no such option (not quite sure why):

Note the absence of "Custom Parameters"

Being able to add context sensitivity to the Navigation Link is crucial. It's actually a little hard to think of a practical (realistic/useful) scenario where you'd add a Navigation Link without some kind of tie in to the record being viewed - or maybe that's just me...

A while back we came up with one solution for this that allowed us to integrate bing maps that employed the combination of web resources and client side jscript.

A better solution though is to have all the logic contained with the html web resource. So how can context sensivity be added? The code snippet below illustrates this.

  • ClientGlobalContext.js.aspx - You can use this reference to retrieve the CRM context (e.g. URL, user, roles etc.)
  • Use the "window.parent" prefix to reference form elements. Shown in the example are how to go about retrieving the record ID and the record type. You could similarly access other form elements by following this format.

No comments:

Post a Comment