Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Need to import data in a 1:N relationship

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi

Is it possible to import data in an a 1 to many relationship. I have an entity X which is having relationship with opportunity. An opportunity an have X objects associated with it. The data of X and opportunity is already available in excel file and I can import data in both X and Opportunity. But don't know how we can import data such that when I am finished with import it must show X already associated with Opportunity.

Thanks in advance. 

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    Hi there!

    As an alternative to manual export/import data proccess, you may take a look at the service data2crm, it offers automated data migration across CRM systems, as well as precirve relations.  Here appsource.microsoft.com/.../magneticone.crm-data-migration;tab=Overview you may find more info.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    Thanks guys, I found the solution. It seems similar to one proposed by Aric Levin. Here are details on stackoverflow: stackoverflow.com/.../import-data-from-an-excel-file-in-a-1n-relationship

  • Verified answer
    Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Need to import data in a 1:N relationship

    All you have to do is import the RentRoll data (using Data Import Wizard), and have the opportunityId as one of your parameters. That is in case the opportunities are already in the system.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    Naveed,

    You only need to enforce the relationship at one end as it's a subgrid and that end is the child end.

    The child records (N) need to be bound to the parent. 

    If you don't already, you need to have a lookup for your Rent Roll to the Opportunity entity and that needs to contain the opportunity {ID}

    Rent Roll

    {

    name: <text>

    ..

    Opportunity: <{OpportunityId}> //lookup

    }

    Then they will appear. If not, the problem is in your view.

    I assume the Rent Roll view your referencing (in Opportunity's Rent Roll subgrid) is _all_ related Rent Rolls, make sure you're not filtering any out.

    You absolutely can do it programmatically. I do this using a custom native web application for custom 1 : custom N.

    I do as above with no issues.

    Disclaimer: I've NEVER done this with bulk upload except for the generic  account - contact stuff so I can't help you there. 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    It seems either I am unable to explain the problem, or might be no one have ever tried that:

    Trying to simplify it as much as possible. "Rent Roll" is a custom entity.  A opportunity can have multiple rent and rolls. I already have data in "Opportunity" and "Rent Roll". Is there a way by which I can fill the below "Rent Roll" on opportunity details page? 

    6837.Unbenannt.PNG

    Thanks

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Need to import data in a 1:N relationship

    I'm not too familiar with the excel importing system in CRM. I use SSIS and KingswaySoft Integration to do my bulk uploads as its does the job quite well.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    I think I see what you're getting at. You may need multiple separate bulk uploads.

    I don't think you can do it all in one:

    1st. Opportunity and Id's for X,Y,Z for each

    2nd. X with Opportunity ID {Id}

    3rd.  Y with Opportunity ID {Id}

    4th.  Z ..

    You have to enforce the relationship at both ends. If this is a pain, you may even be better off doing it programatically with Odata using a deep insert.

    msdn.microsoft.com/.../gg328090.aspx

    e.g

    POST [Organization URI]/api/data/v8.2/accounts HTTP/1.1

    Content-Type: application/json; charset=utf-8

    OData-MaxVersion: 4.0

    OData-Version: 4.0

    Accept: application/json

    {

    "name":"<name from Excel spreadsheet>",

    "oppotunityid@odata.bind":"/opportunities(00000000-0000-0000-0000-000000000001)"

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    By 1:1 relationship I mean simple lookup. So X is also looked up with Opportunity (two way relationship).

    Yes I can generate two X records and I can associate both of them to opportunity and they are visible over there. But instead of manually associating them I want to import this association information from a XLS (because the opportunity and X records are in thousands and manually associating them will take a lot of time).

  • Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Need to import data in a 1:N relationship

    Unless i'm missing something. CRM doesn't have 1:1 relationship oob, you would have to do some configuration to make it 1:1.

    But lets say for example you added 2 X records and associate them to the same Opportunity. Doesn't that mean that that Opportunity has 2 X records associated to it?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Need to import data in a 1:N relationship

    Thanks Thomas,

    Yes that creates only one way relationship from X to Opportunity (that is X knows its Opportunity) but it does not show what Xs this opportunity have (1:N relation).

    Fro example:

    Entity X

    --------------------

    Name    Opportunity

    A            o1

    Opportunity o1

    --------------------

    Xs: Still empty (List box).

    Thanks for your help in advance

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,321 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans