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_RequestJScriptrequest_GetNextAppointmentjsD1C1D097-225B-E611-9440-0050568D743D | Thu Nov 17 16:48:12 2016 UTC |
| 2 | VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources | ftp_RequestJScriptrequest_GetNextAppointmentjsD1C1D097-225B-E611-9440-0050568D743D | Thu Nov 30 16:21:34 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 432 |
| Changed | 1 | 2 |
| 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 | //request_ GetNextApp ointment.j s | |
| 2 | //Contains functions used on t he request form to r etrieve th e next app ointment v ia HDR pro xy web ser vice | |
| 3 | //Requires jQuery lo aded on th e CRM Form | |
| 4 | ||
| 5 | //Static V ariables | |
| 6 | var reqgna _serverUrl = Xrm.Pag e.context. getClientU rl(); | |
| 7 | var reqgna _crmOdataE ndPoint = "/XRMServi ces/2011/O rganizatio nData.svc" ; | |
| 8 | ||
| 9 | //var reqg na_Appoint mentsUrl = 'https:// qacrmdac.n p.crm.vrm. vba. DNS /WebParts/ DEV/api/Ap pointments /1.0/json/ FtPCRM/'; //OLD MANU AL DEV URL | |
| 10 | var reqgna _Appointme ntsUrl = ' '; | |
| 11 | var reqgna _veteranNa tionalID = ''; | |
| 12 | ||
| 13 | function r eqgna_GetN extAppoint ment() { | |
| 14 | try { | |
| 15 | // Determine if the sta tus of the form and if there i s enough i nformation to retrie ve appoint ments | |
| 16 | if (Xrm.Page .ui.getFor mType() > 2) { retur n false; } | |
| 17 | va r reqgna_v eteranId = Xrm.Page. getAttribu te('custom erid').get Value(); | |
| 18 | if (reqgna_v eteranId = = null) { return fal se; } | |
| 19 | ||
| 20 | // Get the Ve teran's Na tional ID | |
| 21 | va r reqgna_c ontactData = reqgna_ getSingleE ntityDataS ync('Conta ctSet', 'F ullName, t ri_Veteran ID', reqgn a_veteranI d[0].id); | |
| 22 | if (reqgna_c ontactData != null) { | |
| 23 | var reqg na_veteran Name = ''; | |
| 24 | if (reqg na_contact Data.d.Ful lName != n ull) { req gna_vetera nName = re qgna_conta ctData.d.F ullName; } | |
| 25 | if (reqg na_contact Data.d.tri _VeteranID != null) { reqgna_v eteranNati onalID = r eqgna_cont actData.d. tri_Vetera nID; } | |
| 26 | } | |
| 27 | ||
| 28 | // Exit if Ve teran's na tional ID is missing | |
| 29 | if (reqgna_v eteranNati onalID == '') { retu rn false; } | |
| 30 | ||
| 31 | // GET CRM SE TTINGS WEB SERVICE U RLS | |
| 32 | va r reqgna_c onditional Filter = " (mcs_name eq 'Active Settings' )"; | |
| 33 | re qgna_getMu ltipleEnti tyDataAsyn c('mcs_set tingSet', 'ftp_DACUR L, ftp_App ointmentAP IURL', req gna_condit ionalFilte r, 'mcs_na me', 'asc' , 0, reqgn a_Settings WebService URL_respon se, reqgna _Appointme ntsUrl); | |
| 34 | ||
| 35 | } | |
| 36 | catch (err) { | |
| 37 | // Display Er ror | |
| 38 | al ert("An er ror occure d in the r eqgna_GetN extAppoint ment funct ion. Erro r Detail M essage: " + err); | |
| 39 | } | |
| 40 | } | |
| 41 | ||
| 42 | function r eqgna_Sett ingsWebSer viceURL_re sponse(req gna_settin gData, req gna_lastSk ip, reqgna _Appointme ntsUrl_NA) { | |
| 43 | try { | |
| 44 | // reqgna__la stSkip is the starti ng point i n the resu lt (use if more than 50 record s) //Not u sed in thi s scenario | |
| 45 | va r reqgna_D acUrl = nu ll; | |
| 46 | va r reqgna_A ppointment ApiUrl = n ull; | |
| 47 | fo r (var i = 0; i <= r eqgna_sett ingData.d. results.le ngth - 1; i++) { | |
| 48 | //Get in fo | |
| 49 | if (reqg na_setting Data.d.res ults[i].ft p_DACURL ! = null) { reqgna_Dac Url = reqg na_setting Data.d.res ults[i].ft p_DACURL; } | |
| 50 | if (reqg na_setting Data.d.res ults[i].ft p_Appointm entAPIURL != null) { reqgna_Ap pointmentA piUrl = re qgna_setti ngData.d.r esults[i]. ftp_Appoin tmentAPIUR L; } | |
| 51 | break; | |
| 52 | } | |
| 53 | if (reqgna_D acUrl != n ull && req gna_Appoin tmentApiUr l != null) { | |
| 54 | //Constr uct full w eb service URL | |
| 55 | reqgna_A ppointment sUrl = req gna_DacUrl + reqgna_ Appointmen tApiUrl; | |
| 56 | //Set fi lter to tr ue for tes ting, othe rwise fals e | |
| 57 | reqgna_e xecuteGetA ppointment Request(fa lse); | |
| 58 | } | |
| 59 | el se { | |
| 60 | Xrm.Page .ui.setFor mNotificat ion("ERROR : THE APPO INTMENT AP I WEB SERV ICE URL IS MISSING, PLEASE CON TACT TECHN ICAL SUPPO RT!", "ERR OR", "APPS ERVICE"); | |
| 61 | } | |
| 62 | } | |
| 63 | catch (err) { | |
| 64 | al ert('Get N ext Appoin tment Web Resource F unction Er ror(reqgna _SettingsW ebServiceU RL_respons e): ' + er r.message) ; | |
| 65 | } | |
| 66 | } | |
| 67 | ||
| 68 | function r eqgna_exec uteGetAppo intmentReq uest(reqgn a_noFilter ) { | |
| 69 | try { | |
| 70 | va r reqgna_r equestResp onse = ""; | |
| 71 | ||
| 72 | $. ajax({ | |
| 73 | type: "G ET", | |
| 74 | url: req gna_Appoin tmentsUrl + reqgna_v eteranNati onalID + " ?noFilter= " + reqgna _noFilter, | |
| 75 | contentT ype: "appl ication/js on; charse t=utf-8", | |
| 76 | dataType : "json", | |
| 77 | success: function (data) { | |
| 78 | var reqgna_new data = dat a; | |
| 79 | reqg na_request Response = reqgna_ne wdata; | |
| 80 | reqg na_execute GetAppoint mentReques t_response (null, req gna_reques tResponse) ; | |
| 81 | }, | |
| 82 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 83 | //Sy stem Error | |
| 84 | reqg na_execute GetAppoint mentReques t_response (errorThro wn, null); | |
| 85 | }, | |
| 86 | async: f alse, | |
| 87 | cache: f alse | |
| 88 | }) ; | |
| 89 | } | |
| 90 | catch (err) { | |
| 91 | al ert('Reque st Functio n Error(re qgna_execu teGetAppoi ntmentRequ est): ' + err.messag e); | |
| 92 | } | |
| 93 | } | |
| 94 | ||
| 95 | function r eqgna_exec uteGetAppo intmentReq uest_respo nse(reqgna _errorThro wn, reqgna _requestRe sponse) { | |
| 96 | try { | |
| 97 | // Process Re quest Resp onse | |
| 98 | if (reqgna_e rrorThrown != null) { | |
| 99 | //Error | |
| 100 | alert("r eqgna_exec uteGetAppo intmentReq uest_respo nse Error: " + reqgna _errorThro wn); | |
| 101 | return f alse; | |
| 102 | } | |
| 103 | el se { | |
| 104 | //Analyz e data | |
| 105 | if (reqg na_request Response.E rrorOccurr ed == fals e) { | |
| 106 | //Su ccess entr y | |
| 107 | var reqgna_cur rentDateTi me = new D ate(); | |
| 108 | var reqgna_nex tAppointme nt = null; | |
| 109 | ||
| 110 | if ( reqgna_req uestRespon se.Data != null) { | |
| 111 | for (var i = 0; i <= reqgna_re questRespo nse.Data.l ength - 1; i++) { | |
| 112 | var re qgna_jsonD ateTimeDat e = null; | |
| 113 | if (re qgna_reque stResponse .Data[i].D ateTimeDat e != null) { reqgna_ jsonDateTi meDate = r eqgna_requ estRespons e.Data[i]. DateTimeDa te; } | |
| 114 | if (re qgna_curre ntDateTime > new Dat e(reqgna_j sonDateTim eDate)) { | |
| 115 | // Do Nothing , skip ove r record | |
| 116 | } | |
| 117 | else | |
| 118 | { | |
| 119 | if (reqgna_n extAppoint ment == nu ll) { | |
| 120 | reqgna_n extAppoint ment = new Date(reqg na_jsonDat eTimeDate) ; | |
| 121 | } | |
| 122 | el se { | |
| 123 | if ((new Date(reqg na_jsonDat eTimeDate) < reqgna_ nextAppoin tment) && (new Date( reqgna_jso nDateTimeD ate) > req gna_curren tDateTime) ) { | |
| 124 | reqg na_nextApp ointment = new Date( reqgna_jso nDateTimeD ate); | |
| 125 | } | |
| 126 | } | |
| 127 | } | |
| 128 | } | |
| 129 | } | |
| 130 | Xrm. Page.getAt tribute("f tp_nextapp tdatetime" ).setValue (reqgna_ne xtAppointm ent); | |
| 131 | Xrm. Page.getAt tribute('f tp_nextapp tdatetime' ).setSubmi tMode('alw ays'); | |
| 132 | } | |
| 133 | else { | |
| 134 | //Fa ilure entr y | |
| 135 | aler t("reqgna_ executeGet Appointmen tRequest_r esponse Fa ilure: " + reqgna_re questRespo nse.Status + " " + v cmn_reques tResponse. ErrorMessa ge); | |
| 136 | retu rn false; | |
| 137 | } | |
| 138 | } | |
| 139 | } | |
| 140 | catch (err) { | |
| 141 | al ert('Reque st Functio n Error(re qgna_execu teGetAppoi ntmentRequ est_respon se): ' + e rr.message ); | |
| 142 | } | |
| 143 | } | |
| 144 | ||
| 145 | function r eqgna_exec uteCrmOdat aGetReques t(reqgna_j sonQuery, reqgna_aSy nc, reqgna _aSyncCall back, reqg na_skipCou nt, reqgna _optionArr ay) { | |
| 146 | //This function executes a CRM Odata web servi ce call to retrieve Crm data | |
| 147 | //*req gna_jsonQu ery* - a p roperly fo rmatted CR M Odata Qu ery string (required ) | |
| 148 | //*req gna_aSync* - specify 'true' to execute a synchronou sly otherw ise 'false ' (require d) | |
| 149 | //*req gna_aSyncC allback* - specify t he name of the retur n function to call u pon comple tion (requ ired if re qgna_aSync = true. Otherwise '') | |
| 150 | //*req gna_skipCo unt* - Ini tial setti ng is alwa ys '0', in crements b y 50 per C RM SDK Oda ta standar ds (requir ed) | |
| 151 | //*req gna_option Array* - i s an optio nal array or single value, tha t contains additiona l task spe cific vari ables that can be pa ssed betwe en functio ns (pass ' null' if n ot used) | |
| 152 | try { | |
| 153 | va r reqgna_e ntityData = null; | |
| 154 | $. ajax({ | |
| 155 | type: 'G ET', | |
| 156 | contentT ype: 'appl ication/js on; charse t=utf-8', | |
| 157 | datatype : 'json', | |
| 158 | url: req gna_jsonQu ery, | |
| 159 | beforeSe nd: functi on (XMLHtt pRequest) { | |
| 160 | XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json'); | |
| 161 | }, | |
| 162 | success: function (data, tex tStatus, X mlHttpRequ est) { | |
| 163 | reqg na_entityD ata = data ; | |
| 164 | if ( reqgna_aSy nc == true ) { | |
| 165 | reqgna_aSy ncCallback (reqgna_en tityData, reqgna_ski pCount, re qgna_optio nArray); | |
| 166 | } | |
| 167 | }, | |
| 168 | error: f unction (X MLHttpRequ est, textS tatus, err orThrown) { | |
| 169 | aler t('Fail: A jax Error in reqgna_ executeCrm OdataGetRe quest: ' + errorThro wn + " Req uest: " + reqgna_jso nQuery); | |
| 170 | }, | |
| 171 | async: r eqgna_aSyn c, | |
| 172 | cache: f alse | |
| 173 | }) ; | |
| 174 | re turn reqgn a_entityDa ta; | |
| 175 | } | |
| 176 | catch (err) { | |
| 177 | al ert('An er ror occure d in the r eqgna_exec uteCrmOdat aGetReques t function . Error D etail Mess age: ' + e rr); | |
| 178 | } | |
| 179 | } | |
| 180 | ||
| 181 | function r eqgna_getM ultipleEnt ityDataAsy nc(reqgna_ entitySetN ame, reqgn a_attribut eSet, reqg na_conditi onalFilter , reqgna_s ortAttribu te, reqgna _sortDirec tion, reqg na_skipCou nt, reqgna _aSyncCall back, reqg na_optionA rray) { | |
| 182 | //This function returns a CRM JSON d ataset for all entit y records matching c riteria pr ovided Asy ncronously | |
| 183 | //*req gna_entity SetName* - is the na me of the entity set e.g 'Cont actSet' | |
| 184 | //*req gna_attrib uteSet* - is a stri ng contain ing the Cr m Attribut es to retr ieve e.g. 'FirstName , LastName , Telephon e1, EMailA ddress1' | |
| 185 | //*req gna_condit ionalFilte r* - is th e conditio nal filter value pla ced on the data valu es retrive d e.g. 'St ateCode/Va lue eq 0' to retrie ve active contact re cords only | |
| 186 | //*req gna_sortAt tribute* - is a stri ng contain ing the na me of the attribute to sort th e result s et by e.g. 'LastName ' | |
| 187 | //*req gna_sortDi rection* - is a stri ng specify ing the so rt as Asce nding or D escending e.g. 'asc' or 'desc' | |
| 188 | //*req gna_skipCo unt* - is the starti ng point i n the resu lt (use if more than 50), (Put 0 if not used) | |
| 189 | //*req gna_aSyncC allback* - is the na me of the function t o call whe n returnin g the resu lt | |
| 190 | //*req gna_option Array* - i s an optio nal array, that cont ains addit ional task specific variables that can b e passed b etween fun ctions | |
| 191 | ||
| 192 | try { | |
| 193 | va r reqgna_j sonQuery = reqgna_se rverUrl + reqgna_crm OdataEndPo int + '/' + reqgna_e ntitySetNa me + '?$se lect=' + r eqgna_attr ibuteSet + '&$filter =' + reqgn a_conditio nalFilter + '&$order by=' + req gna_sortAt tribute + ' ' + reqg na_sortDir ection + ' &$skip=' + reqgna_sk ipCount; | |
| 194 | re qgna_execu teCrmOdata GetRequest (reqgna_js onQuery, t rue, reqgn a_aSyncCal lback, req gna_skipCo unt, reqgn a_optionAr ray); | |
| 195 | } | |
| 196 | catch (err) { | |
| 197 | al ert('An er ror occure d in the r eqgna_getM ultipleEnt ityDataAsy nc functio n. Error Detail Mes sage: ' + err); | |
| 198 | } | |
| 199 | } | |
| 200 | ||
| 201 | function r eqgna_getS ingleEntit yDataSync( reqgna_ent itySetName , reqgna_a ttributeSe t, reqgna_ entityId) { | |
| 202 | //This function returns a CRM JSON d ataset for a single entity rec ord based on the ent ity id pro vided Sync ronously | |
| 203 | //*req gna_entity SetName* - is the na me of the entity set e.g 'Cont actSet' | |
| 204 | //*req gna_attrib uteSet* - is a stri ng contain ing the Cr m Attribut es to retr ieve e.g. 'FirstName , LastName , Telephon e1, EMailA ddress1' | |
| 205 | //*req gna_entity Id* - is t he Guid fo r the enti ty record | |
| 206 | ||
| 207 | try { | |
| 208 | va r reqgna_e ntityIdNoB racket = r eqgna_enti tyId.repla ce(/({|})/ g, ''); | |
| 209 | va r reqgna_s electStrin g = '(guid ' + "'" + reqgna_ent ityIdNoBra cket + "'" + ')?$sel ect=' + re qgna_attri buteSet; | |
| 210 | va r reqgna_j sonQuery = reqgna_se rverUrl + reqgna_crm OdataEndPo int + '/' + reqgna_e ntitySetNa me + reqgn a_selectSt ring; | |
| 211 | va r reqgna_e ntityData = reqgna_e xecuteCrmO dataGetReq uest(reqgn a_jsonQuer y, false, '', 0, nul l); | |
| 212 | re turn reqgn a_entityDa ta; | |
| 213 | } | |
| 214 | catch (err) { | |
| 215 | al ert('An er ror occure d in the r eqgna_getS ingleEntit yDataSync function. Error Det ail Messag e: ' + err ); | |
| 216 | } | |
| 217 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.