Produced by Araxis Merge on 2/1/2017 2:57:02 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.
| # | 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\SOAPForJScript\SOAPForJScript | AssignAccounts.htm | Tue Dec 20 19:51:48 2016 UTC |
| 2 | Wed Feb 1 19:57:02 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 409 |
| 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 |
No regular expressions were active.
| 1 | <!DOCTYPE HTML> | |||||
| 2 | <!-- | |||||
| 3 | This file is part of the Micro soft Dynam ics CRM SD K code sam ples. | |||||
| 4 | ||||||
| 5 | Copyright (C) Micros oft Corpor ation. Al l rights r eserved. | |||||
| 6 | ||||||
| 7 | This sourc e code is intended o nly as a s upplement to Microso ft | |||||
| 8 | Developmen t Tools an d/or on-li ne documen tation. S ee these o ther | |||||
| 9 | materials for detail ed informa tion regar ding Micro soft code samples. | |||||
| 10 | ||||||
| 11 | THIS CODE AND INFORM ATION ARE PROVIDED " AS IS" WIT HOUT WARRA NTY OF ANY | |||||
| 12 | KIND, EITH ER EXPRESS ED OR IMPL IED, INCLU DING BUT N OT LIMITED TO THE | |||||
| 13 | IMPLIED WA RRANTIES O F MERCHANT ABILITY AN D/OR FITNE SS FOR A | |||||
| 14 | PARTICULAR PURPOSE. | |||||
| 15 | --> | |||||
| 16 | <!--<snipp etAssignAc counts>--> | |||||
| 17 | <html lang ="en-us"> | |||||
| 18 | <head> | |||||
| 19 | <title>As sign Accou nts Page</ title> | |||||
| 20 | <meta htt p-equiv="X -UA-Compat ible" cont ent="IE=ed ge" /> | |||||
| 21 | <style ty pe="text/c ss"> | |||||
| 22 | body | |||||
| 23 | { | |||||
| 24 | font-fa mily: Sego e UI; | |||||
| 25 | backgro und-color: #EFF2F6; | |||||
| 26 | } | |||||
| 27 | .dataTab le | |||||
| 28 | { | |||||
| 29 | border- collapse: collapse; | |||||
| 30 | border: 1px solid black; | |||||
| 31 | } | |||||
| 32 | .tableHe ad | |||||
| 33 | { | |||||
| 34 | backgro und-color: #C0C0C0; | |||||
| 35 | width: 100%; | |||||
| 36 | } | |||||
| 37 | .grid | |||||
| 38 | { | |||||
| 39 | border- bottom: 1p x solid bl ack; | |||||
| 40 | } | |||||
| 41 | td | |||||
| 42 | { | |||||
| 43 | padding -left: 5px ; | |||||
| 44 | padding -right: 5p x; | |||||
| 45 | } | |||||
| 46 | #account List | |||||
| 47 | { | |||||
| 48 | backgro und-color: White; | |||||
| 49 | } | |||||
| 50 | #checkbo xCol | |||||
| 51 | { | |||||
| 52 | border- right: 1px solid bla ck; | |||||
| 53 | width: 20px; | |||||
| 54 | } | |||||
| 55 | #nameCol | |||||
| 56 | { | |||||
| 57 | border- right: 1px solid bla ck; | |||||
| 58 | width: 300px; | |||||
| 59 | } | |||||
| 60 | #ownerCo l | |||||
| 61 | { | |||||
| 62 | width: 300px; | |||||
| 63 | } | |||||
| 64 | </style> | |||||
| 65 | <script s rc="../Cli entGlobalC ontext.js. aspx" type ="text/jav ascript">< /script> | |||||
| 66 | <script s rc="Script s/SDK.REST .js" type= "text/java script"></ script> | |||||
| 67 | <script s rc="Script s/SDK.SOAP Sample.Ass ign.js" ty pe="text/j avascript" ></script> | |||||
| 68 | <script t ype="text/ javascript "> | |||||
| 69 | //Set va riables fo r page ele ments | |||||
| 70 | var user Select; // The select control u sed to sel ect the us er to assi gn records to. | |||||
| 71 | var acco untList; / /The tbody element t hat rows w ill be add ed to for each retri eved accou nt | |||||
| 72 | var sele ctAll; //T he checkbo x to selec t all the retrieved accounts | |||||
| 73 | var btnA ssign; //T he button to assign assign the accounts | |||||
| 74 | var tabl eCaption; //A label hidden on load | |||||
| 75 | var data Table; //t he table e lement hid den on loa d | |||||
| 76 | var aler tFlag; // Alert flag to indica te the cha nges | |||||
| 77 | var user s = []; // SystemUser records r etrieved | |||||
| 78 | var acco unts = []; //Account s not assi gned to th e currentl y selected user. | |||||
| 79 | var acco untsToShow = 5; | |||||
| 80 | var supp ressRetrie vedAccount sAlert = f alse; | |||||
| 81 | var acco untsToAssi gn = []; | |||||
| 82 | var user Id = null; | |||||
| 83 | ||||||
| 84 | function startSamp le() { | |||||
| 85 | ///<sum mary> | |||||
| 86 | /// Sta rts the sa mple | |||||
| 87 | ///</su mmary> | |||||
| 88 | alertFl ag = docum ent.getEle mentById(" dispalert" ); | |||||
| 89 | userSel ect = docu ment.getEl ementById( "userList" ); | |||||
| 90 | //A new set of a 5 accounts will be r etrieved w hen the us er changes | |||||
| 91 | userSel ect.onchan ge = getAc counts; | |||||
| 92 | ||||||
| 93 | account List = doc ument.getE lementById ("accountL ist"); | |||||
| 94 | selectA ll = docum ent.getEle mentById(" selectAll" ); | |||||
| 95 | //When the select all check box is cli cked, togg le the sel ection for each row of the tab le. | |||||
| 96 | selectA ll.onclick = toggleS electAllRe cords; | |||||
| 97 | btnAssi gn = docum ent.getEle mentById(" btnAssign" ); | |||||
| 98 | //Add a helper fu nction to enable or disable th e assign b utton. | |||||
| 99 | btnAssi gn.setEnab led = setE nabled; | |||||
| 100 | //Set t he event h andler to the Assign button | |||||
| 101 | btnAssi gn.onclick = assignA ccounts; | |||||
| 102 | tableCa ption = do cument.get ElementByI d("tableCa ption"); | |||||
| 103 | dataTab le = docum ent.getEle mentById(" dataTable" ); | |||||
| 104 | var div Sample = d ocument.ge tElementBy Id("divSam ple"); | |||||
| 105 | //Load the list o f users | |||||
| 106 | getUser s(); | |||||
| 107 | divSamp le.style.d isplay = " block"; | |||||
| 108 | ||||||
| 109 | documen t.getEleme ntById("bt nStart").s etAttribut e("disable d", "disab led"); | |||||
| 110 | ||||||
| 111 | } | |||||
| 112 | function getUsers( ) { | |||||
| 113 | SDK.RES T.retrieve MultipleRe cords("Sys temUser", | |||||
| 114 | "$selec t=FullName ,SystemUse rId&$filte r=FullName ne 'INTEG RATION' an d FullName ne 'SYSTE M'", | |||||
| 115 | functio n (results ) { | |||||
| 116 | for (v ar i = 0; i < result s.length; i++) { | |||||
| 117 | users .push(resu lts[i]); | |||||
| 118 | } | |||||
| 119 | }, | |||||
| 120 | functio n (error) { | |||||
| 121 | showMe ssage(erro r.message) ; | |||||
| 122 | }, | |||||
| 123 | functio n () { | |||||
| 124 | if (us ers.length > 1) { | |||||
| 125 | for ( var i = 0; i < users .length; i ++) { | |||||
| 126 | var user = use rs[i]; | |||||
| 127 | user Select.opt ions[i + 1 ] = new Op tion(user. FullName, user.Syste mUserId); | |||||
| 128 | } | |||||
| 129 | userS elect.remo veAttribut e("disable d"); | |||||
| 130 | ||||||
| 131 | if (a lertFlag.c hecked == true) { | |||||
| 132 | aler t(users.le ngth + " s ystem user s retrieve d"); | |||||
| 133 | } | |||||
| 134 | ||||||
| 135 | } | |||||
| 136 | else { | |||||
| 137 | var n otificatio n = "This sample req uires that more than one user is availab le in the organizati on."; | |||||
| 138 | showM essage(not ification) ; | |||||
| 139 | if (a lertFlag.c hecked == true) { | |||||
| 140 | aler t("This sa mple requi res that m ore than o ne user is available in the or ganization ."); | |||||
| 141 | } | |||||
| 142 | ||||||
| 143 | } | |||||
| 144 | }); | |||||
| 145 | } | |||||
| 146 | function getAccoun ts() { | |||||
| 147 | //Clear out any r ecords dis played in the table | |||||
| 148 | clearAc countList( ); | |||||
| 149 | var sel ectedUserI d = userSe lect.optio ns[userSel ect.select edIndex].v alue; | |||||
| 150 | if (sel ectedUserI d != "none ") { | |||||
| 151 | ||||||
| 152 | SDK.RE ST.retriev eMultipleR ecords("Ac count", | |||||
| 153 | "$top= " + accoun tsToShow + "&$select =AccountId ,Name,Owne rId&$filte r=OwnerId/ Id ne (gui d'" + enco deURICompo nent(selec tedUserId) + "')", | |||||
| 154 | functi on (result s) { | |||||
| 155 | accou nts.length = 0; | |||||
| 156 | for ( var i = 0; i < resul ts.length; i++) { | |||||
| 157 | acco unts.push( results[i] ); | |||||
| 158 | } | |||||
| 159 | }, | |||||
| 160 | functi on (error) { | |||||
| 161 | showM essage(err or.message ); | |||||
| 162 | }, | |||||
| 163 | functi on () { | |||||
| 164 | //onC omplete | |||||
| 165 | if (a ccounts.le ngth > 0) { | |||||
| 166 | ||||||
| 167 | for (var i = 0 ; i < acco unts.lengt h; i++) { | |||||
| 168 | var account = accounts[ i]; | |||||
| 169 | ||||||
| 170 | var row = doc ument.crea teElement( "tr"); | |||||
| 171 | row .setAttrib ute("class ", "grid") ; | |||||
| 172 | row .setAttrib ute("id", account.Ac countId); | |||||
| 173 | var checkboxC ell = docu ment.creat eElement(" td"); | |||||
| 174 | var checkbox = document .createEle ment("inpu t"); | |||||
| 175 | che ckbox.setA ttribute(" type", "ch eckbox"); | |||||
| 176 | che ckbox.oncl ick = vali dateAssign Button; | |||||
| 177 | che ckboxCell. appendChil d(checkbox ); | |||||
| 178 | row .appendChi ld(checkbo xCell); | |||||
| 179 | var nameCell = document .createEle ment("td") ; | |||||
| 180 | set Text(nameC ell, accou nt.Name); | |||||
| 181 | row .appendChi ld(nameCel l); | |||||
| 182 | var userNameC ell = docu ment.creat eElement(" td"); | |||||
| 183 | set Text(userN ameCell, a ccount.Own erId.Name) ; | |||||
| 184 | row .appendChi ld(userNam eCell); | |||||
| 185 | acc ountList.a ppendChild (row); | |||||
| 186 | ||||||
| 187 | ||||||
| 188 | ||||||
| 189 | } | |||||
| 190 | ||||||
| 191 | if ( alertFlag. checked == true && ! suppressRe trievedAcc ountsAlert ) { | |||||
| 192 | ale rt(account s.length + " account records r etrieved." ); | |||||
| 193 | sup pressRetri evedAccoun tsAlert = false; | |||||
| 194 | ||||||
| 195 | } | |||||
| 196 | } | |||||
| 197 | else { | |||||
| 198 | //If no record s are retu rned displ ay a messa ge. | |||||
| 199 | clea rAccountLi st(); | |||||
| 200 | var row = docu ment.creat eElement(" tr"); | |||||
| 201 | var cell = doc ument.crea teElement( "td"); | |||||
| 202 | cell .setAttrib ute("colSp an", "3"); | |||||
| 203 | setT ext(cell, "No Accoun ts were re trieved"); | |||||
| 204 | row. appendChil d(cell); | |||||
| 205 | acco untList.ap pendChild( row); | |||||
| 206 | ||||||
| 207 | } | |||||
| 208 | //Sho w any of t he UI elem ents that are initia lly hidden | |||||
| 209 | setVi sibleUIEle ments(true ); | |||||
| 210 | }); | |||||
| 211 | } | |||||
| 212 | else { setVisible UIElements (false); } | |||||
| 213 | } | |||||
| 214 | function assignAcc ounts() { | |||||
| 215 | ///<sum mary> | |||||
| 216 | /// que ues the se lected acc ounts to b e assigned sequentia lly | |||||
| 217 | ///</su mmary> | |||||
| 218 | userId = userSele ct.options [userSelec t.selected Index].val ue; | |||||
| 219 | ||||||
| 220 | var che ckboxes = accountLis t.getEleme ntsByTagNa me("input" ); | |||||
| 221 | for (va r i = chec kboxes.len gth - 1; i >= 0; i-- ) { | |||||
| 222 | if (ch eckboxes[i ].checked) { | |||||
| 223 | var a ccountId = checkboxe s[i].paren tElement.p arentEleme nt.id; | |||||
| 224 | accou ntsToAssig n.push(acc ountId); | |||||
| 225 | } | |||||
| 226 | } | |||||
| 227 | assignN extAccount (); | |||||
| 228 | selectA ll.checked = false; | |||||
| 229 | } | |||||
| 230 | function assignNex tAccount() { | |||||
| 231 | /// <su mmary>Assi gns the qu eued accou nts</summa ry> | |||||
| 232 | //Preve nts a gene ric SQL er ror that c an occur w hen too ma ny assign requests o ccur in ra pid succes sion | |||||
| 233 | if (acc ountsToAss ign.length > 0) { | |||||
| 234 | SDK.SO APSamples. assignRequ est(userId , accounts ToAssign.s hift(), "a ccount", f unction () { | |||||
| 235 | assig nNextAccou nt(); | |||||
| 236 | }, fun ction (err or) { | |||||
| 237 | showM essage("Th ere was an error ass igning the account w ith Id :" + accountI d + ". The error mes sage is " + error.me ssage + ". "); | |||||
| 238 | assig nNextAccou nt(); | |||||
| 239 | }); | |||||
| 240 | ||||||
| 241 | } | |||||
| 242 | else { | |||||
| 243 | suppre ssRetrieve dAccountsA lert = tru e; | |||||
| 244 | getAcc ounts(); | |||||
| 245 | btnAss ign.setEna bled(false ) | |||||
| 246 | if (al ertFlag.ch ecked == t rue) { | |||||
| 247 | alert ("Record a ssignment completed and next s et of reco rds retrie ved."); | |||||
| 248 | } | |||||
| 249 | } | |||||
| 250 | ||||||
| 251 | ||||||
| 252 | } | |||||
| 253 | function showMessa ge(message ) { | |||||
| 254 | ///<sum mary> | |||||
| 255 | /// Hel per functi on to disp lay messag e on the p age if nec essary. | |||||
| 256 | ///</su mmary | |||||
| 257 | var dvM essage = d ocument.cr eateElemen t("div"); | |||||
| 258 | dvMessa ge.innerHT ML = SDK.S OAPSamples ._xmlEncod e(message) ; | |||||
| 259 | documen t.getEleme ntById("st atus").app endChild(d vMessage); | |||||
| 260 | } | |||||
| 261 | function clearAcco untList() { | |||||
| 262 | ///<sum mary> | |||||
| 263 | /// Hel per functi on remove rows from the Accoun t List tab le. | |||||
| 264 | ///</su mmary | |||||
| 265 | for (va r i = (acc ountList.r ows.length - 1) ; i >= 0; i--) { | |||||
| 266 | accoun tList.dele teRow(i); | |||||
| 267 | } | |||||
| 268 | account s.length = 0; | |||||
| 269 | ||||||
| 270 | } | |||||
| 271 | function toggleSel ectAllReco rds() { | |||||
| 272 | ///<sum mary> | |||||
| 273 | /// Hel per functi on to togg le all sel ected rows in the ac count list table. | |||||
| 274 | ///</su mmary | |||||
| 275 | var che ckboxes = accountLis t.getEleme ntsByTagNa me("input" ); | |||||
| 276 | for (va r i = 0; i < checkbo xes.length ; i++) { | |||||
| 277 | checkb oxes[i].ch ecked = th is.checked ; | |||||
| 278 | } | |||||
| 279 | btnAssi gn.setEnab led(this.c hecked); | |||||
| 280 | ||||||
| 281 | } | |||||
| 282 | function validateA ssignButto n() { | |||||
| 283 | ///<sum mary> | |||||
| 284 | /// Hel per functi on to enab le the Ass ign Record s button w hen rows a re selecte d. | |||||
| 285 | ///</su mmary | |||||
| 286 | if (thi s.checked == true) | |||||
| 287 | { btnAs sign.setEn abled(true ); } | |||||
| 288 | else { | |||||
| 289 | select All.checke d = false; | |||||
| 290 | var ch eckboxes = accountLi st.getElem entsByTagN ame("input "); | |||||
| 291 | var ch ecked = fa lse; | |||||
| 292 | for (v ar i = 0; i < checkb oxes.lengt h; i++) { | |||||
| 293 | if (c heckboxes[ i].checked == true) { | |||||
| 294 | chec ked = true ; | |||||
| 295 | brea k; | |||||
| 296 | } | |||||
| 297 | } | |||||
| 298 | btnAss ign.setEna bled(check ed); | |||||
| 299 | } | |||||
| 300 | } | |||||
| 301 | function setEnable d(bool) { | |||||
| 302 | ///<sum mary> | |||||
| 303 | /// Hel per method attached to the Ass ign button to make i t easier t o enable/d isable the button. | |||||
| 304 | ///</su mmary | |||||
| 305 | if (boo l) | |||||
| 306 | { this. removeAttr ibute("dis abled"); } | |||||
| 307 | else | |||||
| 308 | { this. setAttribu te("disabl ed", "disa bled"); } | |||||
| 309 | } | |||||
| 310 | function setVisibl eUIElement s(display) { | |||||
| 311 | ///<sum mary> | |||||
| 312 | /// Hel per functi on to show those UI elements i nitially h idden. | |||||
| 313 | ///</su mmary | |||||
| 314 | if (dis play) { | |||||
| 315 | show(t ableCaptio n); | |||||
| 316 | show(d ataTable); | |||||
| 317 | show(b tnAssign); | |||||
| 318 | } | |||||
| 319 | else { | |||||
| 320 | hide(t ableCaptio n); | |||||
| 321 | hide(d ataTable); | |||||
| 322 | hide(b tnAssign); | |||||
| 323 | } | |||||
| 324 | ||||||
| 325 | } | |||||
| 326 | function show(elem ent) { | |||||
| 327 | if (ele ment.tagNa me.toLower Case() == "table") { | |||||
| 328 | elemen t.style.di splay = "t able"; | |||||
| 329 | } | |||||
| 330 | else { | |||||
| 331 | elemen t.style.di splay = "b lock"; | |||||
| 332 | } | |||||
| 333 | ||||||
| 334 | } | |||||
| 335 | function hide(elem ent) { | |||||
| 336 | element .style.dis play = "no ne"; | |||||
| 337 | } | |||||
| 338 | // setTe xt mitiga te differe nces in ho w browsers set or ge t text con tent. | |||||
| 339 | function setText(n ode, text) { | |||||
| 340 | if (typ eof (node. innerText) != "undef ined") { | |||||
| 341 | node.i nnerText = text; | |||||
| 342 | } | |||||
| 343 | else { | |||||
| 344 | node.t extContent = text; | |||||
| 345 | } | |||||
| 346 | ||||||
| 347 | } | |||||
| 348 | ||||||
| 349 | </script> | |||||
| 350 | </head> | |||||
| 351 | <body> | |||||
| 352 | <h1> | |||||
| 353 | Assign A ccounts Sa mple | |||||
| 354 | </h1> | |||||
| 355 | <p> | |||||
| 356 | This pag e requires JavaScrip t and will update dy namically. | |||||
| 357 | </p> | |||||
| 358 | <p> | |||||
| 359 | <input i d="dispale rt" name=" dispalert" type="che ckbox" val ue="alert" /><label for="dispa lert">Disp lay alert window whe n data cha nges.</lab el> | |||||
| 360 | </p> | |||||
| 361 | <p> | |||||
| 362 | Click th e <b>Start </b> butto n to begin the sampl e. | |||||
| 363 | </p> | |||||
| 364 | <input ty pe="button " id="btnS tart" name ="btnStart " value="S tart" oncl ick="start Sample()" /> | |||||
| 365 | <div id=" divSample" style="di splay: non e"> | |||||
| 366 | <label f or="userLi st"> | |||||
| 367 | User: | |||||
| 368 | </label> | |||||
| 369 | <select id="userLi st" name=" userList" title="Sel ect a syst em user fr om this li st." disab led> | |||||
| 370 | <option value="no ne">Select a User... </option> | |||||
| 371 | </select > | |||||
| 372 | <p id="t ableCaptio n" style=" display: n one;"> | |||||
| 373 | Top 5 A ccounts no t assigned to the se lected use r: | |||||
| 374 | </p> | |||||
| 375 | <table c lass="data Table" id= "dataTable " style="d isplay: no ne; width: 100%;"> | |||||
| 376 | <thead> | |||||
| 377 | <tr cl ass="table Head"> | |||||
| 378 | <th s cope="col" id="check boxCol"> | |||||
| 379 | <inp ut id="sel ectAll" na me="select All" title ="Select t his to sel ect all re cords" typ e="checkbo x" /><labe l for="sel ectAll">Se lect All</label > | |||||
| 380 | </th> | |||||
| 381 | <th s cope="col" id="nameC ol"> | |||||
| 382 | Name | |||||
| 383 | </th> | |||||
| 384 | <th s cope="col" id="owner Col"> | |||||
| 385 | Owne r | |||||
| 386 | </th> | |||||
| 387 | </tr> | |||||
| 388 | </thead > | |||||
| 389 | <tbody id="accoun tList"></t body> | |||||
| 390 | </table> | |||||
| 391 | <label s tyle="disp lay: none; " for="btn Assign"> | |||||
| 392 | Click t o assign s elected re cords | |||||
| 393 | </label> | |||||
| 394 | <button id="btnAss ign" name= "btnAssign " disabled style="di splay: non e; float: right;"> | |||||
| 395 | Assign Records | |||||
| 396 | </button > | |||||
| 397 | <label s tyle="disp lay: none; " for="btn Assign"> | |||||
| 398 | Click t o assign s elected re cords | |||||
| 399 | </label> | |||||
| 400 | <button id="Button 1" name="b tnAssign" disabled s tyle="disp lay: none; float: ri ght;"> | |||||
| 401 | Assign Records | |||||
| 402 | </button > | |||||
| 403 | </div> | |||||
| 404 | <div id=" status"> | |||||
| 405 | | |||||
| 406 | </div> | |||||
| 407 | </body> | |||||
| 408 | </html> | |||||
| 409 | <!--</snip petAssignA ccounts>-- > |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.