locked
Getting selected records GUID's in CRM 2011 RRS feed

  • Question

  • Hi,
    Back in CRM 3.0 I use to get the grid's selected records into my web page doing something like this

    s = window.dialogArguments.toString();
    ss = s.split(',');
    Is there any equivalent code for CRM 2011?
    Thanks
    Tuesday, September 13, 2011 7:10 PM

Answers

  • Hi,

    If you will see your ribbon button XML code in customization file, in xml code you will find the <CommandDefinition> tag and inside you will find the Actions tag i.e.

     

     

    <CommandDefinitions>
    

     

     <CommandDefinition Id="Product.form.CustomGroup.Button.OpenWinodw.command">

     <EnableRules>

     </EnableRules>

     <DisplayRules>

     </DisplayRules>

    <Actions>

    <JavaScriptFunction Library="$webresource:Application_Entity_Form.Js" FunctionName="OpenCustomWindow">

     

                     <CrmParameter Value="SelectedControlAllItemIds" />

     

    </JavaScriptFunction>

    </Actions>

    </CommandDefinition>

     


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, September 13, 2011 9:25 PM
  • Thanks Jehanzeb you gave me the clue, what finally works for me is this:

     

    <Actions>

    <Url PassParams="false" WinMode="0" Address=http://server/customwebpage.aspx WinParams="dialogHeight: 400px; dialogWidth: 900px">

    <CrmParameter Name="IDs" Value="SelectedControlSelectedItemIds"/>

    </Url>

    </Actions>

    References:

    http://msdn.microsoft.com/en-us/library/gg328363.aspx

    http://msdn.microsoft.com/en-us/library/gg309332.aspx

     

    • Marked as answer by jimenezalbert0 Wednesday, September 14, 2011 12:04 AM
    Wednesday, September 14, 2011 12:04 AM

All replies

  • Hi,
    In CRM 2011 you can get the selected grid records GUID's in the JScript function parameter, if you want to get the selected record id into the Ribbon button JScription function then you have to define CRMParamters in the Actions tag of the ribbon button.
    <Actions>
    <JavaScriptFunction Library="$webresource:jj_Application_Entity_Form.Js" FunctionName="GetRecordIDs">
    <CrmParameter Value="SelectedControlAllItemIds" />
    </JavaScriptFunction>
    < /Actions>
    The record ids will be passed as a first paramter to your JScript function. i.e
    function GetRecordIDs(prmRecordId)
    {
          alert(prmRecordId);
    }

    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, September 13, 2011 7:34 PM
  • Thanks Jehanzeb, but i can't figure it out how to use the parameters in my webpage functionallity in actions tag i have this:

    <Actions> <Url PassParams="true" WinMode="2" Address=http://server:3333/MyWebPage.aspx WinParams="dialogHeight: 400px; dialogWidth: 900px"/> </Actions>

     

    Tuesday, September 13, 2011 8:50 PM
  • Hi,

    In CRM 2011, you can add buttons via the Ribbon customization. You need to add button via or export existing ribbon customization file and then can add the  CRMParamter in the <Action> tag.

    Please also clarify, are you opening a custom webpage on click of button on a grid?

    You may refer the following Url for Ribbon buttons customization:

    http://dynamicscrm2011.wordpress.com/2011/04/12/ms-dynamics-crm-2011-ribbon-customization-part-i-add-a-custom-tab-to-microsoft-dynamics-crm-2011-ribbon/

    http://msdn.microsoft.com/en-us/library/gg309639.aspx


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, September 13, 2011 8:56 PM
  • Yes I have a button in the ISV Ribbon in Product's grid, that button opens a custom webpage and the code inside the webpage uses the selected product GUID's to achieve some actions.
    Tuesday, September 13, 2011 9:17 PM
  • Hi,

    If you will see your ribbon button XML code in customization file, in xml code you will find the <CommandDefinition> tag and inside you will find the Actions tag i.e.

     

     

    <CommandDefinitions>
    

     

     <CommandDefinition Id="Product.form.CustomGroup.Button.OpenWinodw.command">

     <EnableRules>

     </EnableRules>

     <DisplayRules>

     </DisplayRules>

    <Actions>

    <JavaScriptFunction Library="$webresource:Application_Entity_Form.Js" FunctionName="OpenCustomWindow">

     

                     <CrmParameter Value="SelectedControlAllItemIds" />

     

    </JavaScriptFunction>

    </Actions>

    </CommandDefinition>

     


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Tuesday, September 13, 2011 9:25 PM
  • Thanks Jehanzeb you gave me the clue, what finally works for me is this:

     

    <Actions>

    <Url PassParams="false" WinMode="0" Address=http://server/customwebpage.aspx WinParams="dialogHeight: 400px; dialogWidth: 900px">

    <CrmParameter Name="IDs" Value="SelectedControlSelectedItemIds"/>

    </Url>

    </Actions>

    References:

    http://msdn.microsoft.com/en-us/library/gg328363.aspx

    http://msdn.microsoft.com/en-us/library/gg309332.aspx

     

    • Marked as answer by jimenezalbert0 Wednesday, September 14, 2011 12:04 AM
    Wednesday, September 14, 2011 12:04 AM
  • Hi,

    If you have found any responses helpful then please Mark them as answer also.


    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".
    Wednesday, September 14, 2011 6:00 AM
  • hi friend,

    passing parameter to the custom html page is ok, but how to get the value in the html window?????

    Monday, October 29, 2012 7:05 AM
  • Hi Naveen,

    You can get the parameter values form the HTML window using the  JScript, try using the following JScript method:

    function getQueryStringParameter(prmQSParamter)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.search);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }



    Jehanzeb Javeed

    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".


    Monday, October 29, 2012 11:50 AM