OData

Associate
Joined
27 Jan 2005
Posts
1,333
Location
S. Yorks
I am trying to query Dynamics CRM to return the quote details, so far I can return the quote details for a specific quote, however it returns everything.

Code:
private void BeginRetrieveQuoteDetail(Guid Id)
        {
            dataGrid1.ItemsSource = null;

            _context = new AnconTestContext(ODataUri);

            lstQuoteDetails = new DataServiceCollection<QuoteDetail>(_context);

            var result = from QuoteDetailSet in _context.QuoteDetailSet.Where<QuoteDetail>(r=> r.QuoteId.Id ==Id) select QuoteDetailSet;
          
            lstQuoteDetails.LoadCompleted += new EventHandler<LoadCompletedEventArgs>(lstQuoteDetails_LoadCompleted);
            lstQuoteDetails.LoadAsync(result);

        }

        private void lstQuoteDetails_LoadCompleted(object sender, LoadCompletedEventArgs e)
        {
            if (lstQuoteDetails.Continuation != null)
            {
                lstQuoteDetails.LoadNextPartialSetAsync();
            }
            else
            {
                dataGrid1.ItemsSource = lstQuoteDetails;
            }

        }

How can I get it to return specific columns?

regards,

Matt
 
Forgot to add.

If I change line to

Code:
var result = from QuoteDetailSet in _context.QuoteDetailSet.Where<QuoteDetail>(r=> r.QuoteId.Id ==Id) select QuoteDetailSet.BaseAmount;

I get an error at line

Code:
lstQuoteDetails.LoadAsync(result);

Argument 1: cannot convert from 'System.Linq.IQueryable<Microsoft.Crm.Sdk.Samples.CrmODataService.Money>' to 'System.Linq.IQueryable<Microsoft.Crm.Sdk.Samples.CrmODataService.QuoteDetail>'

and

The best overloaded method match for 'System.Data.Services.Client.DataServiceCollection<Microsoft.Crm.Sdk.Samples.CrmODataService.QuoteDetail>.LoadAsync(System.Linq.IQueryable<Microsoft.Crm.Sdk.Samples.CrmODataService.QuoteDetail>)' has some invalid arguments

regards,

Matt
 
Thanks for the replies guys.

We cannot use the OOB quote as the quote portion of our CRM product is quite complex to say the least.

Another complication is that I have now been asked to look at moving the quote module across to HTML5 - any help on how to get started on this as nothing is appearing in google on how to get started with HTML5 and dynamics crm.

regards,

Matt
 
Back
Top Bottom