Produced by Araxis Merge on 12/4/2017 8:32:41 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\VCCMResources\VCCMResources_3_0_0_12.zip\WebResources | ftp_VistAMultiNoteVistaLoginControljsVistaLoginCon810D6C09-5423-E611-9437-0050568D743D | Mon Sep 18 10:55:52 2017 UTC |
| 2 | VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_3_0_0_12.zip\WebResources | ftp_VistAMultiNoteVistaLoginControljsVistaLoginCon810D6C09-5423-E611-9437-0050568D743D | Mon Dec 4 13:28:13 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 868 |
| 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 | /// <refer ence path= '../../../ triipcrm_/ TR_KU_V201 5_2_902/js /jquery.mi n.js' /> | |
| 2 | ||
| 3 | //VistaLog inControlS criptLib.j s | |
| 4 | //Contains variables and funct ions used by the Vis taLoginCon trol.html page | |
| 5 | ||
| 6 | //Static V ariables | |
| 7 | var vlc_cr mOdataEndP oint = '/X RMServices /2011/Orga nizationDa ta.svc'; | |
| 8 | var vlc_co ntext = Ge tGlobalCon text(); | |
| 9 | var vlc_se rverUrl = vlc_contex t.getClien tUrl(); | |
| 10 | var vlc_or gName = vl c_context. getOrgUniq ueName(); | |
| 11 | var vlc_us erId = vlc _context.g etUserId() ; | |
| 12 | var vlc_us erName = v lc_context .getUserNa me(); | |
| 13 | ||
| 14 | //var vlc_ ViaLoginUr l = 'https ://qacrmda c.np.crm.v rm.vba. DNS /WebParts/ dev/api/VI A/LoginVIA /1.0/json' ; //OLD MANU AL DEV URL | |
| 15 | var vlc_Vi aLoginUrl = ''; | |
| 16 | var vlc_us erSiteId = ''; | |
| 17 | var vlc_Us erSiteNo = ''; | |
| 18 | var vlc_Vi aLoginMinu tes = 1; //Populate d from set tings, but should ty pically be 230 minut es (3 hour s 50 Minut es) | |
| 19 | ||
| 20 | function v lc_Setting sWebServic eURL_respo nse(vlc_se ttingData, vlc_lastS kip, vlc_V iaLoginUrl _NA) { | |
| 21 | try { | |
| 22 | // vlc_lastSk ip is the starting p oint in th e result ( use if mor e than 50 records) / /Not used in this sc enario | |
| 23 | va r vlc_DacU rl = null; | |
| 24 | va r vlc_ViaL oginApiUrl = null; | |
| 25 | fo r (var i = 0; i <= v lc_setting Data.d.res ults.lengt h - 1; i++ ) { | |
| 26 | //Get in fo | |
| 27 | if (vlc_ settingDat a.d.result s[i].ftp_D ACURL != n ull) { vlc _DacUrl = vlc_settin gData.d.re sults[i].f tp_DACURL; } | |
| 28 | if (vlc_ settingDat a.d.result s[i].ftp_V IALoginURL != null) { vlc_ViaL oginApiUrl = vlc_set tingData.d .results[i ].ftp_VIAL oginURL; } | |
| 29 | if (vlc_ settingDat a.d.result s[i].ftp_V IALoginMin utes != nu ll) { vlc_ ViaLoginMi nutes = vl c_settingD ata.d.resu lts[i].ftp _VIALoginM inutes; } | |
| 30 | break; | |
| 31 | } | |
| 32 | if (vlc_DacU rl != null && vlc_Vi aLoginApiU rl != null ) { | |
| 33 | //Constr uct full w eb service URL | |
| 34 | vlc_ViaL oginUrl = vlc_DacUrl + vlc_Via LoginApiUr l; | |
| 35 | } | |
| 36 | el se { | |
| 37 | parent.X rm.Page.ui .setFormNo tification ("ERROR: T HE VIA LOG IN SERVICE URL IS MI SSING, PLE ASE CONTAC T TECHNICA L SUPPORT! ", "ERROR" , "VIASERV ICE"); | |
| 38 | } | |
| 39 | } | |
| 40 | catch (err) { | |
| 41 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_Set tingsWebSe rviceURL_r esponse): ' + err.me ssage); | |
| 42 | } | |
| 43 | } | |
| 44 | ||
| 45 | function v lc_formLoa d() { | |
| 46 | try { | |
| 47 | // Determine the status of the pa rent recor d | |
| 48 | if (parent.X rm.Page.ui .getFormTy pe() > 2) { | |
| 49 | //The fo rm is disa bled, hide login tab | |
| 50 | parent.X rm.Page.ui .tabs.get( 'Tab_VistA Login').se tVisible(f alse); | |
| 51 | return f alse; | |
| 52 | } | |
| 53 | ||
| 54 | // Check if V IA Login c ookie exis t (not exp ired) | |
| 55 | va r vlc_ViaL oginCookie = vlc_get Cookie("vi asessionli nk"); | |
| 56 | ||
| 57 | // Hide Vista Login Tab and exit if cookie exist | |
| 58 | if (vlc_ViaL oginCookie != "") { | |
| 59 | parent.X rm.Page.ui .tabs.get( 'Tab_VistA Login').se tVisible(f alse); | |
| 60 | //**TRIG GER FORM S CRIPT CODE TO RECREA TE DEPENDE NT WEB RES OURCES** | |
| 61 | parent.v cmn_initVi aDropdownC ontrols(); | |
| 62 | return f alse; | |
| 63 | } | |
| 64 | ||
| 65 | // GET CRM SE TTINGS WEB SERVICE U RLS | |
| 66 | va r vlc_cond itionalFil ter = "(mc s_name eq 'Active Se ttings')"; | |
| 67 | vl c_getMulti pleEntityD ataAsync(' mcs_settin gSet', 'ft p_DACURL, ftp_VIALog inURL, ftp _VIALoginM inutes', v lc_conditi onalFilter , 'mcs_nam e', 'asc', 0, vlc_Se ttingsWebS erviceURL_ response, vlc_ViaLog inUrl); | |
| 68 | // Notify Use r to Login To VistA | |
| 69 | pa rent.Xrm.P age.ui.set FormNotifi cation("ER ROR: YOUR VISTA SESS ION HAS EX PIRED, PLE ASE LOGIN BELOW!", " ERROR", "V IASERVICE" ); | |
| 70 | // Set focus to the log in control | |
| 71 | pa rent.Xrm.P age.getCon trol("WebR esource_Vi staLoginCo ntrol").se tFocus(); | |
| 72 | ||
| 73 | // Get the cu rrent CRM User's ass igned site /facility | |
| 74 | va r vlc_user Data = vlc _getSingle EntityData Sync('Syst emUserSet' , 'ftp_Fac ilitySiteI d', vlc_us erId); | |
| 75 | if (vlc_user Data != nu ll) { | |
| 76 | if (vlc_ userData.d .ftp_Facil itySiteId != null) { | |
| 77 | vlc_ userSiteId = vlc_use rData.d.ft p_Facility SiteId.Id; | |
| 78 | } | |
| 79 | } | |
| 80 | ||
| 81 | // Lookup the Facility/ Site # | |
| 82 | if (vlc_user SiteId != null && vl c_userSite Id != '') { | |
| 83 | var vlc_ facilityDa ta = vlc_g etSingleEn tityDataSy nc('ftp_fa cilitySet' , 'ftp_fac ilitycode' , vlc_user SiteId); | |
| 84 | if (vlc_ facilityDa ta != null ) { | |
| 85 | if ( vlc_facili tyData.d.f tp_facilit ycode != n ull) { vlc _UserSiteN o = vlc_fa cilityData .d.ftp_fac ilitycode; } | |
| 86 | } | |
| 87 | } | |
| 88 | } | |
| 89 | catch (err) { | |
| 90 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_for mLoad): ' + err.mess age); | |
| 91 | } | |
| 92 | } | |
| 93 | ||
| 94 | function v lc_vistaLo gin() { | |
| 95 | try { | |
| 96 | // Get Login Field data | |
| 97 | va r vlc_acce ssCode = $ ('#vlc_acc essCode'). val(); | |
| 98 | va r vlc_esig natureCode = $('#vlc _esignatur eCode').va l(); | |
| 99 | va r vlc_veri fyCode = $ ('#vlc_ver ifyCode'). val(); | |
| 100 | // Verify tha t fields a re not emp ty | |
| 101 | if (vlc_acce ssCode == null || vl c_accessCo de == "") { alert("P lease ente r your VIS TA Access Code!"); r eturn fals e; } | |
| 102 | if (vlc_esig natureCode == null | | vlc_esig natureCode == "") { alert("Ple ase enter your VISTA eSignatur e Code!"); return fa lse; } | |
| 103 | if (vlc_veri fyCode == null || vl c_verifyCo de == "") { alert("P lease ente r your VIS TA Verify Code!"); r eturn fals e; } | |
| 104 | ||
| 105 | // Disable lo gin fields and butto n | |
| 106 | do cument.get ElementByI d('vlc_acc essCode'). disabled = true; | |
| 107 | do cument.get ElementByI d('vlc_esi gnatureCod e').disabl ed = true; | |
| 108 | do cument.get ElementByI d('vlc_ver ifyCode'). disabled = true; | |
| 109 | do cument.get ElementByI d('vlc_log inbuttonid ').disable d = true; | |
| 110 | ||
| 111 | // Process Vi stA Login using VIA web servic e | |
| 112 | va r vlc_viaL ogin = new Object(); | |
| 113 | vl c_viaLogin .AccessCod e = vlc_ac cessCode; | |
| 114 | vl c_viaLogin .VerifyCod e = vlc_ve rifyCode; | |
| 115 | vl c_viaLogin .SiteId = vlc_UserSi teNo.toStr ing(); | |
| 116 | vl c_viaLogin .Target = ""; | |
| 117 | ||
| 118 | va r vlc_logi nResponse = ""; | |
| 119 | ||
| 120 | $. ajax({ | |
| 121 | type: "P OST", | |
| 122 | url: vlc _ViaLoginU rl, | |
| 123 | data: JS ON.stringi fy(vlc_via Login), | |
| 124 | contentT ype: "appl ication/js on; charse t=utf-8", | |
| 125 | dataType : "json", | |
| 126 | success: function (data) { | |
| 127 | vlc_ loginRespo nse = data ; | |
| 128 | vlc_ vistaLogin _response( null, vlc_ loginRespo nse); | |
| 129 | }, | |
| 130 | error: f unction (j qXHR, text Status, er rorThrown) { | |
| 131 | //Sy stem Error | |
| 132 | vlc_ vistaLogin _response( errorThrow n, null); | |
| 133 | }, | |
| 134 | async: f alse, | |
| 135 | cache: f alse | |
| 136 | }) ; | |
| 137 | } | |
| 138 | catch (err) { | |
| 139 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_vis taLogin): ' + err.me ssage); | |
| 140 | } | |
| 141 | } | |
| 142 | ||
| 143 | function v lc_vistaLo gin_respon se(vlc_err orThrown, vlc_loginR esponse) { | |
| 144 | try { | |
| 145 | if (vlc_erro rThrown != null) { | |
| 146 | //Genera l Web Serv ice Error | |
| 147 | alert("E rror: The VISTA Logi n Web Serv ice Failed with erro r(" + vlc_ errorThrow n + ") Pl ease try y our login again!"); | |
| 148 | //Enable login fie lds and bu tton | |
| 149 | document .getElemen tById('vlc _accessCod e').disabl ed = false ; | |
| 150 | document .getElemen tById('vlc _esignatur eCode').di sabled = f alse; | |
| 151 | document .getElemen tById('vlc _verifyCod e').disabl ed = false ; | |
| 152 | document .getElemen tById('vlc _loginbutt onid').dis abled = fa lse; | |
| 153 | return f alse; | |
| 154 | } | |
| 155 | if (vlc_logi nResponse. ErrorOccur red == tru e) { | |
| 156 | alert("E rror: The VISTA Logi n Web Serv ice Failed with erro r(" + vlc_ loginRespo nse.ErrorM essage + " ) Please try your l ogin again !"); | |
| 157 | //Enable login fie lds and bu tton | |
| 158 | document .getElemen tById('vlc _accessCod e').disabl ed = false ; | |
| 159 | document .getElemen tById('vlc _esignatur eCode').di sabled = f alse; | |
| 160 | document .getElemen tById('vlc _verifyCod e').disabl ed = false ; | |
| 161 | document .getElemen tById('vlc _loginbutt onid').dis abled = fa lse; | |
| 162 | return f alse; | |
| 163 | } | |
| 164 | el se { | |
| 165 | //Get se ssionid/to ken full V istA user name and V istaDUZ(IE N) | |
| 166 | var vlc_ duz = ""; | |
| 167 | var vlc_ providerna me = ""; | |
| 168 | var vlc_ vistaduz = ""; | |
| 169 | ||
| 170 | var vlc_ esignature Code = $(' #vlc_esign atureCode' ).val(); | |
| 171 | ||
| 172 | if (vlc_ loginRespo nse.Data[0 ].Duz != n ull) { vlc _duz = vlc _loginResp onse.Data[ 0].Duz; } | |
| 173 | if (vlc_ loginRespo nse.Data[0 ].Provider Name != nu ll) { var vlc_provid ername = v lc_loginRe sponse.Dat a[0].Provi derName; } | |
| 174 | if (vlc_ loginRespo nse.Data[0 ].VistaDUZ != null) { vlc_vist aduz = vlc _loginResp onse.Data[ 0].VistaDU Z; } | |
| 175 | ||
| 176 | //Check that there are value s returned | |
| 177 | if (vlc_ duz == "" || vlc_pro vidername == "") { | |
| 178 | //Ch eck for Fa ult, set d efault mes sage | |
| 179 | var vlc_viaLog inFault = "The Login is invali d, please try your l ogin again !"; | |
| 180 | if ( vlc_loginR esponse.Da ta[0].Faul t != null) { vlc_via LoginFault = "The Lo gin is inv alid, " + vlc_loginR esponse.Da ta[0].Faul t.Message; } | |
| 181 | aler t("Error: " + vlc_vi aLoginFaul t); | |
| 182 | //En able login fields an d button | |
| 183 | docu ment.getEl ementById( 'vlc_acces sCode').di sabled = f alse; | |
| 184 | docu ment.getEl ementById( 'vlc_esign atureCode' ).disabled = false; | |
| 185 | docu ment.getEl ementById( 'vlc_verif yCode').di sabled = f alse; | |
| 186 | docu ment.getEl ementById( 'vlc_login buttonid') .disabled = false; | |
| 187 | retu rn false; | |
| 188 | } | |
| 189 | ||
| 190 | //Write values to Browser Co okie | |
| 191 | vlc_setC ookie("via sessionlin k", vlc_du z + "~~~~" + vlc_pro vidername + "~~~~" + vlc_esign atureCode, vlc_ViaLo ginMinutes ); | |
| 192 | ||
| 193 | //Update Cross Ref erence | |
| 194 | vlc_upda teCrossRef erence(vlc _userId, v lc_userNam e, vlc_vis taduz, vlc _providern ame); | |
| 195 | ||
| 196 | //Clear login fiel ds and hid e control | |
| 197 | parent.X rm.Page.ui .clearForm Notificati on("VIASER VICE"); | |
| 198 | document .getElemen tById('vlc _accessCod e').disabl ed = false ; | |
| 199 | document .getElemen tById('vlc _esignatur eCode').di sabled = f alse; | |
| 200 | document .getElemen tById('vlc _verifyCod e').disabl ed = false ; | |
| 201 | document .getElemen tById('vlc _loginbutt onid').dis abled = fa lse; | |
| 202 | document .getElemen tById('vlc _accessCod e').value = ''; | |
| 203 | document .getElemen tById('vlc _esignatur eCode').va lue = ''; | |
| 204 | document .getElemen tById('vlc _verifyCod e').value = ''; | |
| 205 | //Hide t he login t ab | |
| 206 | parent.X rm.Page.ui .tabs.get( 'Tab_VistA Login').se tVisible(f alse); | |
| 207 | ||
| 208 | //**TRIG GER FORM S CRIPT CODE TO RECREA TE DEPENDE NT WEB RES OURCES** | |
| 209 | parent.v cmn_initVi aDropdownC ontrols(); | |
| 210 | } | |
| 211 | } | |
| 212 | catch (err) { | |
| 213 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_vis taLogin_re sponse): ' + err.mes sage); | |
| 214 | } | |
| 215 | } | |
| 216 | ||
| 217 | function v lc_loginKe yPress(eve nt) { | |
| 218 | try { | |
| 219 | // Determine if 'enter' key was p ressed if so attempt login | |
| 220 | va r vlc_keyp ressed = e vent.which || event. keyCode; | |
| 221 | if (vlc_keyp ressed == 13) { vlc_ vistaLogin (); } | |
| 222 | } | |
| 223 | catch (err) { | |
| 224 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_log inKeyPress ): ' + err .message); | |
| 225 | } | |
| 226 | } | |
| 227 | ||
| 228 | function v lc_getCook ie(cname) { | |
| 229 | try { | |
| 230 | va r name = c name + "=" ; | |
| 231 | va r ca = doc ument.cook ie.split(' ;'); | |
| 232 | fo r (var i = 0; i < ca .length; i ++) { | |
| 233 | var c = ca[i]; | |
| 234 | while (c .charAt(0) == ' ') { | |
| 235 | c = c.substrin g(1); | |
| 236 | } | |
| 237 | if (c.in dexOf(name ) == 0) { | |
| 238 | retu rn c.subst ring(name. length, c. length); | |
| 239 | } | |
| 240 | } | |
| 241 | re turn ""; | |
| 242 | } | |
| 243 | catch (err) { | |
| 244 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_get Cookie): ' + err.mes sage); | |
| 245 | } | |
| 246 | } | |
| 247 | ||
| 248 | function v lc_setCook ie(cname, cvalue, ex minutes) { | |
| 249 | try { | |
| 250 | va r d = new Date(); | |
| 251 | d. setMinutes (d.getMinu tes() + (e xminutes)) ; | |
| 252 | va r expires = "expires =" + d.toU TCString() ; | |
| 253 | do cument.coo kie = cnam e + "=" + cvalue + " ; " + expi res + "; p ath=/" + v lc_orgName + "/"; | |
| 254 | } | |
| 255 | catch (err) { | |
| 256 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_get Cookie): ' + err.mes sage); | |
| 257 | } | |
| 258 | } | |
| 259 | ||
| 260 | function v lc_updateC rossRefere nce(vlc_cr mUserGuid, vlc_crmUs erName, vl c_viaUserI en, vlc_vi aUserName) { | |
| 261 | try { | |
| 262 | // Check that the requi red parame ters has a value | |
| 263 | if (vlc_crmU serGuid != "" && vlc _crmUserGu id != null && vlc_vi aUserIen ! = "" && vl c_viaUserI en != null ) { | |
| 264 | //Check if a recor d already exists for the CRM u ser, if so preserve the cross reference record gui d | |
| 265 | var vlc_ crossRefer enceId = n ull; | |
| 266 | var vlc_ conditiona lFilter = "ftp_crmus er/Id eq ( guid'" + v lc_crmUser Guid + "') "; | |
| 267 | var vlc_ crossRefer enceData = vlc_getMu ltipleEnti tyDataSync ('ftp_user idSet', 'f tp_useridI d', vlc_co nditionalF ilter, 'ft p_name', ' asc', 0); | |
| 268 | if (vlc_ crossRefer enceData ! = null) { | |
| 269 | for (var i = 0 ; i <= vlc _crossRefe renceData. d.results. length - 1 ; i++) { | |
| 270 | //Get Info | |
| 271 | if (vlc_cr ossReferen ceData.d.r esults[i]. ftp_userid Id != null ) { vlc_cr ossReferen ceId = vlc _crossRefe renceData. d.results[ i].ftp_use ridId; } | |
| 272 | break; | |
| 273 | } | |
| 274 | } | |
| 275 | //Determ ine to add new recor d or updat e existing | |
| 276 | if (vlc_ crossRefer enceId != null) { | |
| 277 | //Ex isting Rec ord, perfo rm update | |
| 278 | var vlc_crossR eferenceRe cord = new Object(); | |
| 279 | vlc_ crossRefer enceRecord .ftp_crmgu id = vlc_c rmUserGuid ; | |
| 280 | vlc_ crossRefer enceRecord .ftp_vista duz = vlc_ viaUserIen ; | |
| 281 | vlc_ crossRefer enceRecord .ftp_vista username = vlc_viaUs erName; | |
| 282 | vlc_ crossRefer enceRecord .ftp_crmus er = { Id: vlc_crmUs erGuid, Lo gicalName: "systemus er", Name: vlc_crmUs erName }; | |
| 283 | vlc_ crossRefer enceRecord .ftp_name = "CROSS R EFERENCE - " + vlc_c rmUserName ; | |
| 284 | vlc_ crossRefer enceRecord .ftp_lastv ialogin = new Date() ; | |
| 285 | ||
| 286 | //ma ke it a js on object | |
| 287 | var jsonEntity = JSON.st ringify(vl c_crossRef erenceReco rd); | |
| 288 | ||
| 289 | $.aj ax({ | |
| 290 | type: "POS T", | |
| 291 | contentTyp e: "applic ation/json ; charset= utf-8", | |
| 292 | datatype: "json", | |
| 293 | url: vlc_s erverUrl + vlc_crmOd ataEndPoin t + "/" + 'ftp_useri dSet' + "( guid'" + v lc_crossRe ferenceId + "')", | |
| 294 | data: json Entity, | |
| 295 | beforeSend : function (XMLHttpR equest) { | |
| 296 | XMLHtt pRequest.s etRequestH eader("X-H TTP-Method ", "MERGE" ); | |
| 297 | }, | |
| 298 | success: f unction (t extStatus, XmlHttpRe quest) { | |
| 299 | //aler t("The Vis ta User Cr oss Refere nce Record was updat ed success fully."); | |
| 300 | }, | |
| 301 | error: fun ction (Xml HttpReques t, textSta tus, error Thrown) { | |
| 302 | alert( 'Ajax Erro r in Updat e of Vista User Cros s Referenc e Record: ' + errorT hrown); | |
| 303 | } | |
| 304 | }); | |
| 305 | } | |
| 306 | else { | |
| 307 | //Ne w Record, perform ad d | |
| 308 | var vlc_crossR eferenceRe cord = new Object(); | |
| 309 | vlc_ crossRefer enceRecord .ftp_crmgu id = vlc_c rmUserGuid ; | |
| 310 | vlc_ crossRefer enceRecord .ftp_vista duz = vlc_ viaUserIen ; | |
| 311 | vlc_ crossRefer enceRecord .ftp_vista username = vlc_viaUs erName; | |
| 312 | vlc_ crossRefer enceRecord .ftp_crmus er = { Id: vlc_crmUs erGuid, Lo gicalName: "systemus er", Name: vlc_crmUs erName }; | |
| 313 | vlc_ crossRefer enceRecord .ftp_name = "CROSS R EFERENCE - " + vlc_c rmUserName ; | |
| 314 | vlc_ crossRefer enceRecord .ftp_lastv ialogin = new Date() ; | |
| 315 | ||
| 316 | //ma ke it a js on object | |
| 317 | var jsonEntity = JSON.st ringify(vl c_crossRef erenceReco rd); | |
| 318 | ||
| 319 | $.aj ax({ | |
| 320 | type: "POS T", | |
| 321 | contentTyp e: "applic ation/json ; charset= utf-8", | |
| 322 | datatype: "json", | |
| 323 | url: vlc_s erverUrl + vlc_crmOd ataEndPoin t + "/" + 'ftp_useri dSet', | |
| 324 | data: json Entity, | |
| 325 | beforeSend : function (XMLHttpR equest) { | |
| 326 | XMLHtt pRequest.s etRequestH eader('Acc ept', 'app lication/j son'); | |
| 327 | }, | |
| 328 | success: f unction (t extStatus, XmlHttpRe quest) { | |
| 329 | //aler t("The Vis ta User Cr oss Refere nce Record was added successfu lly."); | |
| 330 | }, | |
| 331 | error: fun ction (Xml HttpReques t, textSta tus, error Thrown) { | |
| 332 | alert( 'Ajax Erro r in Addin g a Vista User Cross Reference Record: ' + errorTh rown); | |
| 333 | } | |
| 334 | }); | |
| 335 | } | |
| 336 | } | |
| 337 | } | |
| 338 | catch (err) { | |
| 339 | al ert('VistA Login Con trol Web R esource Fu nction Err or(vlc_upd ateCrossRe ference): ' + err.me ssage); | |
| 340 | } | |
| 341 | } | |
| 342 | ||
| 343 | ||
| 344 | function v lc_execute CrmOdataGe tRequest(v lc_jsonQue ry, vlc_aS ync, vlc_a SyncCallba ck, vlc_sk ipCount, v lc_optionA rray) { | |
| 345 | //This function executes a CRM Odata web servi ce call to retrieve Crm data | |
| 346 | //*vlc _jsonQuery * - a prop erly forma tted CRM O data Query string (r equired) | |
| 347 | //*vlc _aSync* - specify 't rue' to ex ecute asyn chronously otherwise 'false' ( required) | |
| 348 | //*vlc _aSyncCall back* - sp ecify the name of th e return f unction to call upon completio n (require d if vlc_a Sync = tru e. Otherw ise '') | |
| 349 | //*vlc _skipCount * - Initia l setting is always '0', incre ments by 5 0 per CRM SDK Odata standards (required) | |
| 350 | //*vlc _optionArr ay* - is a n optional array or single val ue, that c ontains ad ditional t ask specif ic variabl es that ca n be passe d between functions (pass 'nul l' if not used) | |
| 351 | try { | |
| 352 | va r vlc_enti tyData = n ull; | |
| 353 | $. ajax({ | |
| 354 | type: 'G ET', | |
| 355 | contentT ype: 'appl ication/js on; charse t=utf-8', | |
| 356 | datatype : 'json', | |
| 357 | url: vlc _jsonQuery , | |
| 358 | beforeSe nd: functi on (XMLHtt pRequest) { | |
| 359 | XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json'); | |
| 360 | }, | |
| 361 | success: function (data, tex tStatus, X mlHttpRequ est) { | |
| 362 | vlc_ entityData = data; | |
| 363 | if ( vlc_aSync == true) { | |
| 364 | vlc_aSyncC allback(vl c_entityDa ta, vlc_sk ipCount, v lc_optionA rray); | |
| 365 | } | |
| 366 | }, | |
| 367 | error: f unction (X MLHttpRequ est, textS tatus, err orThrown) { | |
| 368 | aler t('Fail: A jax Error in vlc_exe cuteCrmOda taGetReque st: ' + er rorThrown + " Reques t: " + vlc _jsonQuery ); | |
| 369 | }, | |
| 370 | async: v lc_aSync, | |
| 371 | cache: f alse | |
| 372 | }) ; | |
| 373 | re turn vlc_e ntityData; | |
| 374 | } | |
| 375 | catch (err) { | |
| 376 | al ert('An er ror occure d in the v lc_execute CrmOdataGe tRequest f unction. Error Deta il Message : ' + err) ; | |
| 377 | } | |
| 378 | } | |
| 379 | ||
| 380 | function v lc_getMult ipleEntity DataAsync( vlc_entity SetName, v lc_attribu teSet, vlc _condition alFilter, vlc_sortAt tribute, v lc_sortDir ection, vl c_skipCoun t, vlc_aSy ncCallback , vlc_opti onArray) { | |
| 381 | //This function returns a CRM JSON d ataset for all entit y records matching c riteria pr ovided Asy ncronously | |
| 382 | //*vlc _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |
| 383 | //*vlc _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |
| 384 | //*vlc _condition alFilter* - is the c onditional filter va lue placed on the da ta values retrived e .g. 'State Code/Value eq 0' to retrieve active con tact recor ds only | |
| 385 | //*vlc _sortAttri bute* - is a string containing the name of the att ribute to sort the r esult set by e.g. 'L astName' | |
| 386 | //*vlc _sortDirec tion* - is a string specifying the sort as Ascendi ng or Desc ending e.g . 'asc' or 'desc' | |
| 387 | //*vlc _skipCount * - is the starting point in t he result (use if mo re than 50 ), (Put 0 if not use d) | |
| 388 | //*vlc _aSyncCall back* - is the name of the fun ction to c all when r eturning t he result | |
| 389 | //*vlc _optionArr ay* - is a n optional array, th at contain s addition al task sp ecific var iables tha t can be p assed betw een functi ons | |
| 390 | ||
| 391 | try { | |
| 392 | va r vlc_json Query = vl c_serverUr l + vlc_cr mOdataEndP oint + '/' + vlc_ent itySetName + '?$sele ct=' + vlc _attribute Set + '&$f ilter=' + vlc_condit ionalFilte r + '&$ord erby=' + v lc_sortAtt ribute + ' ' + vlc_s ortDirecti on + '&$sk ip=' + vlc _skipCount ; | |
| 393 | vl c_executeC rmOdataGet Request(vl c_jsonQuer y, true, v lc_aSyncCa llback, vl c_skipCoun t, vlc_opt ionArray); | |
| 394 | } | |
| 395 | catch (err) { | |
| 396 | al ert('An er ror occure d in the v lc_getMult ipleEntity DataAsync function. Error Det ail Messag e: ' + err ); | |
| 397 | } | |
| 398 | } | |
| 399 | ||
| 400 | function v lc_getMult ipleEntity DataSync(v lc_entityS etName, vl c_attribut eSet, vlc_ conditiona lFilter, v lc_sortAtt ribute, vl c_sortDire ction, vlc _skipCount ) { | |
| 401 | //This function returns a CRM JSON d ataset for all entit y records matching c riteria pr ovided Syn cronously | |
| 402 | //*vlc _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |
| 403 | //*vlc _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |
| 404 | //*vlc _condition alFilter* - is the c onditional filter va lue placed on the da ta values retrived e .g. 'State Code/Value eq 0' to retrieve active con tact recor ds only | |
| 405 | //*vlc _sortAttri bute* - is a string containing the name of the att ribute to sort the r esult set by e.g. 'L astName' | |
| 406 | //*vlc _sortDirec tion* - is a string specifying the sort as Ascendi ng or Desc ending e.g . 'asc' or 'desc' | |
| 407 | //*vlc _skipCount * - is the starting point in t he result (use if mo re than 50 ), (Put 0 if not use d) | |
| 408 | ||
| 409 | try { | |
| 410 | va r vlc_json Query = vl c_serverUr l + vlc_cr mOdataEndP oint + '/' + vlc_ent itySetName + '?$sele ct=' + vlc _attribute Set + '&$f ilter=' + vlc_condit ionalFilte r + '&$ord erby=' + v lc_sortAtt ribute + ' ' + vlc_s ortDirecti on + '&$sk ip=' + vlc _skipCount ; | |
| 411 | va r vlc_enti tyData = v lc_execute CrmOdataGe tRequest(v lc_jsonQue ry, false, '', vlc_s kipCount, null); | |
| 412 | re turn vlc_e ntityData; | |
| 413 | } | |
| 414 | catch (err) { | |
| 415 | al ert('An er ror occure d in the v lc_getMult ipleEntity DataSync f unction. Error Deta il Message : ' + err) ; | |
| 416 | } | |
| 417 | } | |
| 418 | ||
| 419 | function v lc_getSing leEntityDa taSync(vlc _entitySet Name, vlc_ attributeS et, vlc_en tityId) { | |
| 420 | //This function returns a CRM JSON d ataset for a single entity rec ord based on the ent ity id pro vided Sync ronously | |
| 421 | //*vlc _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |
| 422 | //*vlc _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |
| 423 | //*vlc _entityId* - is the Guid for t he entity record | |
| 424 | ||
| 425 | try { | |
| 426 | va r vlc_enti tyIdNoBrac ket = vlc_ entityId.r eplace(/({ |})/g, '') ; | |
| 427 | va r vlc_sele ctString = '(guid' + "'" + vlc _entityIdN oBracket + "'" + ')? $select=' + vlc_attr ibuteSet; | |
| 428 | va r vlc_json Query = vl c_serverUr l + vlc_cr mOdataEndP oint + '/' + vlc_ent itySetName + vlc_sel ectString; | |
| 429 | va r vlc_enti tyData = v lc_execute CrmOdataGe tRequest(v lc_jsonQue ry, false, '', 0, nu ll); | |
| 430 | re turn vlc_e ntityData; | |
| 431 | } | |
| 432 | catch (err) { | |
| 433 | al ert('An er ror occure d in the v lc_getSing leEntityDa taSync fun ction. Er ror Detail Message: ' + err); | |
| 434 | } | |
| 435 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.