Produced by Araxis Merge on 2/1/2017 2:57:00 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\RESTEndpoint\JQueryRESTDataOperations\JQueryRESTDataOperations\Scripts | JQueryRESTDataOperationsSample.js | Tue Dec 20 19:51:48 2016 UTC |
| 2 | Wed Feb 1 19:57:00 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 0 | 0 |
| Removed | 1 | 185 |
| 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 | // ======= ========== ========== ========== ========== ========== ========== == | |||||
| 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 tJQueryRES TDataOpera tions.JQue ryRESTData Operations Sample.js> | |||||
| 16 | /// <refer ence path= "SDK.JQuer y.js" /> | |||||
| 17 | /// <refer ence path= "jquery-1. 9.1.js" /> | |||||
| 18 | ||||||
| 19 | ||||||
| 20 | var primar yContact = null; | |||||
| 21 | var startB utton; | |||||
| 22 | var resetB utton; | |||||
| 23 | var output ; //The <o l> element used by t he writeMe ssage func tion to di splay text showing t he progres s of this sample. | |||||
| 24 | ||||||
| 25 | ||||||
| 26 | $(function () { | |||||
| 27 | getFirstC ontactToBe PrimaryCon tact(); | |||||
| 28 | startButt on = $("#s tart"); | |||||
| 29 | startButt on.click(c reateAccou nt); | |||||
| 30 | resetButt on = $("#r eset"); | |||||
| 31 | resetButt on.click(r esetSample ); | |||||
| 32 | output = $("#output "); | |||||
| 33 | ||||||
| 34 | }); | |||||
| 35 | ||||||
| 36 | ||||||
| 37 | function c reateAccou nt() { | |||||
| 38 | startButt on.attr("d isabled", "disabled" ); | |||||
| 39 | var accou nt = {}; | |||||
| 40 | account.N ame = "Tes t Account Name"; | |||||
| 41 | account.D escription = "This a ccount was created b y the JQue ryRESTData Operations sample."; | |||||
| 42 | if (prima ryContact != null) { | |||||
| 43 | //Set a lookup val ue | |||||
| 44 | writeMes sage("Sett ing the pr imary cont act to: " + primaryC ontact.Ful lName + ". "); | |||||
| 45 | account. PrimaryCon tactId = { Id: prima ryContact. ContactId, LogicalNa me: "conta ct", Name: primaryCo ntact.Full Name }; | |||||
| 46 | ||||||
| 47 | } | |||||
| 48 | //Set a p icklist va lue | |||||
| 49 | writeMess age("Setti ng Preferr ed Contact Method to E-mail.") ; | |||||
| 50 | account.P referredCo ntactMetho dCode = { Value: 2 } ; //E-mail | |||||
| 51 | ||||||
| 52 | //Set a m oney value | |||||
| 53 | writeMess age("Setti ng Annual Revenue to Two Milli on ."); | |||||
| 54 | account.R evenue = { Value: "2 000000.00" }; //Set Annual Rev enue | |||||
| 55 | ||||||
| 56 | //Set a B oolean val ue | |||||
| 57 | writeMess age("Setti ng Contact Method Ph one to \"D o Not Allo w\"."); | |||||
| 58 | account.D oNotPhone = true; // Do Not All ow | |||||
| 59 | ||||||
| 60 | //Add Two Tasks | |||||
| 61 | var today = new Dat e(); | |||||
| 62 | var start Date = new Date(toda y.getFullY ear(), tod ay.getMont h(), today .getDate() + 3); //S et a date three days in the fu ture. | |||||
| 63 | ||||||
| 64 | var LowPr iTask = { Subject: " Low Priori ty Task", ScheduledS tart: star tDate, Pri orityCode: { Value: 0} }; //Lo w Priority Task | |||||
| 65 | var HighP riTask = { Subject: "High Prio rity Task" , Schedule dStart: st artDate, P riorityCod e: { Value : 2} }; // High Prior ity Task | |||||
| 66 | account.A ccount_Tas ks = [LowP riTask, Hi ghPriTask] | |||||
| 67 | ||||||
| 68 | ||||||
| 69 | ||||||
| 70 | //Create the Accoun t | |||||
| 71 | SDK.JQuer y.createRe cord( | |||||
| 72 | accou nt, | |||||
| 73 | "Acco unt", | |||||
| 74 | funct ion (accou nt) { | |||||
| 75 | writ eMessage(" The accoun t named \" " + accoun t.Name + " \" was cre ated with the Accoun tId : \"" + account. AccountId + "\"."); | |||||
| 76 | writ eMessage(" Retrieving account w ith the Ac countId: \ "" + accou nt.Account Id + "\"." ); | |||||
| 77 | retr ieveAccoun t(account. AccountId) | |||||
| 78 | }, | |||||
| 79 | error Handler | |||||
| 80 | ); | |||||
| 81 | ||||||
| 82 | } | |||||
| 83 | ||||||
| 84 | function r etrieveAcc ount(Accou ntId) { | |||||
| 85 | SDK.JQuer y.retrieve Record( | |||||
| 86 | Accou ntId, | |||||
| 87 | "Acco unt", | |||||
| 88 | null, null, | |||||
| 89 | funct ion (accou nt) { | |||||
| 90 | writ eMessage(" Retrieved the accoun t named \" " + accoun t.Name + " \". This a ccount was created o n : \"" + account.Cr eatedOn + "\"."); | |||||
| 91 | upda teAccount( AccountId) ; | |||||
| 92 | }, | |||||
| 93 | error Handler | |||||
| 94 | ); | |||||
| 95 | } | |||||
| 96 | ||||||
| 97 | function u pdateAccou nt(Account Id) { | |||||
| 98 | var accou nt = {}; | |||||
| 99 | writeMess age("Chang ing the ac count Name to \"Upda ted Accoun t Name\"." ); | |||||
| 100 | account.N ame = "Upd ated Accou nt Name"; | |||||
| 101 | writeMess age("Addin g Address informatio n"); | |||||
| 102 | account.A ddress1_Ad dressTypeC ode = { Va lue: 3 }; //Address 1: Address Type = Pr imary | |||||
| 103 | account.A ddress1_Ci ty = "Samm amish"; | |||||
| 104 | account.A ddress1_Li ne1 = "123 Maple St. "; | |||||
| 105 | account.A ddress1_Po stalCode = "98074"; | |||||
| 106 | account.A ddress1_St ateOrProvi nce = "WA" ; | |||||
| 107 | writeMess age("Setti ng E-Mail address"); | |||||
| 108 | account.E MailAddres s1 = "some one@micros oft.com"; | |||||
| 109 | ||||||
| 110 | ||||||
| 111 | SDK.JQuer y.updateRe cord( | |||||
| 112 | Accou ntId, | |||||
| 113 | accou nt, | |||||
| 114 | "Acco unt", | |||||
| 115 | funct ion () { | |||||
| 116 | writ eMessage(" The accoun t record c hanges wer e saved"); | |||||
| 117 | dele teAccount( AccountId) ; | |||||
| 118 | }, | |||||
| 119 | error Handler | |||||
| 120 | ); | |||||
| 121 | } | |||||
| 122 | ||||||
| 123 | function d eleteAccou nt(Account Id) { | |||||
| 124 | if (confi rm("Do you want to d elete this account r ecord?")) { | |||||
| 125 | writeMes sage("You chose to d elete the account re cord."); | |||||
| 126 | SDK.JQue ry.deleteR ecord( | |||||
| 127 | Acc ountId, | |||||
| 128 | "Ac count", | |||||
| 129 | fun ction () { | |||||
| 130 | wr iteMessage ("The acco unt was de leted."); | |||||
| 131 | en ableResetB utton(); | |||||
| 132 | }, | |||||
| 133 | err orHandler | |||||
| 134 | ); | |||||
| 135 | } | |||||
| 136 | else { | |||||
| 137 | var urlT oAccountRe cord = SDK .JQuery._g etClientUr l() + "/ma in.aspx?et c=1&id=%7b " + Accoun tId + "%7d &pagetype= entityreco rd"; | |||||
| 138 | $("<li>< span>You c hose not t o delete t he record. You can v iew the re cord </spa n><a href= '" + | |||||
| 139 | urlToAcc ountRecord + | |||||
| 140 | "' targe t='_blank' >here</a>< /li>").app endTo(outp ut); | |||||
| 141 | enableRe setButton( ); | |||||
| 142 | } | |||||
| 143 | } | |||||
| 144 | ||||||
| 145 | function g etFirstCon tactToBePr imaryConta ct() { | |||||
| 146 | ||||||
| 147 | SDK.JQuer y.retrieve MultipleRe cords( | |||||
| 148 | "Cont act", | |||||
| 149 | "$sel ect=Contac tId,FullNa me&$top=1" , | |||||
| 150 | funct ion (resul ts) { | |||||
| 151 | var firstResul t = result s[0]; | |||||
| 152 | if ( firstResul t != null) { | |||||
| 153 | pri maryContac t = result s[0]; | |||||
| 154 | } | |||||
| 155 | else { | |||||
| 156 | wri teMessage( "No Contac t records are availa ble to set as the pr imary cont act for th e account. "); | |||||
| 157 | } | |||||
| 158 | }, | |||||
| 159 | error Handler, | |||||
| 160 | funct ion () { | |||||
| 161 | //On Complete h andler | |||||
| 162 | } | |||||
| 163 | ); | |||||
| 164 | } | |||||
| 165 | ||||||
| 166 | function e rrorHandle r(error) { | |||||
| 167 | writeMess age(error. message); | |||||
| 168 | } | |||||
| 169 | ||||||
| 170 | function e nableReset Button() { | |||||
| 171 | resetButt on.removeA ttr("disab led"); | |||||
| 172 | } | |||||
| 173 | ||||||
| 174 | function r esetSample () { | |||||
| 175 | output.em pty(); | |||||
| 176 | startButt on.removeA ttr("disab led"); | |||||
| 177 | resetButt on.attr("d isabled", "disabled" ); | |||||
| 178 | } | |||||
| 179 | ||||||
| 180 | //Helper f unction to write dat a to this page: | |||||
| 181 | function w riteMessag e(message) { | |||||
| 182 | $("<li>" + message + "</li>") .appendTo( output); | |||||
| 183 | } | |||||
| 184 | ||||||
| 185 | // </snipp etJQueryRE STDataOper ations.JQu eryRESTDat aOperation sSample.js > |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.