locked
How to create a 1:1 relationship in CRM 4.0 RRS feed

  • Question

  • Hi all,

    I know that CRM 4.0 doesn't support a 1:1 relationship.  Is there a way around it?  Here is my situation:  I have a patient entity, an asset entity and astaff entity, whom is register to 1 unit tag.  one patient can only be connected to 1 tag at any given time. And 1 tag can be on connect on 1 thing.  The thing can be an thing or a person. 

    There I need to creat a 1:1 relationship between tag with patient, tag with asset and tag with staff.

    Please recommend a solution, it will be greatly thankful

    Sam


    Sam
    Tuesday, June 1, 2010 2:53 PM

Answers

  • Hi,

    yes it is  not  possible in  MS CRM 4. But you can do something like this.

    Create a 1:N relationship between Entity A & Entity B

    1) on Entity A, You  will have a left navigation pane where you can add more than one Entity B (instances), Now you have to hide it, it is pretty straight fwd.

    document.getElementById("navEntitiesB").style.display = "none"

    2) on Entity B,  Add  the lookup field, This lookup Field means only 1 record from A can be associated with B.

    thats' it,  now you have restricted B to be added against only one A and on  A you have hidden  the possiblity of adding entites instances.


    Muhammad Ali Khan
    http://malikhan.wordpress.com
    • Marked as answer by Jim Glass Jr Tuesday, June 1, 2010 5:16 PM
    Tuesday, June 1, 2010 3:02 PM

All replies

  • Hi,

    yes it is  not  possible in  MS CRM 4. But you can do something like this.

    Create a 1:N relationship between Entity A & Entity B

    1) on Entity A, You  will have a left navigation pane where you can add more than one Entity B (instances), Now you have to hide it, it is pretty straight fwd.

    document.getElementById("navEntitiesB").style.display = "none"

    2) on Entity B,  Add  the lookup field, This lookup Field means only 1 record from A can be associated with B.

    thats' it,  now you have restricted B to be added against only one A and on  A you have hidden  the possiblity of adding entites instances.


    Muhammad Ali Khan
    http://malikhan.wordpress.com
    • Marked as answer by Jim Glass Jr Tuesday, June 1, 2010 5:16 PM
    Tuesday, June 1, 2010 3:02 PM
  • Hi Muhammad,

    thank you, i will give it a try

    thx

    Sam


    Sam
    Tuesday, June 1, 2010 3:07 PM
  • If you would like to get 1:1 relationships into CRM sometime in the future go and up-vote this

    https://connect.microsoft.com/dynamicssuggestions/feedback/details/561816/provide-1-1-relationship-type-out-of-box

    Thanks.

    Tuesday, June 1, 2010 11:00 PM
  • That works ok - but what if you don't want it hidden on the Entity A side?

     

    I have this situation -->  the entity has a recursive relationship to itself.  so there exists a "chain" of related records A - B - C over time.   B can only be the precursor to C, not for another record.  And C can only be the follow-on to B, not another record.

     

    I need the view forward and back botht to be visible.

     

    Thanks in advance

     

    Jennifer

    Friday, January 21, 2011 3:32 PM
  • There is a way of doing this without hiding anything - on form load, use the web service to retrieve an instance of Entity B that is related to Entity A. If it returns null then carry on, if it returns an instance then close the window before anything else happens:

     

    window.close();
    return false; // to stop the form showing a message to say that things haven't been saved
    

     

    Obviously you might want to put in a descriptive alert box too so the end user knows why it's not allowing them to create a new instance.

    Thursday, July 28, 2011 10:33 AM
  • Yeah hiding is not the solution since from lookup in Entity B , you can always create new record for Entity A.

    Haris Adil e-Bizsoft

    Friday, May 18, 2012 11:23 AM