locked
Mass Creation of N:N Relations in CRM 2011 RRS feed

  • Question

  • Hi there,

    I have a problem with the above topic. I need to associate all records of an advanced find view in an n:n relationship to a certain record. It is needed to asscociate about 30.000 records (and this not only once). The feature is about print jobs in CRM).

    The CRM 2011 multi lookup dialog supports to show user queries, but it is limited to the paging settings (max 250), so the user would have to repeat this step about 120 times. Increasing the paging limit didn't help either, since the dialog javascript can't handle too many records.

    Is there any N:N import tool or does anyone have an idea how this problem could be handled easily?

    Solution for me would be programming  a Silverlight frame, but since this is not my skill, this will take me ages. Any help would be highly appreciated.

     

    Regards,
    Ludger

    Friday, August 12, 2011 3:52 PM

Answers

  • To solve this problem you are going to have to write some code -- either JScript (JavaScript) or Silverlight. Either way, the strategy will be pretty much the same. The following code assumes that you have the id of the advanced find view and the id of the record that you want to associate all records with:

    1. Using OrganizationData.svc, retrieve the SavedQuery based on the id so that you can get access to the FetchXML
    2. Using Organization.svc/web (SOAP Endpoint for Web Resources), execute a RetrieveMultiple request with the FetchXML. The ids will be present in each of the values that are returned.
    3. Using Organization.svc/web, call Associate with the single record as the primary record and the list of records as the "relatedEntities" parameter (to understand the parameters, see http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.iorganizationservice.associate.aspx).

    For more reference material, see http://technet.microsoft.com/en-us/library/gg490657.aspx.

    Michael

    • Marked as answer by LudgerK Monday, August 15, 2011 12:38 PM
    Friday, August 12, 2011 4:30 PM

All replies

  • To solve this problem you are going to have to write some code -- either JScript (JavaScript) or Silverlight. Either way, the strategy will be pretty much the same. The following code assumes that you have the id of the advanced find view and the id of the record that you want to associate all records with:

    1. Using OrganizationData.svc, retrieve the SavedQuery based on the id so that you can get access to the FetchXML
    2. Using Organization.svc/web (SOAP Endpoint for Web Resources), execute a RetrieveMultiple request with the FetchXML. The ids will be present in each of the values that are returned.
    3. Using Organization.svc/web, call Associate with the single record as the primary record and the list of records as the "relatedEntities" parameter (to understand the parameters, see http://msdn.microsoft.com/en-us/library/microsoft.xrm.sdk.iorganizationservice.associate.aspx).

    For more reference material, see http://technet.microsoft.com/en-us/library/gg490657.aspx.

    Michael

    • Marked as answer by LudgerK Monday, August 15, 2011 12:38 PM
    Friday, August 12, 2011 4:30 PM
  • Hi Michael,

    thanks for the answer. My intention was to get around developing a graphical interface. But I guess, I won't. There seems not to be another way for assigning the records except for this poor dialog.

    No problem, it'll work the way, you suggested. So I will have to put some effort into it :/

     

    Thx.

    Regards,
    Ludger

    Monday, August 15, 2011 12:38 PM
  • I had a similiar issue when importing marketing list members.  The goal was to let users import marketing list members over a period of time. I went with importing them as connections and created a plugin that would create the N:N and delete the connection.  Hope this helps.
    Monday, August 15, 2011 4:46 PM
  • thx Aahz,

    also a good idea.

    But in the meantime I solved it in another way without creating a UI.

    I created a text field in my main entity for the user to write fetchXml into. Users can get the fetchXml from advanced find and copy it there. Thus, if they have the need to add thousands of relations to the main entity, they can do it this way.

    An asynchronous plugin starts, when fetchXml is filled and a certain flag is set. This is not beautiful, but will work.

    Thank you for your ideas and references to KB articles.

    Ludger

    Tuesday, August 16, 2011 7:29 AM