724. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2/1/2017 2:56:58 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

724.1 Files compared

# Location File Last Modified
1 C:\Araxis_Merge_Comprasion\Pub_un\BTSSS_CIF_122016.zip\BTSSS_CIF_12_20_16\clean\CRM\trunk\SDK\SampleCode\JS\RESTEndpoint\JavaScriptRESTDataOperations\JavaScriptRESTDataOperations\Scripts SDK.REST.js Tue Dec 20 19:51:48 2016 UTC
2 Wed Feb 1 19:56:58 2017 UTC

724.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 0 0
Changed 0 0
Inserted 0 0
Removed 1 505

724.3 Comparison options

Whitespace
Character case Differences in character case are significant
Line endings Differences in line endings (CR and LF characters) are ignored
CR/LF characters Not shown in the comparison detail

724.4 Active regular expressions

No regular expressions were active.

724.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
3   //        
4   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
5   //        
6   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
7   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
8   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
9   //        
10   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
11   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
12   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
13   //  PARTIC ULAR PURPO SE.        
14   // ======= ========== ========== ========== ========== ========== ========== ==        
15   // <snippe tSDKRESTJS >        
16   if (typeof  (SDK) ==  "undefined ")        
17   { SDK = {  __namespac e: true };  }        
18   SDK.REST =  {        
19    _context:  function  () {        
20     ///<summ ary>        
21     /// Priv ate functi on to the  context ob ject.        
22     ///</sum mary>        
23     ///<retu rns>Contex t</returns >        
24     if (type of GetGlob alContext  != "undefi ned")        
25     { return  GetGlobal Context();  }        
26     else {        
27      if (typ eof Xrm !=  "undefine d") {        
28       return  Xrm.Page. context;        
29      }        
30      else        
31      { throw  new Error ("Context  is not ava ilable.");  }        
32     }        
33    },        
34    _getClien tUrl: func tion () {        
35     ///<summ ary>        
36     /// Priv ate functi on to retu rn the ser ver URL fr om the con text        
37     ///</sum mary>        
38     ///<retu rns>String </returns>        
39     var clie ntUrl = th is._contex t().getCli entUrl()        
40          
41     return c lientUrl;        
42    },        
43    _ODataPat h: functio n () {        
44     ///<summ ary>        
45     /// Priv ate functi on to retu rn the pat h to the R EST endpoi nt.        
46     ///</sum mary>        
47     ///<retu rns>String </returns>        
48     return t his._getCl ientUrl()  + "/XRMSer vices/2011 /Organizat ionData.sv c/";        
49    },        
50    _errorHan dler: func tion (req)  {        
51     ///<summ ary>        
52     /// Priv ate functi on return  an Error o bject to t he errorCa llback        
53     ///</sum mary>        
54     ///<para m name="re q" type="X MLHttpRequ est">        
55     /// The  XMLHttpReq uest respo nse that r eturned an  error.        
56     ///</par am>        
57     ///<retu rns>Error< /returns>        
58     //Error  descriptio ns come fr om http:// support.mi crosoft.co m/kb/19362 5        
59     if (req. status ==  12029)        
60     { return  new Error ("The atte mpt to con nect to th e server f ailed.");  }        
61     if (req. status ==  12007)        
62     { return  new Error ("The serv er name co uld not be  resolved. "); }        
63     var erro rText;        
64     try        
65           {  errorText  = JSON.par se(req.res ponseText) .error.mes sage.value ; }        
66     catch (e )        
67           {  errorText  = req.resp onseText }        
68          
69     return n ew Error(" Error : "  +        
70           re q.status +  ": " +        
71           re q.statusTe xt + ": "  + errorTex t);        
72    },        
73    _dateRevi ver: funct ion (key,  value) {        
74     ///<summ ary>        
75     /// Priv ate functi on to conv ert matchi ng string  values to  Date objec ts.        
76     ///</sum mary>        
77     ///<para m name="ke y" type="S tring">        
78     /// The  key used t o identify  the objec t property        
79     ///</par am>        
80     ///<para m name="va lue" type= "String">        
81     /// The  string val ue represe nting a da te        
82     ///</par am>        
83     var a;        
84     if (type of value = == 'string ') {        
85      a = /Da te\(([-+]? \d+)\)/.ex ec(value);        
86      if (a)  {        
87       return  new Date( parseInt(v alue.repla ce("/Date( ", "").rep lace(")/",  ""), 10)) ;        
88      }        
89     }        
90     return v alue;        
91    },        
92    _paramete rCheck: fu nction (pa rameter, m essage) {        
93     ///<summ ary>        
94     /// Priv ate functi on used to  check whe ther requi red parame ters are n ull or und efined        
95     ///</sum mary>        
96     ///<para m name="pa rameter" t ype="Objec t">        
97     /// The  parameter  to check;        
98     ///</par am>        
99     ///<para m name="me ssage" typ e="String" >        
100     /// The  error mess age text t o include  when the e rror is th rown.        
101     ///</par am>        
102     if ((typ eof parame ter === "u ndefined")  || parame ter === nu ll) {        
103      throw n ew Error(m essage);        
104     }        
105    },        
106    _stringPa rameterChe ck: functi on (parame ter, messa ge) {        
107     ///<summ ary>        
108     /// Priv ate functi on used to  check whe ther requi red parame ters are n ull or und efined        
109     ///</sum mary>        
110     ///<para m name="pa rameter" t ype="Strin g">        
111     /// The  string par ameter to  check;        
112     ///</par am>        
113     ///<para m name="me ssage" typ e="String" >        
114     /// The  error mess age text t o include  when the e rror is th rown.        
115     ///</par am>        
116     if (type of paramet er != "str ing") {        
117      throw n ew Error(m essage);        
118     }        
119    },        
120    _callback ParameterC heck: func tion (call backParame ter, messa ge) {        
121     ///<summ ary>        
122     /// Priv ate functi on used to  check whe ther requi red callba ck paramet ers are fu nctions        
123     ///</sum mary>        
124     ///<para m name="ca llbackPara meter" typ e="Functio n">        
125     /// The  callback p arameter t o check;        
126     ///</par am>        
127     ///<para m name="me ssage" typ e="String" >        
128     /// The  error mess age text t o include  when the e rror is th rown.        
129     ///</par am>        
130     if (type of callbac kParameter  != "funct ion") {        
131      throw n ew Error(m essage);        
132     }        
133    },        
134    createRec ord: funct ion (objec t, type, s uccessCall back, erro rCallback)  {        
135     ///<summ ary>        
136     /// Send s an async hronous re quest to c reate a ne w record.        
137     ///</sum mary>        
138     ///<para m name="ob ject" type ="Object">        
139     /// A Ja vaScript o bject with  propertie s correspo nding to t he Schema  name of        
140     /// enti ty attribu tes that a re valid f or create  operations .        
141     ///</par am>        
142     ///<para m name="ty pe" type=" String">        
143     /// The  Schema Nam e of the E ntity type  record to  create.        
144     /// For  an Account  record, u se "Accoun t"        
145     ///</par am>        
146     ///<para m name="su ccessCallb ack" type= "Function" >        
147     /// The  function t hat will b e passed t hrough and  be called  by a succ essful res ponse.         
148     /// This  function  can accept  the retur ned record  as a para meter.        
149     /// </pa ram>        
150     ///<para m name="er rorCallbac k" type="F unction">        
151     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
152     /// This  function  must accep t an Error  object as  a paramet er.        
153     /// </pa ram>        
154     this._pa rameterChe ck(object,  "SDK.REST .createRec ord requir es the obj ect parame ter.");        
155     this._st ringParame terCheck(t ype, "SDK. REST.creat eRecord re quires the  type para meter is a  string.") ;        
156     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.cr eateRecord  requires  the succes sCallback  is a funct ion.");        
157     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.crea teRecord r equires th e errorCal lback is a  function. ");        
158     var req  = new XMLH ttpRequest ();        
159     req.open ("POST", e ncodeURI(t his._OData Path() + t ype + "Set "), true);        
160     req.setR equestHead er("Accept ", "applic ation/json ");        
161     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
162     req.onre adystatech ange = fun ction () {        
163      if (thi s.readySta te == 4 /*  complete  */) {        
164       req.on readystate change = n ull;        
165       if (th is.status  == 201) {        
166        succe ssCallback (JSON.pars e(this.res ponseText,  SDK.REST. _dateReviv er).d);        
167       }        
168       else {        
169        error Callback(S DK.REST._e rrorHandle r(this));        
170       }        
171      }        
172     };        
173     req.send (JSON.stri ngify(obje ct));        
174    },        
175    retrieveR ecord: fun ction (id,  type, sel ect, expan d, success Callback,  errorCallb ack) {        
176     ///<summ ary>        
177     /// Send s an async hronous re quest to r etrieve a  record.        
178     ///</sum mary>        
179     ///<para m name="id " type="St ring">        
180     /// A St ring repre senting th e GUID val ue for the  record to  retrieve.        
181     ///</par am>        
182     ///<para m name="ty pe" type=" String">        
183     /// The  Schema Nam e of the E ntity type  record to  retrieve.        
184     /// For  an Account  record, u se "Accoun t"        
185     ///</par am>        
186     ///<para m name="se lect" type ="String">        
187     /// A St ring repre senting th e $select  OData Syst em Query O ption to c ontrol whi ch        
188     /// attr ibutes wil l be retur ned. This  is a comma  separated  list of A ttribute n ames that  are valid  for retrie ve.        
189     /// If n ull all pr operties f or the rec ord will b e returned        
190     ///</par am>        
191     ///<para m name="ex pand" type ="String">        
192     /// A St ring repre senting th e $expand  OData Syst em Query O ption valu e to contr ol which        
193     /// rela ted record s are also  returned.  This is a  comma sep arated lis t of of up  to 6 enti ty relatio nship name s        
194     /// If n ull no exp anded rela ted record s will be  returned.        
195     ///</par am>        
196     ///<para m name="su ccessCallb ack" type= "Function" >        
197     /// The  function t hat will b e passed t hrough and  be called  by a succ essful res ponse.         
198     /// This  function  must accep t the retu rned recor d as a par ameter.        
199     /// </pa ram>        
200     ///<para m name="er rorCallbac k" type="F unction">        
201     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
202     /// This  function  must accep t an Error  object as  a paramet er.        
203     /// </pa ram>        
204     this._st ringParame terCheck(i d, "SDK.RE ST.retriev eRecord re quires the  id parame ter is a s tring.");        
205     this._st ringParame terCheck(t ype, "SDK. REST.retri eveRecord  requires t he type pa rameter is  a string. ");        
206     if (sele ct != null )        
207      this._s tringParam eterCheck( select, "S DK.REST.re trieveReco rd require s the sele ct paramet er is a st ring.");        
208     if (expa nd != null )        
209      this._s tringParam eterCheck( expand, "S DK.REST.re trieveReco rd require s the expa nd paramet er is a st ring.");        
210     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.re trieveReco rd require s the succ essCallbac k paramete r is a fun ction.");        
211     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.retr ieveRecord  requires  the errorC allback pa rameter is  a functio n.");        
212          
213     var syst emQueryOpt ions = "";        
214          
215     if (sele ct != null  || expand  != null)  {        
216      systemQ ueryOption s = "?";        
217      if (sel ect != nul l) {        
218       var se lectString  = "$selec t=" + sele ct;        
219       if (ex pand != nu ll) {        
220        selec tString =  selectStri ng + "," +  expand;        
221       }        
222       system QueryOptio ns = syste mQueryOpti ons + sele ctString;        
223      }        
224      if (exp and != nul l) {        
225       system QueryOptio ns = syste mQueryOpti ons + "&$e xpand=" +  expand;        
226      }        
227     }        
228          
229          
230     var req  = new XMLH ttpRequest ();        
231     req.open ("GET", en codeURI(th is._ODataP ath() + ty pe + "Set( guid'" + i d + "')" +  systemQue ryOptions) , true);        
232     req.setR equestHead er("Accept ", "applic ation/json ");        
233     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
234     req.onre adystatech ange = fun ction () {        
235      if (thi s.readySta te == 4 /*  complete  */) {        
236       req.on readystate change = n ull;        
237       if (th is.status  == 200) {        
238        succe ssCallback (JSON.pars e(this.res ponseText,  SDK.REST. _dateReviv er).d);        
239       }        
240       else {        
241        error Callback(S DK.REST._e rrorHandle r(this));        
242       }        
243      }        
244     };        
245     req.send ();        
246    },        
247    updateRec ord: funct ion (id, o bject, typ e, success Callback,  errorCallb ack) {        
248     ///<summ ary>        
249     /// Send s an async hronous re quest to u pdate a re cord.        
250     ///</sum mary>        
251     ///<para m name="id " type="St ring">        
252     /// A St ring repre senting th e GUID val ue for the  record to  retrieve.        
253     ///</par am>        
254     ///<para m name="ob ject" type ="Object">        
255     /// A Ja vaScript o bject with  propertie s correspo nding to t he Schema  Names for        
256     /// enti ty attribu tes that a re valid f or update  operations .        
257     ///</par am>        
258     ///<para m name="ty pe" type=" String">        
259     /// The  Schema Nam e of the E ntity type  record to  retrieve.        
260     /// For  an Account  record, u se "Accoun t"        
261     ///</par am>        
262     ///<para m name="su ccessCallb ack" type= "Function" >        
263     /// The  function t hat will b e passed t hrough and  be called  by a succ essful res ponse.         
264     /// Noth ing will b e returned  to this f unction.        
265     /// </pa ram>        
266     ///<para m name="er rorCallbac k" type="F unction">        
267     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
268     /// This  function  must accep t an Error  object as  a paramet er.        
269     /// </pa ram>        
270     this._st ringParame terCheck(i d, "SDK.RE ST.updateR ecord requ ires the i d paramete r.");        
271     this._pa rameterChe ck(object,  "SDK.REST .updateRec ord requir es the obj ect parame ter.");        
272     this._st ringParame terCheck(t ype, "SDK. REST.updat eRecord re quires the  type para meter.");        
273     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.up dateRecord  requires  the succes sCallback  is a funct ion.");        
274     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.upda teRecord r equires th e errorCal lback is a  function. ");        
275     var req  = new XMLH ttpRequest ();        
276          
277     req.open ("POST", e ncodeURI(t his._OData Path() + t ype + "Set (guid'" +  id + "')") , true);        
278     req.setR equestHead er("Accept ", "applic ation/json ");        
279     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
280     req.setR equestHead er("X-HTTP -Method",  "MERGE");        
281     req.onre adystatech ange = fun ction () {        
282      if (thi s.readySta te == 4 /*  complete  */) {        
283       req.on readystate change = n ull;        
284       if (th is.status  == 204 ||  this.statu s == 1223)  {        
285        succe ssCallback ();        
286       }        
287       else {        
288        error Callback(S DK.REST._e rrorHandle r(this));        
289       }        
290      }        
291     };        
292     req.send (JSON.stri ngify(obje ct));        
293    },        
294    deleteRec ord: funct ion (id, t ype, succe ssCallback , errorCal lback) {        
295     ///<summ ary>        
296     /// Send s an async hronous re quest to d elete a re cord.        
297     ///</sum mary>        
298     ///<para m name="id " type="St ring">        
299     /// A St ring repre senting th e GUID val ue for the  record to  delete.        
300     ///</par am>        
301     ///<para m name="ty pe" type=" String">        
302     /// The  Schema Nam e of the E ntity type  record to  delete.        
303     /// For  an Account  record, u se "Accoun t"        
304     ///</par am>        
305     ///<para m name="su ccessCallb ack" type= "Function" >        
306     /// The  function t hat will b e passed t hrough and  be called  by a succ essful res ponse.         
307     /// Noth ing will b e returned  to this f unction.        
308     /// </pa ram>        
309     ///<para m name="er rorCallbac k" type="F unction">        
310     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
311     /// This  function  must accep t an Error  object as  a paramet er.        
312     /// </pa ram>        
313     this._st ringParame terCheck(i d, "SDK.RE ST.deleteR ecord requ ires the i d paramete r.");        
314     this._st ringParame terCheck(t ype, "SDK. REST.delet eRecord re quires the  type para meter.");        
315     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.de leteRecord  requires  the succes sCallback  is a funct ion.");        
316     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.dele teRecord r equires th e errorCal lback is a  function. ");        
317     var req  = new XMLH ttpRequest ();        
318     req.open ("POST", e ncodeURI(t his._OData Path() + t ype + "Set (guid'" +  id + "')") , true);        
319     req.setR equestHead er("Accept ", "applic ation/json ");        
320     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
321     req.setR equestHead er("X-HTTP -Method",  "DELETE");        
322     req.onre adystatech ange = fun ction () {        
323          
324      if (thi s.readySta te == 4 /*  complete  */) {        
325       req.on readystate change = n ull;        
326       if (th is.status  == 204 ||  this.statu s == 1223)  {        
327        succe ssCallback ();        
328       }        
329       else {        
330        error Callback(S DK.REST._e rrorHandle r(this));        
331       }        
332      }        
333     };        
334     req.send ();        
335          
336    },        
337    retrieveM ultipleRec ords: func tion (type , options,  successCa llback, er rorCallbac k, OnCompl ete) {        
338     ///<summ ary>        
339     /// Send s an async hronous re quest to r etrieve re cords.        
340     ///</sum mary>        
341     ///<para m name="ty pe" type=" String">        
342     /// The  Schema Nam e of the E ntity type  record to  retrieve.        
343     /// For  an Account  record, u se "Accoun t"        
344     ///</par am>        
345     ///<para m name="op tions" typ e="String" >        
346     /// A St ring repre senting th e OData Sy stem Query  Options t o control  the data r eturned        
347     ///</par am>        
348     ///<para m name="su ccessCallb ack" type= "Function" >        
349     /// The  function t hat will b e passed t hrough and  be called  for each  page of re cords retu rned.        
350     /// Each  page is 5 0 records.  If you ex pect that  more than  one page o f records  will be re turned,        
351     /// this  function  should loo p through  the result s and push  the recor ds into an  array out side of th e function .        
352     /// Use  the OnComp lete event  handler t o know whe n all the  records ha ve been pr ocessed.        
353     /// </pa ram>        
354     ///<para m name="er rorCallbac k" type="F unction">        
355     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
356     /// This  function  must accep t an Error  object as  a paramet er.        
357     /// </pa ram>        
358     ///<para m name="On Complete"  type="Func tion">        
359     /// The  function t hat will b e called w hen all th e requeste d records  have been  returned.        
360     /// No p arameters  are passed  to this f unction.        
361     /// </pa ram>        
362     this._st ringParame terCheck(t ype, "SDK. REST.retri eveMultipl eRecords r equires th e type par ameter is  a string." );        
363     if (opti ons != nul l)        
364      this._s tringParam eterCheck( options, " SDK.REST.r etrieveMul tipleRecor ds require s the opti ons parame ter is a s tring.");        
365     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.re trieveMult ipleRecord s requires  the succe ssCallback  parameter  is a func tion.");        
366     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.retr ieveMultip leRecords  requires t he errorCa llback par ameter is  a function .");        
367     this._ca llbackPara meterCheck (OnComplet e, "SDK.RE ST.retriev eMultipleR ecords req uires the  OnComplete  parameter  is a func tion.");        
368          
369     var opti onsString;        
370     if (opti ons != nul l) {        
371      if (opt ions.charA t(0) != "? ") {        
372       option sString =  "?" + opti ons;        
373      }        
374      else        
375      { optio nsString =  options;  }        
376     }        
377     var req  = new XMLH ttpRequest ();        
378     req.open ("GET", th is._ODataP ath() + ty pe + "Set"  + options String, tr ue);        
379     req.setR equestHead er("Accept ", "applic ation/json ");        
380     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
381     req.onre adystatech ange = fun ction () {        
382      if (thi s.readySta te == 4 /*  complete  */) {        
383       req.on readystate change = n ull;        
384       if (th is.status  == 200) {        
385        var r eturned =  JSON.parse (this.resp onseText,  SDK.REST._ dateRevive r).d;        
386        succe ssCallback (returned. results);        
387        if (r eturned.__ next != nu ll) {        
388         var  queryOptio ns = retur ned.__next .substring ((SDK.REST ._ODataPat h() + type  + "Set"). length);        
389         SDK. REST.retri eveMultipl eRecords(t ype, query Options, s uccessCall back, erro rCallback,  OnComplet e);        
390        }        
391        else        
392        { OnC omplete();  }        
393       }        
394       else {        
395        error Callback(S DK.REST._e rrorHandle r(this));        
396       }        
397      }        
398     };        
399     req.send ();        
400    },        
401    associate Records: f unction (p arentId, p arentType,  relations hipName, c hildId, ch ildType, s uccessCall back, erro rCallback)  {        
402     this._st ringParame terCheck(p arentId, " SDK.REST.a ssociateRe cords requ ires the p arentId pa rameter is  a string. ");        
403     ///<para m name="pa rentId" ty pe="String ">        
404     /// The  Id of the  record to  be the par ent record  in the re lationship        
405     /// </pa ram>        
406     ///<para m name="pa rentType"  type="Stri ng">        
407     /// The  Schema Nam e of the E ntity type  for the p arent reco rd.        
408     /// For  an Account  record, u se "Accoun t"        
409     /// </pa ram>        
410     ///<para m name="re lationship Name" type ="String">        
411     /// The  Schema Nam e of the E ntity Rela tionship t o use to a ssociate t he records .        
412     /// To a ssociate a ccount rec ords as a  Parent acc ount, use  "Reference daccount_p arent_acco unt"        
413     /// </pa ram>        
414     ///<para m name="ch ildId" typ e="String" >        
415     /// The  Id of the  record to  be the chi ld record  in the rel ationship        
416     /// </pa ram>        
417     ///<para m name="ch ildType" t ype="Strin g">        
418     /// The  Schema Nam e of the E ntity type  for the c hild recor d.        
419     /// For  an Account  record, u se "Accoun t"        
420     /// </pa ram>        
421     ///<para m name="su ccessCallb ack" type= "Function" >        
422     /// The  function t hat will b e passed t hrough and  be called  by a succ essful res ponse.         
423     /// Noth ing will b e returned  to this f unction.        
424     /// </pa ram>        
425     ///<para m name="er rorCallbac k" type="F unction">        
426     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
427     /// This  function  must accep t an Error  object as  a paramet er.        
428     /// </pa ram>        
429     this._st ringParame terCheck(p arentType,  "SDK.REST .associate Records re quires the  parentTyp e paramete r is a str ing.");        
430     this._st ringParame terCheck(r elationshi pName, "SD K.REST.ass ociateReco rds requir es the rel ationshipN ame parame ter is a s tring.");        
431     this._st ringParame terCheck(c hildId, "S DK.REST.as sociateRec ords requi res the ch ildId para meter is a  string.") ;        
432     this._st ringParame terCheck(c hildType,  "SDK.REST. associateR ecords req uires the  childType  parameter  is a strin g.");        
433     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.as sociateRec ords requi res the su ccessCallb ack parame ter is a f unction.") ;        
434     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.asso ciateRecor ds require s the erro rCallback  parameter  is a funct ion.");        
435          
436     var req  = new XMLH ttpRequest ();        
437     req.open ("POST", e ncodeURI(t his._OData Path() + p arentType  + "Set(gui d'" + pare ntId + "') /$links/"  + relation shipName),  true);        
438     req.setR equestHead er("Accept ", "applic ation/json ");        
439     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
440     req.onre adystatech ange = fun ction () {        
441      if (thi s.readySta te == 4 /*  complete  */) {        
442       req.on readystate change = n ull;        
443       if (th is.status  == 204 ||  this.statu s == 1223)  {        
444        succe ssCallback ();        
445       }        
446       else {        
447        error Callback(S DK.REST._e rrorHandle r(this));        
448       }        
449      }        
450     };        
451     var chil dEntityRef erence = { }        
452     childEnt ityReferen ce.uri = t his._OData Path() + " /" + child Type + "Se t(guid'" +  childId +  "')";        
453     req.send (JSON.stri ngify(chil dEntityRef erence));        
454    },        
455    disassoci ateRecords : function  (parentId , parentTy pe, relati onshipName , childId,  successCa llback, er rorCallbac k) {        
456     this._st ringParame terCheck(p arentId, " SDK.REST.d isassociat eRecords r equires th e parentId  parameter  is a stri ng.");        
457     ///<para m name="pa rentId" ty pe="String ">        
458     /// The  Id of the  record to  be the par ent record  in the re lationship        
459     /// </pa ram>        
460     ///<para m name="pa rentType"  type="Stri ng">        
461     /// The  Schema Nam e of the E ntity type  for the p arent reco rd.        
462     /// For  an Account  record, u se "Accoun t"        
463     /// </pa ram>        
464     ///<para m name="re lationship Name" type ="String">        
465     /// The  Schema Nam e of the E ntity Rela tionship t o use to d isassociat e the reco rds.        
466     /// To d isassociat e account  records as  a Parent  account, u se "Refere ncedaccoun t_parent_a ccount"        
467     /// </pa ram>        
468     ///<para m name="ch ildId" typ e="String" >        
469     /// The  Id of the  record to  be disasso ciated as  the child  record in  the relati onship        
470     /// </pa ram>        
471     ///<para m name="su ccessCallb ack" type= "Function" >        
472     /// The  function t hat will b e passed t hrough and  be called  by a succ essful res ponse.         
473     /// Noth ing will b e returned  to this f unction.        
474     /// </pa ram>        
475     ///<para m name="er rorCallbac k" type="F unction">        
476     /// The  function t hat will b e passed t hrough and  be called  by a fail ed respons e.         
477     /// This  function  must accep t an Error  object as  a paramet er.        
478     /// </pa ram>        
479     this._st ringParame terCheck(p arentType,  "SDK.REST .disassoci ateRecords  requires  the parent Type param eter is a  string.");        
480     this._st ringParame terCheck(r elationshi pName, "SD K.REST.dis associateR ecords req uires the  relationsh ipName par ameter is  a string." );        
481     this._st ringParame terCheck(c hildId, "S DK.REST.di sassociate Records re quires the  childId p arameter i s a string .");        
482     this._ca llbackPara meterCheck (successCa llback, "S DK.REST.di sassociate Records re quires the  successCa llback par ameter is  a function .");        
483     this._ca llbackPara meterCheck (errorCall back, "SDK .REST.disa ssociateRe cords requ ires the e rrorCallba ck paramet er is a fu nction.");        
484          
485     var req  = new XMLH ttpRequest ();        
486     req.open ("POST", e ncodeURI(t his._OData Path() + p arentType  + "Set(gui d'" + pare ntId + "') /$links/"  + relation shipName +  "(guid'"  + childId  + "')"), t rue);        
487     req.setR equestHead er("Accept ", "applic ation/json ");        
488     req.setR equestHead er("Conten t-Type", " applicatio n/json; ch arset=utf- 8");        
489     req.setR equestHead er("X-HTTP -Method",  "DELETE");        
490     req.onre adystatech ange = fun ction () {        
491      if (thi s.readySta te == 4 /*  complete  */) {        
492       req.on readystate change = n ull;        
493       if (th is.status  == 204 ||  this.statu s == 1223)  {        
494        succe ssCallback ();        
495       }        
496       else {        
497        error Callback(S DK.REST._e rrorHandle r(this));        
498       }        
499      }        
500     };        
501     req.send ();        
502    },        
503    __namespa ce: true        
504   };        
505   // </snipp etSDKRESTJ S>