Passing Key in URL Custom Entity ASP

  • I am having a issue with creating a URL string with the proper keys.  I have a custom .asp page and if I call it from a tab all the keys carry over correctly as I had planned

    example working URL passing correct keys and ID        
    SID=81974805963075&Key0=58&Key1=97&Key2=
    106092&Key37=6009&Key50=23004&Key58=6009
    &J=test/testproj.asp&F=Project/ProjectSummary.asp&prmx_ProjectID=6009&T=Project

    I also have a button on a asp page of a custom entity that was created and when I click the button there it produces this URL

    example working URL NOT passsing correct keys and NOT pass an ID at all
    SID=81974805963075&Key0=58&Key1=97&Key2=106092&Key58=6009
    &F=Project/ProjectSummary.asp&J=test/testproj.asp

    I have tried searching through the community for the past few hours looking at every article I could find.  I found several and sure several address it and I have tried suggestions in each (most Jeff posted which he rocks by the way wealth of knowledge) but whatever I try I either end up breaking my asp page 500 error or end up with the same result as posted above. 

    Here is the code to the button on the asp page (I put it back to the way I started).  How can I adjust the string to carry over properly to the example correct URL above?

    Container.AddButton(CRM.Button("Test Button","SendLetter.gif",CRM.URL("test/cloneproj.asp")));

  • Chris

    Can you give a little more detail on context.

    I am not sure whether you are trying the same code called from the tab and called from the custom page.


  • Jeff

    Thanks for the quick reply.  I am trying to call the exact same code from the button and the tab (asp page  test/clone.asp).  I noticed when I put the code on the button its not passing the correct keys and id .  

    Container.AddButton(CRM.Button("Test Button","SendLetter.gif",CRM.URL("test/cloneproj.asp")));

    However if I create a tab content and call a customfile (test/clone.asp) it will pass the id and keys needed to copy the prmx_projectid to the oppo_projectid. I need the button to grab the prmx_projectid and looks like from the url the tab produces keys 37 and 50 (not 100% sure on keys just going off the url the tab produces here).  What the button is doing is copying the project info from the project entity and passing that to the test/cloneproj.asp I then have the fields mapped to the opportunity entity.  Again if I use the tab to call the test/cloneproj.asp page everything works perfect but if I use the button it doesn't pass the field or prmx_projectid.

    The only reason I put it in the tabcontent to call the page was to see if it could pass the correct info (which it does) now I am trying to replicate the same actions that happen when you click the tab onto the button on the asp page.  They are one in the same I would like to use the button and not the tab.  Hope this helps clarify alittle.  I know I need to supply a string to the end of the url calling the page from the button but haven't been able to figure out what the string might be. Thanks again Jeff.

    Chris

  • Chris

    So if the working link looks like

    SID=81974805963075&Key0=58&Key1=97&Key2=

    106092&Key37=6009&Key50=23004&Key58=6009

    &J=test/testproj.asp&F=Project/ProjectSummary.asp&prmx_ProjectID=6009&T=Project

    and the not working looks like

    SID=81974805963075&Key0=58&Key1=97&Key2=106092&Key58=6009

    &F=Project/ProjectSummary.asp&J=test/testproj.asp

    and we understand that the order of the variable name/value pairs is not important.

    Then the missing pairs are

    &Key37=6009&Key50=23004&prmx_ProjectID=6009&T=Project

    You can use the value of 'T' to test if you are being called from the Project tab or not.

    If the page is not being called from the tab then we can add the additional name/value pairs to the URL ourselves.

    e.g.

    Container.AddButton(CRM.Button("Test Button","SendLetter.gif",CRM.URL("test/cloneproj.asp")+"&Key37="+intKey37+"&Key50="+intKey50+"&prmx_ProjectID="+intProjectID+"&T=Project"));

    This also assumes you have declared variable to contain the missing data, in my example: intKey37, intKey50, intProjectID


  • Jeff thanks again worked like a charm!!!