RSS

Tag Archives: Custom Html

Open Dialog box like CRM 2013

Introduction

In this Blog, we will explore how to open a Dialog Box similar with CRM 2013 look and feel.

Background

Sometimes, we need to open the custom WebResource in a Dialog Box. But the Dialog Box should look like other Dialog Box in CRM 2013.

Custom Dialog Box

Solution

We can achieve this by one CRM function in the following way:

Note: Here, URL must be without Server URL.

For the Parent Window:

var DialogOption = new Xrm.DialogOptions;
DialogOption.width = <Height>; DialogOption.height = <width>;

Xrm.Internal.openDialog(<Relative_Url_of_the_Webresource>, 
                        DialogOption, 
                        null, null, 
                        CallbackFunction);

function CallbackFunction(returnValue){ }

In the Dialog Box, please include:

<script type="text/javascript" 
        src="../../../../../../webresources/ClientGlobalContext.js.aspx"></script>
/*This Might change according to the url*/

And

//Pass the return Value to the parent window
Mscrm.Utilities.setReturnValue(oReturn);

try {
    closeWindow(true);//Close the dialog box
}
catch (e) { }

By Sukant Shekhar
Senior Software Engineer @Team DynamicsCRM.
Mindfire Solutions

Advertisements
 

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

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

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

 
2 Comments

Posted by on August 1, 2013 in WebResources

 

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

 
%d bloggers like this: