CRM.Url generating broken links for custom entity find pages

Hello,

while working on a project for a customer i came across a rather strange behavior of the CRM.
I tried to add a button on an ASP page for a custom entity that takes you to the search page for that entity.
To generate the url i used this command: CRM.Url("Test/TestFind.asp"); but instead of the expected link to /custompages/Test/TestFind.asp the system generated a link to system act 521.

Does anyone know why this is happening and/or how to avoid it ?

CRM Version: 2017 R2

  • 0

    Hello,

    Change your code to this instead:

    CRM.URL("Test/TestFind.asp?J=Test/TestFind.asp&E=Test")

    I can't remember when this first started - the oldest version I have on my machine is 73sp3 and it exhibits the same behaviour. It would appear that whenever the name of the file ends with 'Find' then this happens. Try it yourself.

    var url = CRM.URL("Test/TestFind.asp") : this will return a '521' url.

    var url = CRM.URL("Test/TestFindXXX.asp") : this will return a correctly formatted asp page url, even though 'TestFindXXX.asp' doesn't actually exist.

    It's looks like it's designed behaviour rather than a bug... but you might want to report it anyway.

  • 0

    Thank you very much for your answer :)

    I will try it out later.

    I really dont get why something like that would be made on purpose, but considering there is a lot stranger things that are meant to be that way its not that unlikely.

  • 0

    Hello Chris,

    i just tried your idea and unfortunately it isnt working for me.
    Maybe the reason for this is that 2 custom entities are in the context at the same time. Im not sure.
    I was however able to hack together a solution using the parameter PrevCustomURL from the current url:

    localhost/.../TestSummary.asp

    Here is the code i tested with:

    CRM.Url("Test/TestFind.asp?J=Test/TestFind.asp&E=Test");

    Returns a broken url...
    /CRM/eware.dll/Do?SID=129339995433613&Act=521&Mode=1&CLk=T&Key-1=58&Key0=58&Key58=3&test_TestID=3&F=FooBar/FooBarSummary.asp&J=Test/TestSummary.asp


    CRM.Url("Test/TestFindX.asp?J=Test/TestFindX.asp&E=Test");

    Here the Url is working as expected
    /CRM/CustomPages/Test/TestFindX.asp?J=Test/TestFindX.asp&E=Test&SID=129339995433613&Key-1=58&Key0=58&Key58=3&F=Test%2FTestSummary.asp&J=Test%2FTestFindX.asp

    With that problem fixed however a few new ones come up.
    Coming from FooBar and clicking on a link from that entity to Test and then using the return button causes the crm to confuse the values of Key58 used for bot Foobar and Test.

    Anyway thats another problem and not related to my main question.
    Thanks again for your help.