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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Opportunity - Contact Query - Custom Field

(1) ShareShare
ReportReport
Posted on by 7
Hi All,

Hope you are well,
I am no expert when it comes to Dynamics CRM but I have been asked to look a few small issues to see if I can resolve them myself.
On our CRM system there seems to be some custom fields added to each opportunity to list a number of different contacts:
 
Fields:
Project Contact 1 (seems to be the Contact Field with a custom label)
Project Contact 2 (custom Field)
Project Contact 3 (custom Field)
Project Contact 4 (custom Field)
 
There seems to be an issue where if a contact is put in to 'Project Contact 1' and then you go to the contact and go to related - Opportunites it will show fine.
However if the contact is put under Project Contact 2-4, and you go to the contact - related - Opportunites it doesn't show. 
As a work around I changed the fields to show under related - sales and you can browse them one by one (see screenshot), wondering if there is away to combine all of these so that even if a contact is assigned to Project contact 1-4 it will show all related opportunites in 1 view?
 
(sorry if this is long winded, its just a strange problem/issue)
 
Thanks for your help.
 
 
 
CRM - Contact View.png
Categories:
I have the same question (0)
  • Suggested answer
    Eugen Podkorytov Profile Picture
    176 on at
     
  • Eugen Podkorytov Profile Picture
    176 on at
     
  • Suggested answer
    Ali Hamza Profile Picture
    170 on at

    Hi,

    After reviewing the problem statement, it appears to be a design issue that can be addressed using a many-to-many (M:M) relationship between Contact and Opportunity. This allows a grid of related Opportunities to be displayed on the Contact form through the related area.

    Using a single lookup field to relate Contacts and Opportunities won't work effectively, as each new contact would overwrite the previous one, resulting in only one contact being associated with a given opportunity. To automate this, whenever the Project Contact fields (1, 2, 3, or 4) are populated, you need to create corresponding entries in the M:M relationship table linking the Contact and Opportunity records.

    Once this is done, you can display the Opportunity grid on the Contact form based on the M:M relationship. Fields from the Opportunity can be shown in this view, although sorting won’t be possible since the fields belong to the parent table. If sorting is required, consider using a custom M:M relationship.

    Alternatively, you could modify the RetrieveMultiple plugin (on opportunity table) to fetch additional Opportunities in the default Contact → Opportunity relationship—specifically, Opportunities where the contact is listed in Project Contact 2, 3, or 4. However, this approach risks cluttering the Opportunity home page with duplicate or redundant records, which could impact usability.

     
    Regards
    Ali
     
  • Suggested answer
    Tom_Gioielli Profile Picture
    2,792 Super User 2025 Season 2 on at
    I want to add in a little note here in case other people come to review this question.
     
    First of all, @Ali Hamza's suggestion is the way to go. A N:N relationship is what you are looking for, and is the only way to achieve what you are hoping for.
     
    The other commenter made mention of "Polymorphic Lookups". While these are a thing in CRM, they do not allow you to create more than one relationship in a standard lookup field as they implied. Instead, a Polymorphic lookup is a lookup field that can point to more than one table. This is best exemplified by the out-of-box [Customer] field on many CRM Sales records, which can point to either a Contact or an Account. XRM Toolbox allows you to create your own polymorphic fields, but that won't help in this situation at all.
  • samuelGA Profile Picture
    7 on at
    First of all, thanks very much everyone for your responses and @Ali Hamza thanks your solution looks like it will do the job.
     
    Again im very new to CRM so please correct me if im wrong, but I need to go to the Contact Entity and create a new N:N relationship between the Contact and Opportunity Table.  See attached.
     
    Not sure what to do after that?
     
    Thanks again.
     
    New Relationship.png
  • Suggested answer
    abhisc Profile Picture
    32 on at

    Hello,

    Since you've now created the many-to-many (M:M) relationship between Contacts and Opportunities, the next step is to automate the population of this relationship based on the values in your Project Contact 1–4 fields.

    You have two primary options for automation:

    Option 1: Power Automate Flow (Low-Code)

    Trigger:

    • Set the flow to trigger on the creation or update of an Opportunity record.
    • Apply a trigger condition to ensure the flow runs only when any of the "Project Contact 1–4" fields are populated or modified.

    Logic:

    For each of the "Project Contact" fields:

    • Check if the field is populated.
    • If populated, use the "Relate rows" action to associate the specified Contact with the Opportunity via the established M:M relationship.
       

    Option 2: Custom Plugin (Pro-Code)

    Trigger:

    • Register the plugin on the Create and Update messages of the Opportunity entity.
    • For the Update message, set filtering attributes to monitor changes to the "Project Contact 1–4" fields.

    Logic:

    Within the plugin, for each "Project Contact" field:

    • Check if the field is populated.
    • If populated, use the Associate request to link the Contact to the Opportunity via the M:M relationship.

    Notes:

    • Ensure the automation handles scenarios where contacts are updated or removed from the "Project Contact" fields to maintain data integrity.
    • Verify that the subgrid on the Opportunity form (which displays related Contacts) is correctly configured to reflect the M:M relationship. This will allow users to view the associated Contacts directly from the Opportunity form.
    Thankyou

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans