Creating Lists using RunBlock

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Creating Lists using RunBlock

  • Comments 10
  • Likes
RunBlock is the feature that allows the codeless addition of customized lists and screens to CRM. In theory you do not need to create either ASP pages or .NET dlls to add application extensions. In practice Runblock's limitations mean that most customizations rapidly need the developer to use the APIs to achieve the results they need. But when it comes to creating Lists against either internal tables, new entities or even external tables then RunBlock is very handy.

The RunBlock action can be called from Tabs, ButtonGroups and List hyperlinks.

I am going to discuss the following examples

Runblock calling a List - under the Company Context
Runblock calling a List (wrapped in a block)
Building a Search or Filter screen with Runblock

Runblock calling a List - under the Company Context

This example reproduces the listing of opportunities from under the Company Tab

Create new Tab under Admin>System>Tabs>User that calls Runblock and your new list.

When creating List blocks that are to be called from a particular context it is most important that the primary key of the entity is context is included in the view the List is based on.

In this example we want to call a list of opportunities within the company context and we must therefore base the List block on a view that contains the comp_companyid field. For example the existing OpportunityList is based on vListOpportunity

CREATE VIEW vListOpportunity AS SELECT RTRIM(ISNULL(Pers_FirstName, '')) + ' ' + RTRIM(ISNULL(Pers_LastName, '')) AS Pers_FullName, Pers_PersonId, Pers_CreatedBy, Opportunity.*, Comp_Name, Comp_CompanyId, Comp_CreatedBy, Comp_SecTerr, Pers_SecTerr, Pers_PrimaryUserId, Comp_PrimaryUserId, Pers_ChannelID, Comp_ChannelID, CASE WHEN (Oppo_Certainty IS NULL OR Oppo_Certainty = 0) THEN 0 ELSE (Oppo_Forecast * Oppo_Certainty) / 100 END AS Oppo_Weighted, Chan_ChannelId, Chan_Description, Comp_EmailAddress, Pers_EmailAddress FROM Opportunity LEFT OUTER JOIN Person ON Pers_PersonId = Oppo_PrimaryPersonId LEFT OUTER JOIN Company ON Comp_CompanyId = Oppo_PrimaryCompanyId LEFT OUTER JOIN Channel ON Oppo_ChannelId = Chan_ChannelId WHERE Oppo_Deleted IS NULL


Beware of using existing blocks like OpportunityList or OpportunityListBlock using runblock as there is hardcoded behaviour associated with them.

When adding a list called via RunBlock you can use the Tab SQL clause to restrict the display of the tab, just like any system action.

Runblock calling a List (wrapped in a block)

RunBlock can either allow you to call the List directly or via a 'Block'. You can define a block by choosing the 'block' tab option within the administration area:

Administration -> Customization -> [Entity]

Blocks can be based on any of the following

Chart Block
Container Block
Content Block
EntryGroup Block
File Block
Graphic Block
Knowledge Base Block
List Block
Marquee Block
Message Block
Org Chart Block

Each of these block types can be called via RunBlock.

Known Limitations

When you define a block based on a List there are two fields that invite you to decide whether or not on the list page you want a 'New' button and thew block that could called.

Show New Button: Yes/No
New Button Action:

The New Button Action should be the name of the screen block that allows you to enter a new record.

There are plenty of issues with using this approach such as

1) Security (DIVE rights) - The User Security rights are ignored and the New button is always displayed.
2) Display of TopContent - Loses Context.

Building a Search or Filter screen with Runblock

As we can see from the list above we can call blocks other than those based on screens and lists. Although we can call containers unfortunately there is no communication between the blocks. We can not create a container holding a search screen and a list and expect it to work.


There is a big 'quirk' when trying to call Lists from the My CRM area (User, System Menu).

a) To avoid errors the Tab entry SQL field must contain the name of the column that the underlying view is expecting e.g. oppo_assigneduserid otherwise it will pass default user_userid and create an error.

b) Also be aware that it is only fixed to show the records linked to the current logged on user not the user selected in the My CRM top content menu.

Have fun!
  • Dear Jeff

    I'm using runblock for inserting new record in an external table. my block type is list block but as you said the losses of top context happen.

    I need this information for saving company id and company idcust in new record in new table via function insert record in table scripts.

    is there any solution for this purpose?


  • Raheleh

    Can you please post a question on this in the forums.  

    Is the external table related to the Company?  What is the key that joins them?  

  • Hi,

    I have created a custom entity and created list on top of that.I am using run block to render the list from the data passed from the external screen hyperlink.But the data is not getting passed to the list and it is taking company id as its argument.

    Please guide me how to change the receiving field and its parameter values.



  • hello, I have created on custom tab with runBlock and it works fine. But when we right clock on FIND ( menu on the left side of CMR )

    it shows duplicate entries .  how that can be fixed.  if you need further information . let me know.

    Looking forward to hear form you. thanks

  • Sourab

    Thanks for the post.  This article discussed a fairly simple list page.  For your 'find' page did you use a search block with a list block?  See:  

  • its list block, how can i send you picture. thanks

  • Sourab.

    And what happens if you create a page that consists of a search block and list?  Do the rows get duplicated then?

    You may want to create a forum post and then link to this thread in the new post.

  • hello, i have created a post and attached small pic. it might help. thanks

  • Does the context get a bit messed up when in the mobile view (in Chrome - Android)? I have a custom tab for the Notes entity which I have working well in the Desktop version but the exact same setup in the mobile version behaves differently, seems to think I am still in the Cases context and there is no New button showing (but it does show in the desktop).

  • Caili

    If this is going a bit strange, then I suggest that you post a question into the forums with the steps to try and reproduce the issue.