web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Display all marketing lists to which an account's contacts belong

(0) ShareShare
ReportReport
Posted on by

So... I need to have a spot on an account page where it displays all the marketing lists that the contacts related to that account belong to. 

I have historically used marketing lists to track trade show attendance for our contacts, but now I've been asked to track them on an account and contact level... and to have that info easily accessible right from the account page. I honestly have no idea what the easiest way to do this is. 

I've been chasing a solution around for this for a while, and I'm still not sure how to even hint at the answer. I thought this would be an easy one to solve :( Murphy strikes again. 

Any help or direction on this would be greatly appreciated. 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Hi Samus,

    I don't know if it is possible to display this via out of the box customization methods (no code solution).

    What you could try is to create an IFrame, where you can display a custom grid / view , that has following filtering criteria - you would need to pass the accountid as a parameter

    MK-Advanced-Find.JPG

    Maybe other people have other ideas?

    Hope this helps,

    Radu

  • Community Member Profile Picture
    on at

    I'm fine with some level of code, so long as I don't have to figure it out completely myself. I'm very much a JS n00b.

    On the advanced find- how does one go about passing accountId as a parameter? I'd considered this method, but I have no idea how to basically tell the advanced find window that I'm trying to find the account for whatever page is loaded at the time.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi SamusFairchild,

    Marketing Lists are stored in the List entity. You can create a Sub-Grid on the account form and tailor it to display the marketing lists from the contact related to the account record.

  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Hi,

    From the advanced find you can download the fetchXml and use that as a startingpoint.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
      <entity name="list">
        <attribute name="listname" />
        <attribute name="type" />
        <attribute name="createdfromcode" />
        <attribute name="lastusedon" />
        <attribute name="purpose" />
        <attribute name="listid" />
        <order attribute="listname" descending="true" />
        <link-entity name="listmember" from="listid" to="listid" visible="false" intersect="true">
          <link-entity name="contact" from="contactid" to="entityid" alias="aa">
            <filter type="and">
              <condition attribute="parentcustomerid" operator="eq" value="{<<ACCOUNT_ID_HERE>>}" />
            </filter>
          </link-entity>
        </link-entity>
      </entity>
    </fetch>

    You then need to replace the <<ACCOUNT_ID_HERE>> with the GUID of the account. For CRM 9.X you can use https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity/getid. For earlier versions you need to look up the equivalent.

    Once you have the fetchxml and the accountid, you can use the built in retrieveMultipleRecords method - see for CRM 9.X https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords . For earlier builds you would need to generate the GET request yourself. The request would look very much like: YourCrmOrgURL/api/data/v9.0/lists?fetchXml=%3Cfetch%20version%3D%221.0%22%20output-format%3D%22xml-platform%22%20mapping%3D%22logical%22%20distinct%3D%22true%22%3E%0A%20%20%3Centity%20name%3D%22list%22%3E%0A%20%20%20%20%3Cattribute%20name%3D%22listname%22%20%2F%3E%0A%20%20%20%20%3Cattribute%20name%3D%22type%22%20%2F%3E%0A%20%20%20%20%3Cattribute%20name%3D%22createdfromcode%22%20%2F%3E%0A%20%20%20%20%3Cattribute%20name%3D%22lastusedon%22%20%2F%3E%0A%20%20%20%20%3Cattribute%20name%3D%22purpose%22%20%2F%3E%0A%20%20%20%20%3Cattribute%20name%3D%22listid%22%20%2F%3E%0A%20%20%20%20%3Corder%20attribute%3D%22listname%22%20descending%3D%22true%22%20%2F%3E%0A%20%20%20%20%3Clink-entity%20name%3D%22listmember%22%20from%3D%22listid%22%20to%3D%22listid%22%20visible%3D%22false%22%20intersect%3D%22true%22%3E%0A%20%20%20%20%20%20%3Clink-entity%20name%3D%22contact%22%20from%3D%22contactid%22%20to%3D%22entityid%22%20alias%3D%22aa%22%3E%0A%20%20%20%20%20%20%20%20%3Cfilter%20type%3D%22and%22%3E%0A%20%20%20%20%20%20%20%20%20%20%3Ccondition%20attribute%3D%22parentcustomerid%22%20operator%3D%22eq%22%20uiname%3D%22Test%20Company%22%20uitype%3D%22account%22%20value%3D%22%7B04DB747E-3BD6-E811-A967-000D3A2CBE72%7D%22%20%2F%3E%0A%20%20%20%20%20%20%20%20%3C%2Ffilter%3E%0A%20%20%20%20%20%20%3C%2Flink-entity%3E%0A%20%20%20%20%3C%2Flink-entity%3E%0A%20%20%3C%2Fentity%3E%0A%3C%2Ffetch%3E

  • Radu Chiribelea Profile Picture
    6,667 on at

    Hi Adrian,

    Would cover only the Primary Contact or would it cover also all the other child contacts?

    Regards,

    Radu

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi Radu,

    It covers the Primary Contact. Further customisation is required to cover all related contacts.

  • Community Member Profile Picture
    on at

    I need all contacts, not just the Primary :/

  • Community Member Profile Picture
    on at

    Okay I think I understand what you're getting at here, but wouldn't this only pull based off a static GUID? I need a grid/field/frame I can slap on the account form that will update for whatever account I happen to be on.

    I'll be honest, I don't understand at all what I'm supposed to do with the retrieveMultpleRecords capability there. I'm only vaguely familiar with iFrames, and haven't dealt with much beyond .ui stuff. Can you please explain further?

  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Basically your logic is following

    1. Open the Account form

    2. On the account form set up an IFrame that is running a JavaScript Function triggered once the Iframe is fully loaded

    3. The function can use the CRM Client side API to pull the AccountId from the context and insert that into a fetchXml string similar to what i pasted above

    4. Use the built in retrieveMultiple function and pass the fetchXml as a parameter - this will retrieve the marketing lists from the CRM Server for the child contacts of the account

    5. Once data is retrieved populate a custom grid / table with the marketing lists within the Iframe.

    Hope this helps,

    Radu

  • Community Member Profile Picture
    on at

    Okay, I have the retrieveMultiple function assembled with the correct fetchXml. However, I have no clue how to get a subgrid working with that information. A lot of what I'm reading seems to say that passing fetch to subgrids isn't supported, is bad practice, can break at any time. Is there a supported way to pull the info into a grid/table/view?

    Additionally- how? I've been trying at a number of different methods, and most are beyond my understanding. I'm sorry to ask for hand-holding here, but I'm pretty lost D:

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans