How to retrive contract line using by DynamicsEntities Retrive Method RRS feed

  • Question

  • Hi fri,


             How can i get multi contract line by using DynamicsEntities Retrive method. My sample code is only get one line. Let say i have 3 contract line but when i retive it, i got only last lite. Somebody please guide to me. Is it my sample code something worng?


    DynamicsEntities.GetDynamicEntity(new AllColumns(), "contractdetail", "contractid",
                                            new object[] {new Guid("C03BDF5F-1D26-E111-99DA-0003FFC641D9")});
            public static DynamicEntity GetDynamicEntity(AllColumns _allcolumns,string _entityname, Guid _entityid )
                // Create Service
                CrmService _crmService = CrmWebServices.CrmServices();
                // Create the retrieve target.
                TargetRetrieveDynamic targetRetrieve = new TargetRetrieveDynamic();
                // Set the properties of the target.
                targetRetrieve.EntityName = _entityname.ToLower();
                targetRetrieve.EntityId = _entityid;
                // Create the request object.
                RetrieveRequest _retrieverequest = new RetrieveRequest();
                // Set the properties of the request object.
                _retrieverequest.Target = targetRetrieve;
                _retrieverequest.ColumnSet = _allcolumns;
                // Indicate that the BusinessEntity should be retrieved as a DynamicEntity.
                _retrieverequest.ReturnDynamicEntities = true;
                // Execute the request.
                RetrieveResponse _retrieveresponse = (RetrieveResponse)_crmService.Execute(_retrieverequest);
                // Extract the DynamicEntity from the request.            
                DynamicEntity _dynamicentity = (DynamicEntity)_retrieveresponse.BusinessEntity;
                return _dynamicentity;

    Make Simple & Easy
    Thursday, December 15, 2011 2:58 AM


  • Hi fri,


            I solved it. I should be use

    RetrieveMultipleResponse _retrievemultipleresponse = (RetrieveMultipleResponse)_crmService.Execute(_retrievemultiplerequest);

    Make Simple & Easy
    • Marked as answer by Yukonn Thursday, December 15, 2011 3:25 AM
    Thursday, December 15, 2011 3:25 AM