none
ISV button: Passing CRM case values into the URL to open a new page

    Kérdés

  • I've created a new toolbar called View. Upon clicking the View it takes me to a page on another application.
    We originally had this in an iFrame but the decision was to open it into a new window.

    Since this is done in the isv.config i don't think i can simply pass it the variables from the CRM page (e.g. case) into the URL.
    I'm taking a stab that i need to code some sort of javascript that if the button is pressed then get the values from the page (e.g. GUIDS, values, etc.) and pass them to the URL.

    Does the above sound right?

    On another matter...when i used to search on this forum it searched just the forums. Now it takes me to Bing microsoft search regardless if i say to search the forum only. Did I do something boneheaded that i can't search just on this forum?
    THanks.

    2009. október 15. 19:30

Válaszok

Az összes válasz

  • if this isv.config button is appear on case form then you can get the case form's fields values easily in isv.config java script code..


    e.g. getting case Id

    crmFormSubmit.crmFormSubmitId.value


    or getting owner use following syntax..

    crmForm.all.ownerid.DataValue[0].id

    2009. október 15. 19:54
  • So in the ISV.config, set the javascript in the code and then pull the values out like I did in the iFrame?
    I need to get the selected values from the page and pass them through the URL.

    2009. október 15. 20:21
  • Hi.

    In your ISV button's code you can use any form or properties defined in form. Check this article about form properties.
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    2009. október 15. 20:26
    Moderátor
  • So in the ISV.config, set the javascript in the code and then pull the values out like I did in the iFrame?
    I need to get the selected values from the page and pass them through the URL.


    If your button is placed on the grid's toolbar you can use following code to retrieve array of selected records:

    var selected = getSelected('crmGrid');
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    2009. október 15. 20:33
    Moderátor
  • Your isv button can call an onload function and popup the window e.g.

     

    <Button JavaScript=”OpenExternalApp();” />

     

    //Onload Handler

    OpenExternalApp = function()

    {

       var url = prependOrgName(“/isv/myapp/external.aspx?caseid=”) + crmForm.ObjectId;
       window.open(url,"","");
    }

     

     


    GI CRM Blog * GI Website
    2009. október 15. 21:31
  • If you mean on the top of the entity form (at the same level as Save / Save and Close) then use the following between the Entity tags in the isv config file. This would open up your custom page in a modal popup and when you close it refreshes the IFRAME you want to refresh. Just pass in the ID of the Iframe in the place of IFRAME_NAME. If you dont want to refresh any grid after closing the window then simply remove all the that is underlined.

    <ToolBar ValidForCreate="0" ValidForUpdate="1">
                <Button Icon="/_imgs/ico_16_1088_d.gif" JavaScript="window.showModalDialog('/ISV/myApp/myCustomPage.aspx?id=' + crmForm.ObjectId, null, 'dialogHeight=350px,dialogWidth=250px,status=no,toolbar=no,menubar=no,location=no'); crmForm.all.item('IFRAME_NAME').contentWindow.document.all.crmGrid.Refresh(); ">
                  <Titles>
                    <Title LCID="1033" Text="View" />
                  </Titles>
                  <ToolTips>
                    <ToolTip LCID="1033" Text="View" />
                  </ToolTips>
                </Button>
              </ToolBar>

    Also you can use window.open in the place of window.showModalDialog just by replacing with
    window.open('/ISV/myApp/myCustomPage.aspx?id=' + crmForm.ObjectId, null, 'height=560,width=1000,scrollbar=1,status=1,resizable=1,toolbar=no,menubar=no,location=no')


    If you mean on the Grid toolbar then use the following. The function getSelected('crmGrid') will get the guids selected from the grid and pass them as url parameters to the custom page. Even this refreshes the grid after the window is closed.

    <Grid>
                <MenuBar>
                  <Buttons>
                    <Button Icon="/_imgs/ico_18_mappings.gif" JavaScript="window.showModalDialog('/ISV/myApp/myCustomPage.aspx?id=' + getSelected('crmGrid'), null, 'dialogHeight=400px,dialogWidth=300px,status=no,toolbar=no,menubar=no,location=no'); crmGrid.Refresh();" WinParams="" PassParams="1">
                      <Titles>
                        <Title LCID="1033" Text="View" />
                      </Titles>
                      <ToolTips>
                        <ToolTip LCID="1033" Text="View the selected Record" />
                      </ToolTips>
                    </Button>
                  </Buttons>
                </MenuBar>
              </Grid>

    Hope this helps you.
    Santosh Kore CRM Developer
    2009. október 16. 0:14
  • Your isv button can call an onload function and popup the window e.g.

     

    <Button JavaScript=”OpenExternalApp();” />

     

    //Onload Handler

    OpenExternalApp = function()

    {

       var url = prependOrgName(“/isv/myapp/external.aspx?caseid=”) + crmForm.ObjectId;
       window.open(url,"","");
    }

     

     


    GI CRM Blog * GI Website

    Thanks everyone for your input. I'd love to give everyone credit. But I think this is the best solution for me as I can call the existing javascript code that I have on the onload event. Can't believe i didn't think of that one.  Thanks again everyone.
    2009. október 16. 2:48