locked
Updating 1 to Many records RRS feed

  • Question

  • Hi guys,

    I have an relationship setup between Opportunity and a custom entity.

    I would like to update a field within the opporutnity and when I save the record, a field in all the related (child) records gets updated.

    Is this possible using some fetch xml and/or jscript?

    Thanks for any help

    Bharat

    Thursday, October 13, 2011 1:13 PM

Answers

  • Proposed as answer by oldjc Friday, October 14, 2011 6:07 PM
  • Marked as answer by BharatP Friday, October 14, 2011 7:46 PM
Thursday, October 13, 2011 1:36 PM
Moderator
  • Hello Bharat!

    This is absolutely possible. I unfortunately don't have any examples at the moment but in CRM 4.0 we had many solutions that with a 1 to many relationship if the 1 had updates they were pushed automatically out to the Many. This was done through JScripting and Web service Calls. I believe the SDK and the CRM 2011 Training Kit would cover exactly what you need to do in this scenario. If I get a chance in a bit I'll find some references for you.

    Psudo Code would be:

    If Opportunity Entity fields were modified Then
    
    Get all custom entity records related to it from web service;
    
    Start Loop through each custom record at a time;
    Update Custom Entity fields;
    Use Webservice to update indivual record;
    Next;

     


    Jason Cosman
    • Marked as answer by BharatP Friday, October 14, 2011 7:45 PM
    Friday, October 14, 2011 1:35 AM
  • All replies

    • Proposed as answer by oldjc Friday, October 14, 2011 6:07 PM
    • Marked as answer by BharatP Friday, October 14, 2011 7:46 PM
    Thursday, October 13, 2011 1:36 PM
    Moderator
  • Hello Bharat!

    This is absolutely possible. I unfortunately don't have any examples at the moment but in CRM 4.0 we had many solutions that with a 1 to many relationship if the 1 had updates they were pushed automatically out to the Many. This was done through JScripting and Web service Calls. I believe the SDK and the CRM 2011 Training Kit would cover exactly what you need to do in this scenario. If I get a chance in a bit I'll find some references for you.

    Psudo Code would be:

    If Opportunity Entity fields were modified Then
    
    Get all custom entity records related to it from web service;
    
    Start Loop through each custom record at a time;
    Update Custom Entity fields;
    Use Webservice to update indivual record;
    Next;

     


    Jason Cosman
    • Marked as answer by BharatP Friday, October 14, 2011 7:45 PM
    Friday, October 14, 2011 1:35 AM
  • Hi, I agree with Tanguy's approach via plug-in. It's the easiest and straight forward for what you are looking for. I would suggest that you look into the SDK samples. If it's only one record you may even get by with a workflow but I would highly recommend plug-in
    • Proposed as answer by Seepath Sunday, October 16, 2011 3:44 PM
    Sunday, October 16, 2011 3:42 PM