Working with Link Entity
-
domingo, 19 de agosto de 2012 08:01
Hi,
I have a custom field in "Product" entity and call it "Product Group"(new_productgroup).
I also have another custom N:1 relationship between "Product" and "Competitor" with the name "new_competitor_product" and relationship attribute name is "new_competitorid".In the "Phone Call" entity I need to fetch all "Competitor"s that sale "product"s with the 'A' "Product Group" and filter my "competitor" lookup to its records.
I wrote the following code with try and error and without understanding the background concept and it does not work.
var fetchStr = "<fetch mapping='logical'>" + " <entity name='competitor'>" + " <all-attributes />" + " <link-entity name='new_competitor_product' from='new_competitorid' to='new_competitorid' intersect='true' visible='false'>" + " <link-entity name='product' from='productid' to='productid' alias='aa'>" + " <all-attributes />" + " <filter>" + " <condition attribute='new_productgroup' operator='eq' value='1' />" + " </filter>" + " </link-entity>" + " </entity>" + "</fetch> "; crmForm.all.new_competitorid.lookupbrowse = 1; crmForm.all.new_competitorid.AddParam("search", fetchStr);Please guide me to edit it...
Todas as Respostas
-
domingo, 19 de agosto de 2012 09:09Usuário que responde
Hi Soroosh,
You don't need the link to new_competitor_product unless you are using a N:N relationship. If you only have a N:1 your fetchxml would be something like:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true"> <entity name="competitor"> <all-attributes /> <order attribute="name" descending="false" /> <link-entity name="product" from="new_competitorid" to="competitorid" alias="aa"> <filter type="and"> <condition attribute="new_productgroup" operator="eq" value="1" /> </filter> </link-entity> </entity> </fetch>hth,
Scott
Scott Durow
Read my blog: www.develop1.net/public
If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"- Sugerido como Resposta Scott DurowMicrosoft Community Contributor, Editor domingo, 19 de agosto de 2012 22:38
- Marcado como Resposta Soroosh81 segunda-feira, 20 de agosto de 2012 09:27
-
segunda-feira, 20 de agosto de 2012 09:30
Thank you Scott
It's work...