RunBlock is one of the most useful ways of extending Sage CRM.  It is a pure meta data driven approach and can allow us to swiftly create new screens that list and present data from within Sage CRM and from external databases that have been linked in meta data.

There have been numerous articles previously written about RunBlock.  There are two in particular which are very useful in showing the capabilities of the feature;  

The latter article maybe the most interesting as it shows how RunBlock can be used within the iPhone, Android and Tablet interfaces to extend the mobile interfaces to cover custom entities.

But RunBlock can be used to access any database table that has been linked into the CRM meta data.  Below is a screen from the main user interface (Desktop HTML) that shows a listing of contact records from a database called 'PanoplyTech'. 

You can see that the list above allows paging of records and that the RunBlock displays escalation notifications and if RunBlock is used within the context of a system entity (including Team and My CRM) the appropriate menu will be displayed.

The PanoplyTech database and Contacts table are described in the meta data.  The connections are defined under

Administration -> Advanced Customization -> Tables and Databases

The list that has been called from the My CRM menu was defined in the customization screens.

Note:  I created here 2 list blocks.  The first ContactsList was used in the My CRM tab menu to return the full list of records from the PanoplyTech database table.  The second is the list that I will use below to define the results grid that is returned in the search screen which we can see below.

The search page above was built entirely using RunBlock.

To do this requires the following steps.

  1. Create a list to be used as the Results Grid.
  2. Create a Screen of screen type 'Search Screen' and associate the screen to the list created in step 1.
  3. Create a block of Block Type 'EntryGroup' based on the screen created in step 2.  This will allow the correct formatting of the search screen.
  4. Create a block of Block Type 'Container' that includes the block created in step 3 and the list created in step 1.
  5. Add the RunBlock reference to the Find screen.

Step 1.  Create a simple list block as above. 

Step 2

The block must be created as type 'Search Screen' and the list that will display the search results must be associated with the screen.

The screen can then have included what ever fields by which you want to filter the external tables's data.

Step 3.

Under the 'Block' tab menu a new block has to be created that is based on the search screens definition.

This is necessary to add the 'Find' caption and wrap the search screen in the correct style information in the generated screen.  

Note:  The text entered in the title field of the block will return the translation for that caption code in the caption family 'Tabnames'.  If you have entered 'Search' as the title, when the user accesses the screen it will look at the custom_captions meta data table e.g.

select * from custom_captions where capt_family='tabnames' and capt_code = 'search';

If the users language is US English it will return 'Find' as the translation.

Step 4.

The container block needs to be created.

The container block will need to include the screen block and the list block created earlier.

Be sure to use the screen block and consider how the blocks appear on the screen.  You can use the positioning property to control the display of the screen and list in the final page that is generated.

Step 5.

Add the call to the container block using RunBlock in the system menu 'Find'.