locked
Hiding personal queues in lookup RRS feed

  • Question

  • Hi,
      I have created relationship between case and queue. In case user can select queue in which case will be assigned. When I click on queue lookup it shows all the queues including personal queues of the users. How can I hide the personal queues in the lookup view and display only queues those are created ?

    Thanks in advance
    Regards,
    - Vipin Kavishwar
    Friday, June 5, 2009 10:14 AM

Answers

All replies

  • Hi, Vipin.

    You can filter data inside your lookup. How to do it I suggest you to read article .
    Truth is opened the prepared mind My blog - http://a33ik.blogspot.com
    Friday, June 5, 2009 10:20 AM
    Moderator
  • Hi,

    Put the following javascript in the onLoad event of your case form

    // the name of the lookup attribute 
    var field = crmForm.all.new_customqueueid;
    
    // Ensure that search box is not visible in a lookup dialog
    field.lookupbrowse = 1;
    
    
    // Pass fetch xml through search value parameter 
    field.AddParam("search","<fetch mapping='logical'><entity name='queue'><filter><condition attribute='queuetypecode' operator='eq' value='1' /></filter></entity></fetch>");


    Followed by the follwing server side code in the lookupsingle.aspx




    <script runat="server"> 
    
    protected override void OnLoad( EventArgs e ) 
    { 
          base.OnLoad(e); 
          crmGrid.PreRender += new EventHandler( crmgrid_PreRender ); 
    } 
    
    void crmgrid_PreRender( object sender , EventArgs e ) 
    {
        // As we don't want to break any other lookups, ensure that we use workaround only if
        // search parameter set to fetch xml.
        if (crmGrid.Parameters["search"] != null && crmGrid.Parameters["search"].StartsWith("<fetch")) 
        { 
            crmGrid.Parameters.Add("fetchxml", crmGrid.Parameters["search"]);  
    
            // searchvalue needs to be removed as it's typically set to a wildcard '*' 
            crmGrid.Parameters.Remove("searchvalue");  
    
            // Icing on a cake - ensure that user cannot create new contact outside of the account
            // and then select it.
            this._showNewButton = false; 
        } 
    } 
    
    </script> 
    Regards,
    Nishant Rana

    http://nishantrana.wordpress.com
    Monday, June 8, 2009 8:28 AM