Produced by Araxis Merge on 12/4/2017 8:32:29 AM Central 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 | VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources | ftp_VistAMultiNoteDropDownListControljsDropDownLisD0A8D5F1-8F2D-E611-9437-0050568D743D | Thu Nov 17 16:48:12 2016 UTC |
| 2 | VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources | ftp_VistAMultiNoteDropDownListControljsDropDownLisD0A8D5F1-8F2D-E611-9437-0050568D743D | Thu Nov 30 16:21:53 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 810 |
| Changed | 1 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| 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 | /// <refer ence path= '../../tri ipcrm_/TR_ KU_V2015_2 _902/js/jq uery.min.j s' /> | |
| 2 | ||
| 3 | //DropDown ListContro lScriptLib .js | |
| 4 | //Contains variables and funct ions used by the Dro pDownListC ontrol.htm l page | |
| 5 | ||
| 6 | //Static V ariables | |
| 7 | var ddlc_c rmOdataEnd Point = '/ XRMService s/2011/Org anizationD ata.svc'; | |
| 8 | var ddlc_c ontext = G etGlobalCo ntext(); | |
| 9 | var ddlc_s erverUrl = ddlc_cont ext.getCli entUrl(); | |
| 10 | var ddlc_o rgName = d dlc_contex t.getOrgUn iqueName() ; | |
| 11 | ||
| 12 | //var ddlc _ViaLocati onsUrl = ' https://qa crmdac.np. crm.vrm.vb a. DNS /WebParts/ dev/api/VI A/Location s/1.0/json '; //OLD MANU AL DEV URL | |
| 13 | //var ddlc _ViaNotesT itleUrl = 'https://q acrmdac.np .crm.vrm.v ba. DNS /WebParts/ dev/api/VI A/NotesTit le/1.0/jso n'; //OLD MANU AL DEV URL | |
| 14 | var ddlc_V iaLocation sUrl = ''; | |
| 15 | var ddlc_V iaNotesTit leUrl = '' ; | |
| 16 | var ddlc_P atientFaci lity = ''; | |
| 17 | var ddlc_P atientFaci lityNo = ' '; | |
| 18 | var ddlc_d ropdownTyp eName = '' ; | |
| 19 | var ddlc_s electedTex tAttribute = ''; | |
| 20 | var ddlc_d uz = ''; | |
| 21 | var ddlc_p rovidernam e = ''; | |
| 22 | ||
| 23 | function d dlc_getQue ryVariable (ddlc_vari able) { | |
| 24 | try { | |
| 25 | // Get a Quer y Variable | |
| 26 | va r ddlc_que ry = windo w.location .search.su bstring(1) ; | |
| 27 | va r ddlc_var s = ddlc_q uery.split ("&"); | |
| 28 | fo r (var i = 0; i < dd lc_vars.le ngth; i++) { | |
| 29 | var ddlc _pair = dd lc_vars[i] .split("=" ); | |
| 30 | if (ddlc _pair[0] = = ddlc_var iable) { | |
| 31 | retu rn ddlc_pa ir[1]; | |
| 32 | } | |
| 33 | } | |
| 34 | // alert('A r equired Dr opDownList Query Var iable: ' + ddlc_vari able + ' i s missing! '); | |
| 35 | // return ""; | |
| 36 | } | |
| 37 | catch (err) { | |
| 38 | al ert("DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_g etQueryVar iable): " + err.mess age); | |
| 39 | } | |
| 40 | } | |
| 41 | ||
| 42 | function d dlc_formLo ad() { | |
| 43 | //Temp orary Disa ble Data L oad for Dr opDown Lis t Componen t | |
| 44 | //**** ********** ********** ********** ********** ********** * | |
| 45 | return false; | |
| 46 | //**** ********** ********** ********** ********** ********** * | |
| 47 | ||
| 48 | try { | |
| 49 | // Get the CR M QueryStr ing conten t | |
| 50 | va r ddlc_xrm data = ddl c_getQuery Variable(" data"); | |
| 51 | // Split the data array , format i s dropdown typename~s electedtex tattribute (sample : HOSPITAL LOCATION~f tp_hospita llocation) | |
| 52 | va r ddlc_xrm array = dd lc_xrmdata .split("~" , 2); | |
| 53 | dd lc_dropdow nTypeName = ddlc_xrm array[0]; | |
| 54 | dd lc_selecte dTextAttri bute = ddl c_xrmarray [1]; | |
| 55 | ||
| 56 | // Add the cu rrent sele ction to t he options et if it h as a value | |
| 57 | if (parent.X rm.Page.ge tAttribute (ddlc_sele ctedTextAt tribute).g etValue() != null) { | |
| 58 | $('<opti on>').val( '0').text( parent.Xrm .Page.getA ttribute(d dlc_select edTextAttr ibute).get Value()).a ppendTo('# dropdownli st'); | |
| 59 | } | |
| 60 | ||
| 61 | // Determine the status of the pa rent recor d, if open , build a new dropdo wn list | |
| 62 | if (parent.X rm.Page.ui .getFormTy pe() > 2) { | |
| 63 | //The fo rm is disa bled, disa ble the co ntrol and exit | |
| 64 | document .getElemen tById('dro pdownlist' ).disabled = true; | |
| 65 | return f alse; | |
| 66 | } | |
| 67 | ||
| 68 | // Get the Pa tient Faci lity (must exist to render hos pital loca tions drop down) | |
| 69 | dd lc_Patient Facility = parent.Xr m.Page.get Attribute( 'ftp_patie ntfacility ').getValu e(); | |
| 70 | if (ddlc_Pat ientFacili ty != null && ddlc_P atientFaci lity != '' ) { | |
| 71 | //Lookup the Facil ity/Site # | |
| 72 | var ddlc _facilityD ata = ddlc _getSingle EntityData Sync('ftp_ facilitySe t', 'ftp_f acilitycod e', ddlc_P atientFaci lity[0].id ); | |
| 73 | if (ddlc _facilityD ata != nul l) { | |
| 74 | if ( ddlc_facil ityData.d. ftp_facili tycode != null) { dd lc_Patient FacilityNo = ddlc_fa cilityData .d.ftp_fac ilitycode; } | |
| 75 | } | |
| 76 | } | |
| 77 | ||
| 78 | // If there i s no facil ity number , exit | |
| 79 | if (ddlc_Pat ientFacili tyNo == '' ) { return false; } | |
| 80 | ||
| 81 | // Check if V IA Login c ookie exis t (not exp ired) | |
| 82 | va r ddlc_Via LoginCooki e = ddlc_g etCookie(" viasession link"); | |
| 83 | ||
| 84 | if (ddlc_Via LoginCooki e != null && ddlc_Vi aLoginCook ie != '') { | |
| 85 | var ddlc _cookiearr ay = ddlc_ ViaLoginCo okie.split ("~~~~", 2 ); | |
| 86 | ddlc_duz = ddlc_co okiearray[ 0]; | |
| 87 | ddlc_pro vidername = ddlc_coo kiearray[1 ]; | |
| 88 | } | |
| 89 | ||
| 90 | // Check Cook ie return values if missing ex it | |
| 91 | if (ddlc_duz == '' || ddlc_provi dername == '') { ret urn false; } | |
| 92 | ||
| 93 | // GET CRM SE TTINGS WEB SERVICE U RLS | |
| 94 | va r ddlc_con ditionalFi lter = "(m cs_name eq 'Active S ettings')" ; | |
| 95 | dd lc_getMult ipleEntity DataAsync( 'mcs_setti ngSet', 'f tp_DACURL, ftp_VIALo cationsURL , ftp_VIAN otesTitleU RL', ddlc_ conditiona lFilter, ' mcs_name', 'asc', 0, ddlc_Sett ingsWebSer viceURL_re sponse); | |
| 96 | ||
| 97 | } | |
| 98 | catch (err) { | |
| 99 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_f ormLoad): ' + err.me ssage); | |
| 100 | } | |
| 101 | } | |
| 102 | ||
| 103 | function d dlc_Settin gsWebServi ceURL_resp onse(ddlc_ settingDat a, ddlc_la stSkip) { | |
| 104 | try { | |
| 105 | // ddlc_lastS kip is the starting point in t he result (use if mo re than 50 records) //Not used in this s cenario | |
| 106 | va r ddlc_Dac Url = null ; | |
| 107 | va r ddlc_Via LocationsA piUrl = nu ll; | |
| 108 | va r ddlc_Via NotesTitle ApiUrl = n ull; | |
| 109 | fo r (var i = 0; i <= d dlc_settin gData.d.re sults.leng th - 1; i+ +) { | |
| 110 | //Get in fo | |
| 111 | if (ddlc _settingDa ta.d.resul ts[i].ftp_ DACURL != null) { dd lc_DacUrl = ddlc_set tingData.d .results[i ].ftp_DACU RL; } | |
| 112 | if (ddlc _settingDa ta.d.resul ts[i].ftp_ VIALocatio nsURL != n ull) { ddl c_ViaLocat ionsApiUrl = ddlc_se ttingData. d.results[ i].ftp_VIA LocationsU RL; } | |
| 113 | if (ddlc _settingDa ta.d.resul ts[i].ftp_ VIANotesTi tleURL != null) { dd lc_ViaNote sTitleApiU rl = ddlc_ settingDat a.d.result s[i].ftp_V IANotesTit leURL; } | |
| 114 | break; | |
| 115 | } | |
| 116 | if (ddlc_Dac Url != nul l && ddlc_ ViaLocatio nsApiUrl ! = null) { | |
| 117 | //Constr uct full L ocations w eb service URL | |
| 118 | ddlc_Via LocationsU rl = ddlc_ DacUrl + d dlc_ViaLoc ationsApiU rl; | |
| 119 | } | |
| 120 | el se { | |
| 121 | parent.X rm.Page.ui .setFormNo tification ("ERROR: T HE VIA LOC ATIONS SER VICE URL I S MISSING, PLEASE CO NTACT TECH NICAL SUPP ORT!", "ER ROR", "VIA SERVICE"); | |
| 122 | } | |
| 123 | ||
| 124 | if (ddlc_Dac Url != nul l && ddlc_ ViaNotesTi tleApiUrl != null) { | |
| 125 | //Constr uct full N otes Title web servi ce URL | |
| 126 | ddlc_Via NotesTitle Url = ddlc _DacUrl + ddlc_ViaNo tesTitleAp iUrl; | |
| 127 | } | |
| 128 | el se { | |
| 129 | parent.X rm.Page.ui .setFormNo tification ("ERROR: T HE VIA NOT ES TITLE S ERVICE URL IS MISSIN G, PLEASE CONTACT TE CHNICAL SU PPORT!", " ERROR", "V IASERVICE" ); | |
| 130 | } | |
| 131 | ||
| 132 | // Proceed to VIA web s ervice to populate t he control | |
| 133 | if (ddlc_dro pdownTypeN ame == "HO SPITALLOCA TION") { | |
| 134 | //Popula te control with VIA Locations | |
| 135 | ddlc_ret rieveViaLo cations(); | |
| 136 | return f alse; | |
| 137 | } | |
| 138 | ||
| 139 | // Proceed to VIA web s ervice to populate t he control | |
| 140 | if (ddlc_dro pdownTypeN ame == "LO CALNOTESTI TLE") { | |
| 141 | //Popula te control with VIA Notes Titl e | |
| 142 | ddlc_ret rieveViaNo tesTitle() ; | |
| 143 | return f alse; | |
| 144 | } | |
| 145 | ||
| 146 | } | |
| 147 | catch (err) { | |
| 148 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_S ettingsWeb ServiceURL _response) : ' + err. message); | |
| 149 | } | |
| 150 | } | |
| 151 | ||
| 152 | function d dlc_retrie veViaLocat ions() { | |
| 153 | try { | |
| 154 | // Retrieve V IA Locatio ns by Site | |
| 155 | va r ddlc_via Location = new Objec t(); | |
| 156 | dd lc_viaLoca tion.Provi derName = ddlc_provi dername; | |
| 157 | dd lc_viaLoca tion.Duz = ddlc_duz; | |
| 158 | dd lc_viaLoca tion.Login SiteCode = ddlc_Pati entFacilit yNo; | |
| 159 | dd lc_viaLoca tion.Targe t = ""; | |
| 160 | dd lc_viaLoca tion.Direc tion = "1" ; | |
| 161 | ||
| 162 | va r ddlc_loc ationsResp onse = ""; | |
| 163 | ||
| 164 | $. ajax({ | |
| 165 | type: "P OST", | |
| 166 | url: ddl c_ViaLocat ionsUrl, | |
| 167 | data: JS ON.stringi fy(ddlc_vi aLocation) , | |
| 168 | contentT ype: "appl ication/js on; charse t=utf-8", | |
| 169 | dataType : "json", | |
| 170 | success: function (data) { | |
| 171 | ddlc _locations Response = data; | |
| 172 | ddlc _retrieveV iaLocation s_response (null, ddl c_location sResponse) ; | |
| 173 | }, | |
| 174 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 175 | //Sy stem Error | |
| 176 | ddlc _retrieveV iaLocation s_response (errorThro wn, null); | |
| 177 | }, | |
| 178 | async: f alse, | |
| 179 | cache: f alse | |
| 180 | }) ; | |
| 181 | } | |
| 182 | catch (err) { | |
| 183 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_r etrieveVia Locations) : ' + err. message); | |
| 184 | } | |
| 185 | } | |
| 186 | ||
| 187 | function d dlc_retrie veViaLocat ions_respo nse(ddlc_e rrorThrown , ddlc_loc ationsResp onse) { | |
| 188 | try { | |
| 189 | // Add a blan k row | |
| 190 | $( '<option>' ).val('00' ).text('') .appendTo( '#dropdown list'); | |
| 191 | ||
| 192 | if (ddlc_err orThrown ! = null) { | |
| 193 | //Genera l Web Serv ice Error | |
| 194 | alert("E rror: The VISTA Loca tions Web Service Fa iled with error(" + ddlc_error Thrown + " )"); | |
| 195 | return f alse; | |
| 196 | } | |
| 197 | if (ddlc_loc ationsResp onse.Error Occurred = = true) { | |
| 198 | alert("E rror: The VISTA Loca tions Web Service Fa iled with error(" + ddlc_locat ionsRespon se.ErrorMe ssage + ") "); | |
| 199 | } | |
| 200 | el se { | |
| 201 | //Analys e results and build control | |
| 202 | if (ddlc _locations Response.D ata != nul l) { | |
| 203 | for (var i = 0 ; i <= ddl c_location sResponse. Data[0].Lo cation.len gth - 1; i ++) { | |
| 204 | var ddlc_l ocationId = null; | |
| 205 | var ddlc_l ocationNam e = null; | |
| 206 | ||
| 207 | //Get Info | |
| 208 | if (ddlc_l ocationsRe sponse.Dat a[0].Locat ion[i].Id != null) { ddlc_loca tionId = d dlc_locati onsRespons e.Data[0]. Location[i ].Id; } | |
| 209 | if (ddlc_l ocationsRe sponse.Dat a[0].Locat ion[i].Nam e != null) { ddlc_lo cationName = ddlc_lo cationsRes ponse.Data [0].Locati on[i].Name ; } | |
| 210 | ||
| 211 | //Add the location t o the drop down contr ol | |
| 212 | if (ddlc_l ocationId != null && ddlc_loca tionName ! = null) { | |
| 213 | //Add only if no t already included d ue to prev ious selec tion | |
| 214 | if (pa rent.Xrm.P age.getAtt ribute(ddl c_selected TextAttrib ute).getVa lue() != d dlc_locati onName) { | |
| 215 | $( '<option>' ).val(ddlc _locationI d).text(dd lc_locatio nName).app endTo('#dr opdownlist '); | |
| 216 | } | |
| 217 | } | |
| 218 | } | |
| 219 | } | |
| 220 | } | |
| 221 | } | |
| 222 | catch (err) { | |
| 223 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_r etrieveVia Locations_ response): ' + err.m essage); | |
| 224 | } | |
| 225 | } | |
| 226 | ||
| 227 | function d dlc_retrie veViaNotes Title() { | |
| 228 | try { | |
| 229 | // Retrieve V IA Notes T itle by Si te | |
| 230 | va r ddlc_via NotesTitle = new Obj ect(); | |
| 231 | dd lc_viaNote sTitle.Pro viderName = ddlc_pro vidername; | |
| 232 | dd lc_viaNote sTitle.Duz = ddlc_du z; | |
| 233 | dd lc_viaNote sTitle.Log inSiteCode = ddlc_Pa tientFacil ityNo; | |
| 234 | dd lc_viaNote sTitle.Tar get = ""; | |
| 235 | dd lc_viaNote sTitle.Dir ection = " 1"; | |
| 236 | ||
| 237 | va r ddlc_not estitleRes ponse = "" ; | |
| 238 | ||
| 239 | $. ajax({ | |
| 240 | type: "P OST", | |
| 241 | url: ddl c_ViaNotes TitleUrl, | |
| 242 | data: JS ON.stringi fy(ddlc_vi aNotesTitl e), | |
| 243 | contentT ype: "appl ication/js on; charse t=utf-8", | |
| 244 | dataType : "json", | |
| 245 | success: function (data) { | |
| 246 | ddlc _notestitl eResponse = data; | |
| 247 | ddlc _retrieveV iaNotesTit le_respons e(null, dd lc_notesti tleRespons e); | |
| 248 | }, | |
| 249 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 250 | //Sy stem Error | |
| 251 | ddlc _retrieveV iaNotesTit le_respons e(errorThr own, null) ; | |
| 252 | }, | |
| 253 | async: f alse, | |
| 254 | cache: f alse | |
| 255 | }) ; | |
| 256 | } | |
| 257 | catch (err) { | |
| 258 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_r etrieveVia NotesTitle ): ' + err .message); | |
| 259 | } | |
| 260 | } | |
| 261 | ||
| 262 | function d dlc_retrie veViaNotes Title_resp onse(ddlc_ errorThrow n, ddlc_no testitleRe sponse) { | |
| 263 | //Add a blank ro w | |
| 264 | $('<op tion>').va l('00').te xt('').app endTo('#dr opdownlist '); | |
| 265 | ||
| 266 | try { | |
| 267 | if (ddlc_err orThrown ! = null) { | |
| 268 | //Genera l Web Serv ice Error | |
| 269 | alert("E rror: The VISTA Note s Title We b Service Failed wit h error(" + ddlc_err orThrown + ")"); | |
| 270 | return f alse; | |
| 271 | } | |
| 272 | if (ddlc_not estitleRes ponse.Erro rOccurred == true) { | |
| 273 | alert("E rror: The VISTA Note s Title We b Service Failed wit h error(" + ddlc_not estitleRes ponse.Erro rMessage + ")"); | |
| 274 | } | |
| 275 | el se { | |
| 276 | //Analyz e results and build control | |
| 277 | if (ddlc _notestitl eResponse. Data != nu ll) { | |
| 278 | if ( ddlc_notes titleRespo nse.Data[0 ].Title != null) { | |
| 279 | for (var i = 0; i <= ddlc_note stitleResp onse.Data[ 0].Title.l ength - 1; i++) { | |
| 280 | var dd lc_notesti tleId = nu ll; | |
| 281 | var dd lc_notesti tleDescrip tion = nul l; | |
| 282 | ||
| 283 | //Get Info | |
| 284 | if (dd lc_notesti tleRespons e.Data[0]. Title[i].I d != null) { ddlc_no testitleId = ddlc_no testitleRe sponse.Dat a[0].Title [i].Id; } | |
| 285 | if (dd lc_notesti tleRespons e.Data[0]. Title[i].D escription != null) { | |
| 286 | fo r (var i2 = 0; i2 <= ddlc_note stitleResp onse.Data[ 0].Title[i ].Descript ion.length - 1; i2++ ) { | |
| 287 | ddlc_not estitleDes cription = ddlc_note stitleResp onse.Data[ 0].Title[i ].Descript ion[i2].Ti tle; | |
| 288 | //Add th e notes ti tlee to th e dropdown control | |
| 289 | if (ddlc _notestitl eId != nul l && ddlc_ notestitle Descriptio n != null) { | |
| 290 | //Ad d only if not alread y included due to pr evious sel ection | |
| 291 | if ( parent.Xrm .Page.getA ttribute(d dlc_select edTextAttr ibute).get Value() != ddlc_note stitleDesc ription) { | |
| 292 | $('<option >').val(dd lc_notesti tleId + i2 ).text(ddl c_notestit leDescript ion).appen dTo('#drop downlist') ; | |
| 293 | } | |
| 294 | } | |
| 295 | } | |
| 296 | } | |
| 297 | } | |
| 298 | } | |
| 299 | } | |
| 300 | } | |
| 301 | } | |
| 302 | catch (err) { | |
| 303 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_r etrieveVia NotesTitle _response) : ' + err. message); | |
| 304 | } | |
| 305 | } | |
| 306 | ||
| 307 | function d dlc_dropdo wnSelected () { | |
| 308 | //***W rite back to CRM the selected value*** | |
| 309 | var dd lc_selecte dDropDownT ext = $("# dropdownli st").find( ":selected ").text(); | |
| 310 | parent .Xrm.Page. getAttribu te(ddlc_se lectedText Attribute) .setValue( ddlc_selec tedDropDow nText); | |
| 311 | parent .Xrm.Page. getAttribu te(ddlc_se lectedText Attribute) .setSubmit Mode('alwa ys'); | |
| 312 | } | |
| 313 | ||
| 314 | function d dlc_getCoo kie(cname) { | |
| 315 | try { | |
| 316 | va r name = c name + "=" ; | |
| 317 | va r ca = doc ument.cook ie.split(' ;'); | |
| 318 | fo r (var i = 0; i < ca .length; i ++) { | |
| 319 | var c = ca[i]; | |
| 320 | while (c .charAt(0) == ' ') { | |
| 321 | c = c.substrin g(1); | |
| 322 | } | |
| 323 | if (c.in dexOf(name ) == 0) { | |
| 324 | retu rn c.subst ring(name. length, c. length); | |
| 325 | } | |
| 326 | } | |
| 327 | re turn ""; | |
| 328 | } | |
| 329 | catch (err) { | |
| 330 | al ert('DropD ownList Co ntrol Web Resource F unction Er ror(ddlc_g etCookie): ' + err.m essage); | |
| 331 | } | |
| 332 | } | |
| 333 | ||
| 334 | ||
| 335 | function d dlc_execut eCrmOdataG etRequest( ddlc_jsonQ uery, ddlc _aSync, dd lc_aSyncCa llback, dd lc_skipCou nt, ddlc_o ptionArray ) { | |
| 336 | //This function executes a CRM Odata web servi ce call to retrieve Crm data | |
| 337 | //*ddl c_jsonQuer y* - a pro perly form atted CRM Odata Quer y string ( required) | |
| 338 | //*ddl c_aSync* - specify ' true' to e xecute asy nchronousl y otherwis e 'false' (required) | |
| 339 | //*ddl c_aSyncCal lback* - s pecify the name of t he return function t o call upo n completi on (requir ed if ddlc _aSync = t rue. Othe rwise '') | |
| 340 | //*ddl c_skipCoun t* - Initi al setting is always '0', incr ements by 50 per CRM SDK Odata standards (required ) | |
| 341 | //*ddl c_optionAr ray* - is an optiona l array or single va lue, that contains a dditional task speci fic variab les that c an be pass ed between functions (pass 'nu ll' if not used) | |
| 342 | try { | |
| 343 | va r ddlc_ent ityData = null; | |
| 344 | $. ajax({ | |
| 345 | type: 'G ET', | |
| 346 | contentT ype: 'appl ication/js on; charse t=utf-8', | |
| 347 | datatype : 'json', | |
| 348 | url: ddl c_jsonQuer y, | |
| 349 | beforeSe nd: functi on (XMLHtt pRequest) { | |
| 350 | XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json'); | |
| 351 | }, | |
| 352 | success: function (data, tex tStatus, X mlHttpRequ est) { | |
| 353 | ddlc _entityDat a = data; | |
| 354 | if ( ddlc_aSync == true) { | |
| 355 | ddlc_aSync Callback(d dlc_entity Data, ddlc _skipCount , ddlc_opt ionArray); | |
| 356 | } | |
| 357 | }, | |
| 358 | error: f unction (X MLHttpRequ est, textS tatus, err orThrown) { | |
| 359 | aler t('Fail: A jax Error in ddlc_ex ecuteCrmOd ataGetRequ est: ' + e rrorThrown + " Reque st: " + dd lc_jsonQue ry); | |
| 360 | }, | |
| 361 | async: d dlc_aSync, | |
| 362 | cache: f alse | |
| 363 | }) ; | |
| 364 | re turn ddlc_ entityData ; | |
| 365 | } | |
| 366 | catch (err) { | |
| 367 | al ert('An er ror occure d in the d dlc_execut eCrmOdataG etRequest function. Error Det ail Messag e: ' + err ); | |
| 368 | } | |
| 369 | } | |
| 370 | ||
| 371 | function d dlc_getMul tipleEntit yDataAsync (ddlc_enti tySetName, ddlc_attr ibuteSet, ddlc_condi tionalFilt er, ddlc_s ortAttribu te, ddlc_s ortDirecti on, ddlc_s kipCount, ddlc_aSync Callback, ddlc_optio nArray) { | |
| 372 | //This function returns a CRM JSON d ataset for all entit y records matching c riteria pr ovided Asy ncronously | |
| 373 | //*ddl c_entitySe tName* - i s the name of the en tity set e .g 'Contac tSet' | |
| 374 | //*ddl c_attribut eSet* - i s a string containin g the Crm Attributes to retrie ve e.g. 'F irstName, LastName, Telephone1 , EMailAdd ress1' | |
| 375 | //*ddl c_conditio nalFilter* - is the conditiona l filter v alue place d on the d ata values retrived e.g. 'Stat eCode/Valu e eq 0' t o retrieve active co ntact reco rds only | |
| 376 | //*ddl c_sortAttr ibute* - i s a string containin g the name of the at tribute to sort the result set by e.g. ' LastName' | |
| 377 | //*ddl c_sortDire ction* - i s a string specifyin g the sort as Ascend ing or Des cending e. g. 'asc' o r 'desc' | |
| 378 | //*ddl c_skipCoun t* - is th e starting point in the result (use if m ore than 5 0), (Put 0 if not us ed) | |
| 379 | //*ddl c_aSyncCal lback* - i s the name of the fu nction to call when returning the result | |
| 380 | //*ddl c_optionAr ray* - is an optiona l array, t hat contai ns additio nal task s pecific va riables th at can be passed bet ween funct ions | |
| 381 | ||
| 382 | try { | |
| 383 | va r ddlc_jso nQuery = d dlc_server Url + ddlc _crmOdataE ndPoint + '/' + ddlc _entitySet Name + '?$ select=' + ddlc_attr ibuteSet + '&$filter =' + ddlc_ conditiona lFilter + '&$orderby =' + ddlc_ sortAttrib ute + ' ' + ddlc_sor tDirection + '&$skip =' + ddlc_ skipCount; | |
| 384 | dd lc_execute CrmOdataGe tRequest(d dlc_jsonQu ery, true, ddlc_aSyn cCallback, ddlc_skip Count, ddl c_optionAr ray); | |
| 385 | } | |
| 386 | catch (err) { | |
| 387 | al ert('An er ror occure d in the d dlc_getMul tipleEntit yDataAsync function. Error De tail Messa ge: ' + er r); | |
| 388 | } | |
| 389 | } | |
| 390 | ||
| 391 | function d dlc_getSin gleEntityD ataSync(dd lc_entityS etName, dd lc_attribu teSet, ddl c_entityId ) { | |
| 392 | //This function returns a CRM JSON d ataset for a single entity rec ord based on the ent ity id pro vided Sync ronously | |
| 393 | //*ddl c_entitySe tName* - i s the name of the en tity set e .g 'Contac tSet' | |
| 394 | //*ddl c_attribut eSet* - i s a string containin g the Crm Attributes to retrie ve e.g. 'F irstName, LastName, Telephone1 , EMailAdd ress1' | |
| 395 | //*ddl c_entityId * - is the Guid for the entity record | |
| 396 | ||
| 397 | try { | |
| 398 | va r ddlc_ent ityIdNoBra cket = ddl c_entityId .replace(/ ({|})/g, ' '); | |
| 399 | va r ddlc_sel ectString = '(guid' + "'" + dd lc_entityI dNoBracket + "'" + ' )?$select= ' + ddlc_a ttributeSe t; | |
| 400 | va r ddlc_jso nQuery = d dlc_server Url + ddlc _crmOdataE ndPoint + '/' + ddlc _entitySet Name + ddl c_selectSt ring; | |
| 401 | va r ddlc_ent ityData = ddlc_execu teCrmOdata GetRequest (ddlc_json Query, fal se, '', 0, null); | |
| 402 | re turn ddlc_ entityData ; | |
| 403 | } | |
| 404 | catch (err) { | |
| 405 | al ert('An er ror occure d in the d dlc_getSin gleEntityD ataSync fu nction. E rror Detai l Message: ' + err); | |
| 406 | } | |
| 407 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.