Adding a new Panel to a Summary screen e.g. Company Summary

Hints, Tips and Tricks

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

Adding a new Panel to a Summary screen e.g. Company Summary

  • Comments 36
  • Likes

A screen like the company summary screen has a very particular structure because it is partially defined in meta data and partial has its structure hard coded into the system action being called.  The detail of this is discussed in the article "Changing a Summary Screen (e.g. Company Summary Screen)". 

But imagine the business case where you have added new fields to the company table

  • comp_creditcheckdate
  • comp_creditrating
  • comp_creditcheckagency
  • comp_creditcheckmaximum

Of course these new fields can be added to the existing screen block that is defined in meta data which is "companyboxlong", but if we want to display these fields in a seperate panel then we will run into the issue that normally we can not control the blocks used in a default system action like 'companysummary'.

The basic strategy that I have used here is to define the extra block in meta data and then take advantage of the Caption property of a field and use that property to add the HTML into the screen. A script in the custom content box can then be used to position the panel.

My business requirement is that the extra panel should only display on the main Summary Page and not display when the company screen is in Edit Mode.

Step 1:

Add the fields.

I have added the fields listed above.  And I have also added a dummy field "comp_dummy".  The use of a Dummy field is quite a common trick for example it is used in this article "How do I put calculated or derived info in a screen's top content?"

Make sure the field level security is set so that the comp_dummy field is read only.

Step 2:

Create the basic screen.  Mine was called "CreditCheck".  See the last image of this article.

Step 3:

Create the block. I called mine creditcheckblock and it needs to be an entrygroup. We need to do this so that the panel inherits the label and borders.

Step 4:

Add the code to create script of the Dummy field.

if (Values("Act") == 200 || Values("Act") == 520 || Values("_actionid") == 201) {
var intRecordId = CRM.GetContextInfo("company", "comp_companyid");
var CreditCheckPanel = CRM.GetBlock("CompanyCreditCheckBoxBlock");
CreditCheckPanel.DisplayButton("1") = false;
CreditCheckPanel.DisplayForm = false;
var myRecord = CRM.FindRecord("company", "comp_companyid=" + intRecordId);
var strBlockHTML = CreditCheckPanel.Execute(myRecord);
Caption = "<script" + ">";
Caption += "var strPanelHTML ='";
Caption += strBlockHTML;
Caption += "';";
Caption += "<" + "/script>"
}
else {
Hidden = true;
}

This code makes sure the panel is only added when the company summary screen is in view mode.

The HTML for the panel is contained in the variable strBlockHTML which is going to be passed to the browser and used in the next step.

Step 5.

The following code needs to be added to the custom content of the companyboxlong screen.

<script>
crm.ready(function () {
if (crm("comp_name").getMode()=="view")
{
var myRowGaps = $("TD.ROWGap");
myRowGaps[0].innerHTML += strPanelHTML;
}
})
</script>

The code above is a combination of Client Side API and jQuery.  The code checks that the code is in View Mode.  It then looks for the first occurrence of a table cell with the cascading style sheet class of "RowGap".  It then adds the HTML for the panel contained in the variable strPanelHTML; this was the variable that was passed into the browser from the code added to the Caption property of the Dummy field's create script.

Note:

In this example the additional fields that are displayed in the extra panel are edited using a screen called from a tab option. 

Comments
  • How would you make this work for new Company Screen?

  • I want to add a similar to panel to Person. What is the values of the action ?

    (Values("Act")==200||Values("Act")==520||Values("_actionid")==201).

    I tried this on Sage CRM 7 for Company, but the borders for the panel not appearing.Can we also position this panel as the last section, not in between. Please advice

  • I want to add a panel to person summary screen. Please can someone advice.

  • the code doesn't appear to run if you have inline customisations turned on which had me puzzled for a bit.

  • hi Jeff - great post

    If I want to link to another custom table how can I go about this? it's obviously reliant on the view the screen/block is using. I don't really want to modify the company view, are there any suggestions or possibilities, the custom table has a company id parameter.

    Cheers

  • You can retrieved the data from another table and display the data in a screen block based on another table.

    You should be able to edit the code in step 5 above.

  • Thanks for the great article! I too would like to position my new Panel at the bottom of the Company Summary Screen. Anyone know if this is possible? Thanks!

  • You could...but this would involve you finding the correct node at the end of the table set to allow you to add the panel where you need it.  It might be easier to use the Sage CRM v7.1 Company Interactive Dashboard to design the page you need in the company context.

  • Hi Jeff,

    is it also possible to add an exisiting block (like the communication panel) to the contact summary screen?

    So that the contact summary screen includes the ContactBoxLong, AddressBoxShort, companyBoxShort  and the communication list. I want to have everything at one glance :)

    Thanks very much!

    Best regards from Vienna,

    Stephanie

  • Stephanie

    You could use a similar method but you may find it is much easier to create a special Dashboard within the company dashboard to allow you to drill down into each person and get everything you need without code.

  • Hi jeff ,

    I am having a screen like shop summary,but i want to display contact details,address of shop which are available in other entities called person entity.... in a new panel in shop summary screen.Please can u give detailed description

    Thanks in advance

  • Reddy

    Is 'Shop' a new custom entity?

  • A couple of questions -

    1. When viewing a person entity, the new panel appears as expected but if I then navigate to another tab and then go back to the summary tab, the new panel does not show. Is there any way to correct this?

    2. How can you position the new panel at the bottom of the page (i.e. below all the other panels)?

    3. In the example shown above and in practice, the right-hand side of the panel is indented from the original panels - is there any way to correct this?

    Thanks!!

  • Yes jeff "Shop" is new custom entity

  • one more thing  jeff how do i add "keyword search" text box to my search screen.......................i am new to this "sage"