
I'm new to CRM Online...
I have an entity containing an attribute with a reference to a string attribute on a different entity.
Now I want to do a string compare in a data select. The problem is the attribute is type of an entityreference and not a string as I would expect.
Sample on what I'm trying to do (in an assembly plugin):
var result = from c in orgContext.CreateQuery<new_myentity>()
where c.new_baseid == ""
select c;
Is there an easy way to accomplish this? I've already tried doing another solution (Though I don't like the solution) where I first select the "base" entity and then do a compare like this:
However that dosen't work either.... Hope you can help me :)
var baseEntity = from b in .... etc.
var result = from c in orgContext.CreateQuery<new_myentity>()
where c.new_baseid.Id == baseEntity.GetEnumerator().Current.ToEntityReference().Id
select c;
*This post is locked for comments
I have the same question (0)Fixed the problem myself.
The syntax was almost correct, however getting the entity ref should be put into a separate line like thi:
Guid id = ((EntityReference)entity.Attributes["field"]).Id;
var result = from c in orgContext.CreateQuery<new_myentity>()
where c.new_baseid.Id == idselect c;