Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Linq to CRM VB.NET

Posted on by Microsoft Employee

Hi!

I have this code which gives me

In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user.

    Function GetSiiProductNumberFromProduct(productId As System.Guid) As String

        Try
            Dim ctx As DataContext = Session("Ctx")
            Dim items As List(Of Product) = ctx.ProductSet.
            Where(Function(p) p.ProductId = productId).
            Select(Function(q) New Product With {
                        .Id = q.Id,
                        .ProductNumber = q.ProductNumber
                   }).ToList()

            Return items(0).ProductNumber
        Catch ex As Exception
            Return ""

        End Try
    End Function


The same code retrieving information from custom entity works fine. Please help.

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans