web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

LINQ query joining Account, Case and Activity entities

(0) ShareShare
ReportReport
Posted on by

Hello,

I try to make the following query using Account, Case and Activity entities :

var findCases =
from a in context.AccountSet
join c in context.IncidentSet
on a.AccountId equals c.CustomerId.Id
join p in context.ActivityPointerSet
on c.Id equals p.RegardingObjectId.Id
select new 
{
TicketNumber = c.TicketNumber,
IncidentId = c.IncidentId,
Title = c.Title,
CreatedOn = c.CreatedOn,
StateCode = c.StateCode,
AccountName = a.Name,
};

The execution of this query gives the error:

AttributeFrom and AttributeTo must be either both specified or both ommited. You can not pass only one or the other. AttributeFrom: , AttributeTo: regardingobjectid 


Any suggestion will be appreciated.

Regards.

Radu Antonache

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Bruno Lucas Profile Picture
    5,421 on at

    Sometimes is the order of the joins.

    why you have a comment on //ActivityTypeCode = p.ActivityTypeCode?

    note that the comment is leaving the parameter above with a comma

    that statement should be like:

    {
     TicketNumber = c.TicketNumber,
     IncidentId = c.IncidentId,
     Title = c.Title,
     CreatedOn = c.CreatedOn,
     StateCode = c.StateCode,
     AccountName = a.Name(no comma here)
     //ActivityTypeCode = p.ActivityTypeCode
     };

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans