Hi,
I want to get all the activities of Leads based on contact assign to lead as a customer. For example there is a contact "Nanji Mange". I have assign this contact as a customer in different 30 leads. Each lead has 4 activities. So there will be total 120 activities. Now, on the based of the contact, I want to get list of activities.
I want to get this using API using javascript ajax call. I have following way but it will make it too slow.
1- Fire a query to get all the leads whose customer is "Nanji Mange"
2- Loop of result get in #1(30 records)
3- In each loop, fire a query on activity whose "Regarding" value is current lead id.
Note: Above solution works but as loop iterates for 30 times and it takes too much time. This is example of 30. There can be 100-1000 leads.
Can anybody please suggest me faster way to get this?
Hi
Yeah Ravi, it working the way you suggested.
I have asked separate question which is extended to this question community.dynamics.com/.../297068
Please suggest.
Hi,
You don't need to do all this, build a fetch xml query which returns the activities where regarding (Lead)'s Customer is your contact (i.e. your contact). For this, you can use advance find. Once the query is ready, you can use WEB API to run the fetchxml directly.
Refer these links-
community.dynamics.com/.../using-fetchxml-with-xrm-webapi-retrievemultiplerecords-in-dynamics-365-v9
docs.microsoft.com/.../retrieve-and-execute-predefined-queries
You can use CRM Rest Builder to build the WEB API request. This is the easiest way to build the query as well as execute it and see the results.
carldesouza.com/dynamics-crm-rest-builder
You can download the tool here- github.com/.../releases
Hope this helps.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156