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 43
  • 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
  • Hello Reddy

    Are you a part of the Sage Certified partner group in India, can you provide me with your company email id or contact number, I see you are located in India, I would recommend you go through a training program if you require to know more about customizing Sage CRM

    Regards

    Kannan

  • Kannan

    my contact number +91-8904860354(india)

  • Have you attended the training offered by you local OpCo?  Have you looked at the article that discuss ASP pages in the community?  community.sagecrm.com/.../SearchResults.aspx

  • Thanks jeff,

    i went through your link and i knew more things and i requested you to send detailed documents with example tasks.

  • Reddy, only authorized partners get access to the partner community, I am not sure how you have the partner community blog accessible. You need to be part of the authorized partner community to get access to the detailed documents. I ll call you and have a discussion with you this monday.

    regards

    Kannan

  • hi..i m very new to sage,,,

    i have added a new tab called 'share' there i put screen with four field called 'number of share' , 'total_share'

    'date' and 'company',  here i want to add multiple values to those field i.e once i put value (in edit mode)  relevant to fields and press save button values should store in database and field again appear empty (in edit mode) i.e fields ready to take one more input and again it store value in database..  so is this is possible in sage CRM??

    help me plz...

  • Sridhar

    Do you want to add these details like the 'Notes' associated with a company, or like the opportunities associated with a company?  You say you want to add multiple values to the 'number of shares', 'total_share' 'date' and 'company' field so if sounds like this is a child entity of the company.  You will need to think about your data model a bit more.  Have you attended training yet?

  • sorry i havent attend any,  yeah it is child entity only..(tab) . but is  it possible to add any values like  eg: 200 for 'number of share'  1000 for 'total_share'  and when click 'save' these values should go to database and again those field should clear and ready to take values again ?

  • Then look at creating a child entity and build the associated Entry Page, Summary Page and List page,  This can be done using the Advanced Customization Wizard or by using code that you've written in .NET or ASP.

  • fine.. thank u... :)

  • Jeff, I know this is an old post but still very valuable.  I have it working in 7.2b however I'm unable to insert another blank "spacer" row after the inserted panel.  The section of Custom_Content where I apply the panel is below - here's the line I've added:

        strTD += '<table><tbody><tr><td class="ROWGap" colspan="6"></td></tr></tbody></table>';

    This line appears to have no effect and so the bottom of my custom panel is flush against the top of the Address and Phone panels.  Is there a way to fix this?

    for (i = 0; i  -1)

           {

               //window.alert("found it");

               var strTD = document.all[i].innerHTML;

               strTD += strPanelHTML;

               strTD += '<table><tbody><tr><td class="ROWGap" colspan="6"></td></tr>';

               var sElement = document.all[i];

               break;

           }

       }

    } // end of panel display code

    </tbody></table>

  • Jeff, please ignore above post - I found my error: I hadn't inserted a non-blank-space ' ' string inside my <table><tbody><tr><td></td></tr></tbody></table> element.  With that insert, it breaks fine.

        strTD +='<table><tbody><tr><td class="ROWGap" colspan="6"> </td></tr>';</tbody></table>

  • I'm glad you are sorted!

  • Hi Jeff,

    Is it possible to add an new editable panel in the New  company screen?

  • Hazlan

    Good to hear from you!

    The surest way of getting new fields into the screen is by adding them to an existing screen block that creates one of the panels.  You can use the clientside API and JavaScript added to the custom content to arrange the panels.  It is common to add "<hr />" tags to the captions to break fields up into groups within a panel.