How do I get my contacts back from another account?

How to get contacts for each sub account of a parent account

  • A client has a custom report that they want functionality added to for Dynamics CRM 4.0. Currently, the report is ran from a Parent Account. When the report is finally generated, it displays the Child Accounts in rows. In those rows are columns for Primary Contact Job Title, Primary Contact Name, Secondary Contact Job Title, and Secondary Contact Name. These columns are currently empty but they need to be populated. How can I populate these fields using a dataset query in the report? Basically it would be query that would be For Each Sub Account, select the contacts, but I am having a hard time getting this to work. Any help would be appreciated. Thanks

  • Answer:

    The most flexible solution in my opinion is to use a http://msdn.microsoft.com/en-us/library/dd220581.aspx which allows you to pass a parameter to another report/query which then gets merged with your report. In this case you would be sending the child account's id as a report parameter. Then in the subreport you build your query for retrieving the child account parameters, and you can access the id you passed as a variable (ie. @ChildAccountID)

Vince at Stack Overflow Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.