Calling extensions (ASP pages and .NET assemblies) from buttons added using the client side API

1 minute read time.

The new Client Side API adds a very easy way of adding new buttons.

crm.addButton(imageURL,captionfamily,captioncode,[options])

The new Client Side API allows application extensions to be called. This would typically mean calling either an ASP page or a .NET assembly. In order to do this we need to be able to make sure that context is maintained and that we have control over any other variables that need to be passed.

To understand this we can look at how we can

  1. Call a standard System Action
  2. Call an ASP Page
  3. Call a .NET Assembly

Call a Standard System Action

The image below shows a button that has been added to the Company Summary screen. The button will call the Mail Merge system action.

The button is added by the following code being included in the Custom Content box of the CompanyBoxLong screen

[code language="javascript"]

[/code]

Note: The method crm.url() will ensure the URL that is generated includes all of the current context information. The System Action for the Mail Merge was obtained by reading the 'Act' code included in the URL of the standard mail merge screen.

Call an ASP page.

In the example below a button that has been added to the Company Summary screen that will call an ASP page.

[code language ="javascript"]

[/code]

Call a .NET Assembly

Below is some example code that shows how to add a call to the RelatedEntities feature on the Company Sumary page.

The code needs to be added to the Custom Content box of the CompanyBoxLong screen.

[code language="javascript"]

[/code]

Note: A later article will discuss how the presentation and positioning of these button can be improved in the page by passing an 'options' object as the 4th parameter of the crm.addButton() method.