Adding a Button that Passes Contextual Information to an External Webpage

1 minute read time.

You can add a button

  • In a custom ASP page
  • In a the code of a .NET assembly
  • In a an existing system screen

Buttons in an ASP Page

If this is in an ASP page then the code for a simple button to call an external ASP page looks like

var strCallASPButton = CRM.Button("ASP","save.gif", CRM.Url("http://myserver/myPage.asp"));
myBlock.AddButton(strCallASPButton);

A full discussion of buttons in ASP pages can be found in the article "Adding Buttons to an ASP Page".

Buttons in a .NET assembly

If this is in the code for a .NET assembly then the code for a simple button to call an external ASP/ASPX page looks like

AddUrlButton("CaptionCode", "Image.gif", Url("http://myserver/myPage.asp"));

Members of the Developer Program have access to the .NET SDK and documentation which have extensive examples and snippets that show the creation of Custom Buttons.

Buttons in a System Page

If you just want to add a button to a system screen using the Button Groups feature, then you need to use the 'customurl' action and the URL name will be a PsuedoURL like this:

javascript:x=window.open('http://community.sagecrm.com?crm=true'+GetKeys(),'new');void(x);

For another example of a PseudoURL see the article "Adding a Print Button to a System Screen".

Note: void is a javascript operator that is used to return a null value so the browser will not load a new page. We want to stay on the existing system page on popup the new page. The void operator requires a value and cannot be used by itself.