locked
set subgrid values to another subgrid RRS feed

  • Question

  • hello all...

    the whole scenario is ..

    one 1 sugrid on opportunity and same type of grid on lead i want that when that lead get qualify the records in that subgrid will b automatically place in subgrid on opportunity grid except fetch xml ...

    here is the code to of jscript to get the subgrid values or records..

    but how i can set that record into another subgrid ?

    function updateSubGrid() {  

        var formType = Xrm.Page.ui.getFormType();
    alert(formType);
    if(formType==2)
    {
       var guid = Xrm.Page.getAttribute("originatingleadid").getValue()[0].id;
     

    var query =  
    "<q1:EntityName>product</q1:EntityName>" +  
    "<q1:ColumnSet xsi:type='q1:ColumnSet'>" +  
       "<q1:Attributes>" +  
          "<q1:Attribute>productnumber</q1:Attribute>" +  
          "<q1:Attribute>name</q1:Attribute>" +  
         
       "</q1:Attributes>" +  
    "</q1:ColumnSet>" +  
    "<q1:Distinct>false</q1:Distinct>" +  
    "<q1:Criteria>" +  
       "<q1:FilterOperator>And</q1:FilterOperator>" +  
       "<q1:Conditions>" +  
          "<q1:Condition>" +  
             "<q1:AttributeName>crm_lead</q1:AttributeName>" +  
             "<q1:Operator>Equal</q1:Operator>" +  
             "<q1:Values>" +  
                "<q1:Value xsi:type='xsd:string'>" + guid+ "</q1:Value>" +  
             "</q1:Values>" +  
          "</q1:Condition>" +  
       "</q1:Conditions>" +  
    "</q1:Criteria>";  
      
    var retrievedContacts = CrmServiceToolkit.RetrieveMultiple(query);  

    Wednesday, January 16, 2013 11:51 AM

All replies

  • Hi,
       Are you referring the subgrid to be of type "Product" or is it any other entity?

      

    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    Wednesday, January 16, 2013 12:14 PM
  • yes vicky ..

    that is product entity

    Wednesday, January 16, 2013 12:28 PM
  • Hi,
      For your planned designed following is the approach:

    1. Create a N:N relationship between Opportunity and Product entity.
    2. Register a plugin on "opportuntiy" entity creation(Post Stage).
    3. If "Target" property of the "InputParameters" has "originatingleadid" then get all the products(only productid column is fine) associated to the "Lead" entity using query exp. or fetch exp.
    4. Associate retrieved prodctuids with the newly created opportuntiy.
    5. Place a subgrid of type product on the opportunity entity.

    Or

      Consider following OOB approach if it is OK with your business needs:

    1. Register a plugin on "opportuntiy" entity creation(Post Stage).
    2. If "Target" property of the "InputParameters" has "originatingleadid" then get all the products(only productid column is fine) associated to the "Lead" entity using query exp. or fetch exp.
    3. Create a quotation(quote) record for the opportunity.
    4. Create quoteproduct record for each product which is with the lead. Specify quoteid as the quote record created in the above step.
    5. Use following approach to show quoteproducts in the opportunity entiy:

    http://blogs.msdn.com/b/crm/archive/2012/04/16/deep-queries-for-subgrids.aspx

    Hope it helps..!!!


    Vikranth http://howto-mscrm.blogspot.com "Please Mark it as answer if it helps in resolving your query"

    • Proposed as answer by Vikranth Pandiri Wednesday, January 16, 2013 12:40 PM
    • Unproposed as answer by mazhar hayat Wednesday, January 16, 2013 1:55 PM
    Wednesday, January 16, 2013 12:40 PM