Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

one to one Relationship

Posted on by 125

How to Make one to one Relationship in crm? Please guys be more specific.

Thanks in advance

*This post is locked for comments

  • EmployeeOcta Profile Picture
    EmployeeOcta on at
    RE: one to one Relationship

    Hello Mena_Khalaf ,

    There is no thing called one to one relationship in RDBMS.

    which also applicable to MSCRM.

    i thing you need to use N:N relationship between payment certificate and contract.

    i hope it may help you.

  • Suggested answer
    Dynamics_Alok Profile Picture
    Dynamics_Alok 1,746 on at
    RE: one to one Relationship

    1.Create a 1:N relation between Contract and Payment Certificate

    2.Create lookup field paymentcertificateid on Contract

    3.Register a plugin for Contract on update of the Payment Certificate lookup

    4.In plugin check whether Payment certificate going to be associated is associated with any contract ,if yes throw message or associate with contract 

      public void Execute(IServiceProvider serviceProvider)
            {
                IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
    
                IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
    
                IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
             
                try
                {
                    //Get Entity and then paymentcertificateid  from InputParameter
    
                    //Using queryexpression fetch contracts associated with the paymentcertificateid
    
                    //If ,associated contract is 0 ,go ahead and associate
                    
                    //Else ,throw a message that Payment Certificate is already associated with some other Contract.
                 
    
                }
                catch (Exception ex)
                {
                    //throw 
                }
    
               
            }

  • PS Profile Picture
    PS 23,577 on at
    RE: one to one Relationship

    Corrected your name in my comment

  • Mena_Khalaf Profile Picture
    Mena_Khalaf 125 on at
    RE: one to one Relationship

    Thanks Prashant,

    I already have these links but I'm asking for more details this plugin to update the lookup field and ...and ....

    if you have a sample for an example please provide me or video to explain.

    Look This is the scenario I have the contracts and payment certificates so i need the contract has only one payment certificate and the payment certificate for only one contract ,

    How can i do this ?

    and one last thing My name is Mena Khalaf not Mena Khalif =D

    Thanks again,

    Mena

  • Suggested answer
    PS Profile Picture
    PS 23,577 on at
    RE: one to one Relationship

    Hi Mena_Khalaf

    There's is no such thing called one to one relationship in CRM. its either 1:N or N:1 or N:N

    But I think, you have a requirement of creating a lookup on a form and the value of lookup should not be repeated. For e.g. if Mena is a contact in CRM and Contact form is having a lookup called Driver's License No.; now DL No. cant be repeated anywhere so this would be called a one to one relationship but technically its not available to create by configuration.

    Following URls will tell you how to do it:

    crmtipoftheday.com/.../create-a-11-relationship

    social.microsoft.com/.../onetoone-11-relationship-in-crm-2011

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: one to one Relationship

    go to the solution then select you enity. click the 1:NRelationship, then click new

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans