locked
CRM 2013: JSCRIPT to disable view picker for a lookup doesn't seem to work. RRS feed

  • Question

  • Hi there,

    I am wrecking my head trying to update some of my previous CRM 2011 scripts to work with CRM 2013 but so far I've been out of luck.

    I have one script in CRM 2011 that disables the view selector of a lookup. This is how the code used to be in CRM 2011:

    document.getElementById("Lookup Id").disableViewPicker = 1;

    The above JScript returns an error in CRM 2013. Then I came across this post here, which indicates that I should update my script as follows:

    document.getElementById("Lookup Id")._behaviors[0].AddParam(“DisableViewPicker”, "1");
    document.getElementById("Lookup Id")._behaviors[0].set_showProperty(1);

    The JScript above doesn't return any errors. However it doesn't give me the desired result either. In fact, I don't think it does anything at all.

    I am at a loss here. Could someone please advise?

    Thanks for the help.

    Regards,
    P.


    • Edited by pmdci Tuesday, November 5, 2013 11:07 PM
    Tuesday, November 5, 2013 11:07 PM

All replies

  • its old JS code of crm 4.0
    you need to change code 

    use the Xrm.Page , look at msdn reference 

    crm2013 dosn't support crm 4 code
    • Edited by beniusb Thursday, November 14, 2013 9:53 AM
    • Proposed as answer by beniusb Thursday, November 14, 2013 9:53 AM
    • Unproposed as answer by pmdci Thursday, November 14, 2013 10:30 AM
    Thursday, November 14, 2013 9:52 AM
  • Actually if you read my post again you will notice that:

    I had a script that used to work with CRM 2011.

    That script doesn't work with CRM 2013 and returns an error instead.

    Upon researching on the matter, I found out an update code, which is cross-browser compatible. This code was also suggested by another user on this forum as supposed to work on CRM 2013.

    Now, with all due respect... If you have a suggestion on how to fix this issue, and you're so kind to share it with me, then by all means I will mark your solution as an answer and as helpful. But please, do not post me a 'read the manual' reply (as if I haven't checked the CRM 2013 SDK and MSDN libraries already) and mark it as an answer. This is not the way this forum works.

    Regards,
    P.


    • Edited by pmdci Thursday, November 14, 2013 10:38 AM
    Thursday, November 14, 2013 10:38 AM