717. 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.

717.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\JavaScriptRESTAssociateDisassociate\JavaScriptRESTAssociateDisassociate\Scripts JavaScriptRESTAssociateDisassociate.js Tue Dec 20 19:51:48 2016 UTC
2 Wed Feb 1 19:56:58 2017 UTC

717.2 Comparison summary

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

717.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

717.4 Active regular expressions

No regular expressions were active.

717.5 Comparison detail

1   // ======= ========== ========== ========== ========== ========== ========== ==        
2   //        
3   //  This f ile is par t of the M icrosoft D ynamics CR M SDK code  samples.        
4   //        
5   //  Copyri ght (C) Mi crosoft Co rporation.   All righ ts reserve d.        
6   //        
7   //  This s ource code  is intend ed only as  a supplem ent to Mic rosoft        
8   //  Develo pment Tool s and/or o n-line doc umentation .  See the se other        
9   //  materi als for de tailed inf ormation r egarding M icrosoft c ode sample s.        
10   //        
11   //  THIS C ODE AND IN FORMATION  ARE PROVID ED "AS IS"  WITHOUT W ARRANTY OF  ANY        
12   //  KIND,  EITHER EXP RESSED OR  IMPLIED, I NCLUDING B UT NOT LIM ITED TO TH E        
13   //  IMPLIE D WARRANTI ES OF MERC HANTABILIT Y AND/OR F ITNESS FOR  A        
14   //  PARTIC ULAR PURPO SE.        
15   //        
16   // ======= ========== ========== ========== ========== ========== ========== ==        
17   //<snippet JavaScript RESTAssoci ateDisasso ciateJS>        
18   /// <refer ence path= "SDK.REST. js" />        
19   var btnSta rtAssociat eAccounts,        
20   btnStartAs sociateAcc ountToEmai l,        
21   btnDisasso ciateAccou nts,        
22   btnResetSa mple,        
23   parentAcco unt,        
24   childAccou nt,        
25   accountRel atedToEmai l,        
26   emailRecor d,        
27   output, al ertFlag;        
28          
29   document.o nreadystat echange =  function ( ) {        
30    ///<summa ry>        
31    /// Initi alizes the  sample wh en the doc ument is r eady        
32    ///</summ ary>        
33    if (docum ent.readyS tate == "c omplete")  {        
34          
35     btnStart AssociateA ccounts =  document.g etElementB yId("btnSt artAssocia teAccounts ");        
36     btnStart AssociateA ccountToEm ail = docu ment.getEl ementById( "btnStartA ssociateAc countToEma il");        
37     btnReset Sample = d ocument.ge tElementBy Id("btnRes etSample") ;        
38     alertFla g = docume nt.getElem entById("d ispalert") ;        
39     output =  document. getElement ById("outp ut");        
40          
41     btnStart AssociateA ccounts.on click = st artAssocia teAccounts ;        
42     btnStart AssociateA ccountToEm ail.onclic k = startA ssociateAc countToEma il;        
43     btnReset Sample.onc lick = res etSample;        
44    }        
45   }        
46          
47   function s tartAssoci ateAccount s() {        
48    ///<summa ry>        
49    /// Creat es two acc ount recor ds asynchr onously an d displays  a message  showing t he Id valu es of the  created re cords        
50    /// Then  calls the  associateA ccounts fu nction to  associate  them.        
51    ///</summ ary>        
52    disableEl ement(btnS tartAssoci ateAccount s);        
53    disableEl ement(btnS tartAssoci ateAccount ToEmail);        
54    //Create  the first  account re cord        
55    SDK.REST. createReco rd({ Name:  "Parent A ccount", D escription : "This Ac count will  be the pa rent accou nt" },        
56           "A ccount",        
57           fu nction (ac count) {        
58            p arentAccou nt = accou nt;        
59            w riteMessag e("Account  Id: {" +  account.Ac countId +  "} Name: \ "" + accou nt.Name +  "\" create d as the p arent acco unt.");        
60            / / Create t he second  account re cord        
61            S DK.REST.cr eateRecord ({ Name: " Child Acco unt", Desc ription: " This Accou nt will be  the child  account"  },        
62                    "Acc ount",        
63                    func tion (acco unt) {        
64                     chi ldAccount  = account;        
65                     wri teMessage( "Account I d: {" + ac count.Acco untId + "}  Name: \""  + account .Name + "\ " created  as the chi ld account .");        
66                     //  Associate  the accoun ts that we re created .        
67                     ass ociateAcco unts(paren tAccount,  childAccou nt);        
68                    },        
69            e rrorHandle r);        
70           },        
71            e rrorHandle r);        
72          
73    scrollToR esults();        
74   }        
75          
76   function a ssociateAc counts(par entAccount , childAcc ount) {        
77    ///<summa ry>        
78    /// Assoc iates two  account re cords asyn chronously  and displ ays messag es so you  can verify  the assoc iation        
79    /// Displ ays  butto ns to disa ssociate o r delete t he account s.        
80    /// Enabl es the res et button        
81    ///</summ ary>        
82    SDK.REST. associateR ecords(par entAccount .AccountId ,        
83           "A ccount",        
84           "R eferenceda ccount_par ent_accoun t",        
85           ch ildAccount .AccountId ,        
86           "A ccount",        
87           fu nction ()  {        
88            w riteMessag e("Associa tion succe ssful.");        
89            s howLinksTo VerifyAcco untAssocia tion();        
90            s howButtonT oDisassoci ateAccount s();        
91            s howButtonT oDeleteAcc ounts();        
92            e nableEleme nt(btnRese tSample);        
93            i f (alertFl ag.checked  == true)        
94              alert("Ass ociation s uccessful. ");        
95           },        
96           er rorHandler );        
97   }        
98          
99   function g etUrl()        
100   {        
101           va r context;        
102           va r url;        
103           if  (typeof G etGlobalCo ntext != " undefined" )        
104           {  context =  GetGlobalC ontext();  }        
105           el se        
106           {        
107                    if ( (typeof Xr m != "unde fined") &&  (typeof X rm.Page !=  "undefine d") && (ty peof Xrm.P age.contex t != "unde fined"))        
108                    {        
109                             contex t = Xrm.Pa ge.context ;        
110                    }        
111                    else        
112                    { th row new Er ror("Conte xt is not  available. "); }        
113           }        
114          
115          
116                    url  = context. getClientU rl();        
117          
118          
119           re turn url;        
120   }        
121          
122   function s howLinksTo VerifyAcco untAssocia tion() {        
123    ///<summa ry>        
124    /// Displ ays links  to verify  the associ ated accou nts.        
125    ///</summ ary>        
126    var messa ge = docum ent.create Element("d iv");        
127    var messa ge1 = docu ment.creat eElement(" span");        
128    setText(m essage, "O pen the ") ;        
129    var child Recordlink  = documen t.createEl ement("a") ;        
130    childReco rdlink.hre f = getUrl () + "/mai n.aspx?etn =account&p agetype=en tityrecord &id=%7B" +  childAcco unt.Accoun tId + "%7D ";        
131    childReco rdlink.tar get = "_bl ank";        
132    setText(c hildRecord link, chil dAccount.N ame + " re cord");        
133    var messa ge2 = docu ment.creat eElement(" span");        
134    setText(m essage2, "  to verify  that the  Parent Acc ount field  is set to  the ");        
135    var paren tRecordlin k = docume nt.createE lement("a" );        
136    parentRec ordlink.hr ef = getUr l() + "/ma in.aspx?et n=account& pagetype=e ntityrecor d&id=%7B"  + parentAc count.Acco untId + "% 7D";        
137    parentRec ordlink.ta rget = "_b lank";        
138    setText(p arentRecor dlink, par entAccount .Name + "  record");        
139    period =  document.c reateEleme nt("span") ;        
140    setText(p eriod, "." );        
141    message.a ppendChild (message1) ;        
142    message.a ppendChild (childReco rdlink);        
143    message.a ppendChild (message2) ;        
144    message.a ppendChild (parentRec ordlink);        
145    message.a ppendChild (period);        
146    writeMess age(messag e);        
147   }        
148          
149   function s howLinksTo VerifyDisA ssociation () {        
150    ///<summa ry>        
151    /// Displ ays links  to verify  accounts w ere disass ociated        
152    ///</summ ary>        
153    var messa ge = docum ent.create Element("d iv");        
154    var messa ge1 = docu ment.creat eElement(" span");        
155    setText(m essage, "O pen the ") ;        
156    var child Recordlink  = documen t.createEl ement("a") ;        
157    childReco rdlink.hre f = getUrl () + "/mai n.aspx?etn =account&p agetype=en tityrecord &id=%7B" +  childAcco unt.Accoun tId + "%7D ";        
158    childReco rdlink.tar get = "_bl ank";        
159    setText(c hildRecord link, chil dAccount.N ame + " re cord");        
160    var messa ge2 = docu ment.creat eElement(" span");        
161    setText(m essage2, "  to verify  that the  Parent Acc ount field  not set t o the ");        
162    var paren tRecordlin k = docume nt.createE lement("a" );        
163    parentRec ordlink.hr ef = getUr l() + "/ma in.aspx?et n=account& pagetype=e ntityrecor d&id=%7B"  + parentAc count.Acco untId + "% 7D";        
164    parentRec ordlink.ta rget = "_b lank";        
165    setText(p arentRecor dlink, par entAccount .Name + "  record");        
166    period =  document.c reateEleme nt("span") ;        
167    setText(p eriod, "." );        
168    message.a ppendChild (message1) ;        
169    message.a ppendChild (childReco rdlink);        
170    message.a ppendChild (message2) ;        
171    message.a ppendChild (parentRec ordlink);        
172    message.a ppendChild (period);        
173    writeMess age(messag e);        
174   }        
175          
176   function s howButtonT oDeleteAcc ounts() {        
177    ///<summa ry>        
178    /// Dipla ys a butto n to allow  for delet ion of acc ounts crea ted for th is sample.        
179    ///</summ ary>        
180    var btnDe leteRecord s = docume nt.createE lement("bu tton");        
181    setText(b tnDeleteRe cords, "De lete both  records");        
182    btnDelete Records.ti tle = "Del ete both r ecords";        
183    btnDelete Records.on click = fu nction ()  {        
184     disableE lement(btn Disassocia teAccounts );        
185     disableE lement(thi s);        
186     SDK.REST .deleteRec ord(childA ccount.Acc ountId,        
187                             "Accou nt",        
188                             functi on () { wr iteMessage (childAcco unt.Name +  " record  deleted.") ; },        
189                             errorH andler);        
190     SDK.REST .deleteRec ord(parent Account.Ac countId,        
191                             "Accou nt",        
192                             functi on () {        
193                              write Message(pa rentAccoun t.Name + "  record de leted.");        
194                              if (a lertFlag.c hecked ==  true)        
195                               aler t("Records  deleted." );        
196                             },        
197                             errorH andler);        
198    }        
199    writeMess age(btnDel eteRecords );        
200   }        
201          
202   function s howButtonT oDisassoci ateAccount s() {        
203    ///<summa ry>        
204    /// Displ ays a butt on to allo w for disa ssociation  of accoun ts associa ted by thi s sample.        
205    /// Then  shows link s to verif y disassoc iation        
206    ///</summ ary>        
207    btnDisass ociateAcco unts = doc ument.crea teElement( "button");        
208    setText(b tnDisassoc iateAccoun ts, "Disas sociate th e records" );        
209    btnDisass ociateAcco unts.title  = "Disass ociate the  records";        
210    btnDisass ociateAcco unts.oncli ck = funct ion () {        
211     SDK.REST .disassoci ateRecords (parentAcc ount.Accou ntId,        
212           "A ccount",        
213           "R eferenceda ccount_par ent_accoun t",        
214           ch ildAccount .AccountId ,        
215           fu nction ()  {        
216            s howLinksTo VerifyDisA ssociation ();        
217            i f (alertFl ag.checked  == true)        
218              alert("Dis associatio n successf ul.");        
219           },        
220           er rorHandler );        
221    }        
222    writeMess age(btnDis associateA ccounts);        
223   }        
224          
225   function s tartAssoci ateAccount ToEmail()  {        
226    ///<summa ry>        
227    /// Creat es an acco unt and em ail record  and displ ays messag e to verif y that the y were cre ated        
228    /// Then  calls asso ciateAccou ntAsActivi tyPartyToE mail to as sociate th em        
229    ///</summ ary>        
230    disableEl ement(btnS tartAssoci ateAccount s);        
231    disableEl ement(btnS tartAssoci ateAccount ToEmail);        
232          
233    //Create  one accoun t and one  email reco rd.        
234    SDK.REST. createReco rd({ Name:  "Email Se nder Accou nt", Descr iption: "T his Accoun t will be  the accoun t shown as  the sende r of an em ail." },        
235           "A ccount",        
236           fu nction (ac count) {        
237            a ccountRela tedToEmail  = account ;        
238            w riteMessag e("Account  Id: {" +  accountRel atedToEmai l.AccountI d + "} Nam e: \"" + a ccountRela tedToEmail .Name + "\ " created  as an acco unt to be  the sender  of an ema il.");        
239            S DK.REST.cr eateRecord ({ Subject : "Email A ctivity",  Descriptio n: "This e mail will  be shown a s sent by  the " + ac countRelat edToEmail. Name + " r ecord." },        
240                    "Ema il",        
241                    func tion (emai l) {        
242                     ema ilRecord =  email;        
243                     wri teMessage( "Email Act ivityId: { " + emailR ecord.Acti vityId + " } Subject:  \"" + ema ilRecord.S ubject + " \" created  to be sho wn as sent  from the  " + accoun tRelatedTo Email.Name  + " recor d.");        
244                     ass ociateAcco untAsActiv ityPartyTo Email();        
245                    },        
246            e rrorHandle r);        
247           },        
248            e rrorHandle r);        
249    scrollToR esults();        
250          
251   }        
252          
253   function a ssociateAc countAsAct ivityParty ToEmail()  {        
254    ///<summa ry>        
255    /// Creat es a new A ctivityPar ty record  to associa te an acco unt record  to an ema il record,  making th e account  the sender  of the em ail.        
256    /// Shows  links to  verify the  associati on        
257    /// Shows  buttons t o delete t he records . It is no t possible  to disass ociate the  records b y deleting  the Activ ityParty r ecord usin g the REST  endpoint.        
258    ///</summ ary>        
259    var activ ityParty =  {        
260     PartyId:        
261    {        
262     Id: acco untRelated ToEmail.Ac countId,        
263     LogicalN ame: "acco unt"        
264    },        
265     Activity Id: {        
266      Id: ema ilRecord.A ctivityId,        
267      Logical Name: "ema il"        
268     },        
269     // Set t he partici pation typ e (what ro le the par ty has on  the activi ty). For t his        
270     // examp le, we'll  put the ac count in t he From fi eld (which  has a val ue of 1).        
271     // See h ttp://msdn .microsoft .com/en-us /library/g g328549.as px for oth er options .        
272     Particip ationTypeM ask: { Val ue: 1 }        
273    };        
274          
275    SDK.REST. createReco rd(activit yParty,        
276    "Activity Party",        
277    function  (ap) {        
278     test_act ivityParty Id = ap.Ac tivityPart yId;        
279     writeMes sage("Crea ted new Ac tivityPart y Activity PartyId: { " + ap.Act ivityParty Id + "}. T he account  is now re lated to t he email." );        
280     showLink sToVerifyA ctivityPar tyAssociat ion();        
281     showButt onToDelete AccountAnd EmailRecor ds();        
282     enableEl ement(btnR esetSample );        
283     if (aler tFlag.chec ked == tru e)        
284      alert(" The accoun t is now r elated to  the email. ");        
285    },        
286    errorHand ler);        
287   }        
288          
289   // Note: A ttempting  to disasso ciate an a ctivitypar ty relatio nship by d eleting th e Activity Party reco rd is not  allowed.        
290          
291   function s howLinksTo VerifyActi vityPartyA ssociation () {        
292    ///<summa ry>        
293    /// Shows  links to  verify tha t an accou nt and ema il are lin ked        
294    ///</summ ary>        
295    var messa ge = docum ent.create Element("d iv");        
296    var messa ge1 = docu ment.creat eElement(" span");        
297    setText(m essage1, " Open the " );        
298    var child Recordlink  = documen t.createEl ement("a") ;        
299    childReco rdlink.hre f = getUrl () + "/mai n.aspx?etn =email&pag etype=enti tyrecord&i d=%7B" + e mailRecord .ActivityI d + "%7D";        
300    childReco rdlink.tar get = "_bl ank";        
301    setText(c hildRecord link, emai lRecord.Su bject + "  record");        
302    var messa ge2 = docu ment.creat eElement(" span");        
303    setText(m essage2, "  to verify  that the  ");        
304    var paren tRecordlin k = docume nt.createE lement("a" );        
305    parentRec ordlink.hr ef = getUr l() + "/ma in.aspx?et n=account& pagetype=e ntityrecor d&id=%7B"  + accountR elatedToEm ail.Accoun tId + "%7D ";        
306    parentRec ordlink.ta rget = "_b lank";        
307    setText(p arentRecor dlink, acc ountRelate dToEmail.N ame + " re cord");        
308    message3  = document .createEle ment("span ");        
309    setText(m essage3, "  is set as  the sende r.");        
310    message.a ppendChild (message1) ;        
311    message.a ppendChild (childReco rdlink);        
312    message.a ppendChild (message2) ;        
313    message.a ppendChild (parentRec ordlink);        
314    message.a ppendChild (message3) ;        
315    writeMess age(messag e);        
316   }        
317          
318   function s howButtonT oDeleteAcc ountAndEma ilRecords( ) {        
319    ///<summa ry>        
320    /// Shows  button to  delete th e account  and email  records cr eated for  this sampl e        
321    ///</summ ary>        
322    var btnDe leteRecord s = docume nt.createE lement("bu tton");        
323    setText(b tnDeleteRe cords, "De lete both  records");        
324    btnDelete Records.ti tle = "Del ete both r ecords";        
325    btnDelete Records.on click = fu nction ()  {        
326     disableE lement(thi s);        
327     SDK.REST .deleteRec ord(accoun tRelatedTo Email.Acco untId,        
328                             "Accou nt",        
329                             functi on () { wr iteMessage (accountRe latedToEma il.Name +  " record d eleted.");  },        
330                             errorH andler);        
331     SDK.REST .deleteRec ord(emailR ecord.Acti vityId,        
332                             "Email ",        
333                             functi on () {        
334                              write Message(em ailRecord. Subject +  " record d eleted.");        
335                              if (a lertFlag.c hecked ==  true)        
336                               aler t("Records  deleted." );        
337                             },        
338                             errorH andler);        
339    }        
340    writeMess age(btnDel eteRecords );        
341   }        
342          
343   function e rrorHandle r(error) {        
344    ///<summa ry>        
345    /// Displ ays the me ssage prop erty of er rors        
346    ///</summ ary>        
347    writeMess age(error. message);        
348    if (alert Flag.check ed == true )        
349     alert(er ror.messag e);        
350   }        
351          
352   function e nableEleme nt(element ) {        
353    ///<summa ry>        
354    /// Enabl es an elem ent that i s disabled .        
355    ///</summ ary>        
356    element.r emoveAttri bute("disa bled");        
357   }        
358          
359   function d isableElem ent(elemen t) {        
360    ///<summa ry>        
361    /// Disab les an ele ment that  is enabled .        
362    ///</summ ary>        
363    element.s etAttribut e("disable d", "disab led");        
364   }        
365          
366   function r esetSample () {        
367    ///<summa ry>        
368    /// Clear s out the  results ar ea and ena ble button s to start  one of th e samples  again.        
369    ///</summ ary>        
370    output.in nerHTML =  "";        
371    enableEle ment(btnSt artAssocia teAccounts );        
372    enableEle ment(btnSt artAssocia teAccountT oEmail)        
373    disableEl ement(btnR esetSample );        
374    if (alert Flag.check ed == true )        
375     alert("R eset compl ete.");        
376   }        
377          
378   //Helper f unction to  write dat a to this  page:        
379   function w riteMessag e(message)  {        
380    ///<summa ry>        
381    /// Displ ays a mess age or app ends an el ement to t he results  area.        
382    ///</summ ary>        
383    var li =  document.c reateEleme nt("li");        
384    if (typeo f (message ) == "stri ng") {        
385          
386     setText( li, messag e);        
387          
388    }        
389    else {        
390     li.appen dChild(mes sage);        
391    }        
392          
393    output.ap pendChild( li);        
394   }        
395          
396   function s crollToRes ults() {        
397    ///<summa ry>        
398    /// Scrol ls to the  bottom of  the page s o the resu lts area c an be seen .        
399    ///</summ ary>        
400    window.sc rollTo(0,  document.b ody.scroll Height);        
401   }        
402          
403   function s etText(nod e, text) {        
404    ///<summa ry>        
405    /// Used  to set the  text cont ent of ele ments to m anage diff erences be tween brow sers.        
406    ///</summ ary>        
407    if (typeo f (node.in nerText) ! = "undefin ed") {        
408     node.inn erText = t ext;        
409    }        
410    else {        
411     node.tex tContent =  text;        
412    }        
413   }        
414   //</snippe tJavaScrip tRESTAssoc iateDisass ociateJS>