Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Retrieve multiple using linkentity

$
0
0

Hiii guys. i Tried to do sql query like below using query expression

SELECT order.new_nomororder, customer.new_email FROM order INNER JOIN on customer.new_fullname = order.new_customer WHERE customer.gender = 'female'


Here is the field type: 
new_nomororder = single line
new_email = single line

new_fullname = single line

new_customer = look up 

new_gender = optionset

Order Field:

Customer Field:

Here is the code i tried:

 QueryExpression query = new QueryExpression()
                {
                    Distinct = false,
                    EntityName = "new_callistyorder", 
                    ColumnSet = new ColumnSet("new_nomororder")
                };

                LinkEntity linket = new LinkEntity()
                {
                    LinkFromEntityName      = "new_callistyorder",
                    LinkToEntityName        = "new_callistycustomer",
                    LinkFromAttributeName   = "new_customer",
                    LinkToAttributeName     = "new_fullname",
                    JoinOperator            = JoinOperator.Inner,
                    Columns                 = new ColumnSet("new_email")
                };

                linket.LinkCriteria.AddCondition("new_gender", ConditionOperator.Equal, 100000000); 
               
                query.LinkEntities.Add(linket);
                EntityCollection colect = service.RetrieveMultiple(query);


After i register assemblies this code, and try to run in ms CRM. it show me error message like this:

i think the error is coming from this line: 

LinkFromAttributeName   = "new_customer"
LinkToAttributeName     = "new_fullname"

because those two field has different type of field. Is that true ?
How can i fix this error ?

Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>