locked
Hididng System Views from Lookup RRS feed

  • Question

  • Hi ,

    When the look up button is clicked on the form , We are able to show the custom view as default, but we need to hide the other system views. Is there any way to show only the custom view and hide the remaining views on the lookup Record-webpage dialog.

    Thanks

    srinivas

     

     


    srinivas
    Thursday, December 8, 2011 11:38 AM

Answers

  • what I understood is that you need to display the view that has been created at runtime only as the default view, to do to you can use the below code:

        Xrm.Page.getControl( "LOOKUPFIELDNAME" ).setDefaultView( "VIEWID" );
        document.getElementById( "LOOKUPFIELDNAME" ).setAttribute( "disableViewPicker", "1" );
    

    otherwise I believe that you should follow Kirsten recommendation

     

    Best regards..

    Thursday, December 8, 2011 1:21 PM
  • Hi

    You can set this from the Display properties for the lookup field on the form designer. At the bottom you can choose Show Selected Views and then only select the custom views you have created

    Kind regards

    Kirsten

    Thursday, December 8, 2011 11:53 AM

All replies

  • Hi

    You can set this from the Display properties for the lookup field on the form designer. At the bottom you can choose Show Selected Views and then only select the custom views you have created

    Kind regards

    Kirsten

    Thursday, December 8, 2011 11:53 AM
  • what I understood is that you need to display the view that has been created at runtime only as the default view, to do to you can use the below code:

        Xrm.Page.getControl( "LOOKUPFIELDNAME" ).setDefaultView( "VIEWID" );
        document.getElementById( "LOOKUPFIELDNAME" ).setAttribute( "disableViewPicker", "1" );
    

    otherwise I believe that you should follow Kirsten recommendation

     

    Best regards..

    Thursday, December 8, 2011 1:21 PM
  • Hi kristen,

    Thanks a lot for the reply. We are creating the Custom View Dynamically from Javascript, so how can we display only that view.

     

    Thanks,

    srinivas

     

     

     


    srinivas
    Thursday, December 8, 2011 1:23 PM
  • Srinvias,

    Please refer to my post above, it will solve your problem.

    Thursday, December 8, 2011 2:04 PM
  • Sorry, I didn't realise you were creating the view dynamically. Like Mostafa says there is the setDefaultView method which I am assuming you are already using. There isn't a method on the SDK for dynamically selecting which views are available for a lookup at runtime. The only supported work around would be to select only one view using the form properties (maybe a default view?) and then when you set your dynamic custom view at runtime there will only be 2 views available. Not a great work around sorry!

    If you are looking at unsupported methods, you could disable the view selector in the lookup dialog box so the user can only see your default view and can't change any others. The second line of code Mostafa suggests above would do this for you. For other (unsupported) customizations to the lookup dialog box see here: http://nishantrana.wordpress.com/2011/12/07/customization-unsupported-of-lookup-in-crm-2011/

    Kind regards

    Kirsten

     

     

    Thursday, December 8, 2011 2:09 PM
  • Dear Srinvias, please mark my post as answer if it was helpful, otherwise please elaborate so we can help you
    Thursday, December 8, 2011 3:41 PM
  • Hi

    Thanks for the Help, I have used both the solutions in different Scenarios.

     

    Thanks,

    Srinivas


    srinivas
    Thursday, December 8, 2011 3:59 PM