RSS

CRM2011 Add Entity Level ‘Notes’ Section Accessible and Viewable from Custom HTML WebResources

01 Aug

Introduction

In this article, we will create an Entity level ‘Notes‘ Section accessible and viewable from Custom HTML WebResource.

Notes

Background

In one of my projects, there is a requirement to add a “Notes” Section to the custom HTML page, which will function same as entity level ‘Notes‘ in CRM. And that page is accessible from the Ribbon Button of an Entity form. I faced the challenge and figured out a way to do it.

Implementation

Steps which are needed to be followed:-

  • Create an HTML WebResource.
  • Add following Code to the row of table of your HTML page. Here my page is accessible through Order Level Form, hence Entity code is 1088.
    <tr style="height: 200px">
            <td colspan="4">
                <div id="tab6" class="ms-crm-InlineTab" isviewporttab="1">
                    <table style="height: 100%; width: 100%" class="ms-crm-InlineTabBody" cellspacing="0"
                        cellpadding="0">
                        <colgroup>
                            <col width="100%" />
                            <tbody>
                                <tr>
                                    <td valign="top">
                                        <div class="ms-crm-FormSection-Container">
                                            <table style="height: 100%; table-layout: fixed;" id="{19E2776E-C7EF-4ae2-99BB-549FF9DA0B23}"
                                                class="ms-crm-FormSection" cellspacing="0" cellpadding="3" columns="2" valign="top"
                                                isviewportsection="1" label="Notes">
                                                <colgroup>
                                                    <col width="115" />
                                                    <col />
                                                    <col width="115" />
                                                    <col />
                                                    <tbody>
                                                        <tr height="5">
                                                            <td>
                                                            </td>
                                                            <td>
                                                            </td>
                                                            <td>
                                                            </td>
                                                            <td>
                                                            </td>
                                                        </tr>
                                                        <tr height="25" valign="top">
                                                            <td style="height: 200px; overflow: hidden;" id="notescontrol_d" class=" FormSection_CellPadding"
                                                                rowspan="5" colspan="4" formxmlcolspan="2" isautoexpanding="TRUE">
                                                                <div style="display: none;" id="notescontrol_c" class="ms-crm-FieldLabel-LeftAlign ms-crm-Field-Normal"
                                                                    sl="false">
                                                                    <label for="notescontrol">
                                                                        Note Text</label></div>
                                                                <iframe style="width: 100%; height: 100%; min-height: 200px;" id="notescontrol" class="noteData"
                                                                    tabindex="51" src=""
                                                                    frameborder="0" name="notescontrol" scrolling="no" notesxml="" url="">
                                                                </ iframe>
                                                            </td>
                                                        </tr>
                                                        <tr height="25" valign="top">
                                                        </tr>
                                                        <tr height="25" valign="top">
                                                        </tr>
                                                        <tr height="25" valign="top">
                                                        </tr>
                                                        <tr height="100%" valign="top">
                                                        </tr>
                                                    </tbody>
                                                </colgroup>
                                            </table>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </colgroup>
                    </table>
                </div>
            </td>
        </tr>
    
  • On load of your custom page add the following code.
    window.onload = function () {
         var iframe = document.getElementById('notescontrol');
         var entityId = window.parent.Xrm.Page.data.entity.getId();
         var noteUrl = document.location.protocol + "//" + document.location.host + "/" + Xrm.Page.context.getOrgUniqueName() + "/_controls/notes/notesdata.aspx?EnableInlineEdit=true&EnableInsert=true&id=%7b" + entityId + "%7d&ParentEntity=1088";
         iframe.src = noteUrl;
         iframe.url = noteUrl;
    }
    
  • Add your WebResource to your Ribbon ButtonorderRibbon
  • Finally we can see that the “Note” Section is created in your Custom Pageimg3

By Puja Jain
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

Advertisements
 
2 Comments

Posted by on August 1, 2013 in WebResources

 

Tags: , , , , , , , , , , , , , , ,

2 responses to “CRM2011 Add Entity Level ‘Notes’ Section Accessible and Viewable from Custom HTML WebResources

  1. Saqib Khan

    January 13, 2014 at 5:28 am

    Hi, how did your custom page recognize exactly like crm. I have custom pages and i want them to be exactly look like CRM.
    thanks

     
    • DynamicsCRM@MindfireSolutions

      January 13, 2014 at 11:34 am

      Hi Saqib Khan,

      Thanks for your question. 🙂

      Actually we have done that for our clients, so we can’t share it. You can directly check the CSS Styles applied to Page elements by seeing the page in Developer Tools (F12). You can also check the Styles Sheets on CSS tab. Try to replicate them in your Custom Pages.

      Refer – Custom Web Pages with CRM 2011 Look and Feel using knockout.js for one example.

      Regards,
      DynamicsCRM@MindfireSolutions

       

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: