How to deactivate all records in child from parent record ? RRS feed

  • Question

  • Lets say i have entity A and entity B.

    Relation would be A:B 1:N

    That mean A would be the parent for B. 

    Scenario :

    I Created a button for Entity A. The purpose of the button is to deactivate all the record in Child Entity B.

    Any recommended way to solve this problem? Im planning to use SOAP in javascript. Can i? 
    use soap to deactivate all child record in entity B.


    Thursday, September 6, 2012 8:48 AM

All replies

  • Yes you can.

    you need to retrieve the all the related records and go through the loop to change the state.

    Here is a link to set state using jscript


    here is example on how to use retrieve multiple in javascript


    I hope this helps.

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer". Amreek Singh Senior Solution Architect HP Australia Sydney, Australia http://mscrmshop.blogspot.com http://crm2011usersettings.codeplex.com

    • Proposed as answer by Amreek Singh Thursday, September 6, 2012 12:31 PM
    • Edited by Amreek Singh Thursday, September 6, 2012 12:32 PM
    Thursday, September 6, 2012 12:31 PM
  • I call it from a ribbon button and will the ribbon button javascript work? cause there no reference on JSON or JQuery one.


    Friday, September 7, 2012 2:37 AM
  • Where can i generate my Soap xml? Do i have to type one by one ? 


    Friday, September 7, 2012 9:00 AM
  • Use advance find view for generating the xml query. need to pass the entity A name as a parameter.

    Thanks, Prakash Omer Ignify | Email: prakash.omer@hotmail.com

    Friday, September 7, 2012 2:22 PM
  • The xml query can use in soap ?


    Tuesday, September 11, 2012 1:45 AM
  • you can also get the xml query from the stun ware tool and you can convert that to soap query like this.

     var xml = '<?xml version=\'1.0\' encoding=\'utf-8\'?>' +
           '<soap:Envelope xmlns:soap=\'http://schemas.xmlsoap.org/soap/envelope/\'' +
           ' xmlns:xsi=\'http://www.w3.org/2001/XMLSchema-instance\'' +
           ' xmlns:xsd=\'http://www.w3.org/2001/XMLSchema\'>' +
           authenticationHeader +
           '<soap:Body>' +
           '<Fetch xmlns=\'http://schemas.microsoft.com/crm/2007/WebServices\'>' +
           '<fetchXml>' +
           '&lt;fetch mapping=\'logical\'  version=\'1.0\'&gt;' +
            '&lt;entity name=\'incident\'&gt;' +
             '&lt;attribute name=\'subjectid\' /&gt;' +
             '&lt;filter&gt;' +
              '&lt;condition attribute=\'incidentid\' operator=\'eq\' value=\'' + caseId + '\' /&gt;' +
             '&lt;/filter&gt;' +
            '&lt;/entity&gt;' +'&lt;/fetch&gt;' +
           '</fetchXml>' +
           '</Fetch>' +
           '</soap:Body>' +

    Thanks, Prakash Omer Ignify | Email: prakash.omer@hotmail.com

    Tuesday, September 11, 2012 12:21 PM