Produced by Araxis Merge on 5/9/2017 12:02:40 PM Eastern Daylight 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 | Tue May 9 16:02:40 2017 UTC | ||
| 2 | OSCIF_HEC_v1.4_Sprint23_build4_Apr_2017.zip\CRM_solutions\Archive\HRC\deploy\HRC.zip\WebResources | hrc_CorrespondenceAddressSelectorjsCorrespondenceA2E9A78AC-95C3-E511-9414-0050568DC724 | Mon Mar 21 17:25:14 2016 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 442 |
| 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 | /// <refer ence path= '../../tri ipcrm_/TR_ KU_V2015_2 _902/js/ke ndo.all.mi n.js' /> | |||||
| 3 | ||||||
| 4 | //Correspo ndenceAddr essSelecto rScriptLib .js | |||||
| 5 | //Contains variables and funct ions used by the Cor respondenc eAddressSe lector.htm l page | |||||
| 6 | ||||||
| 7 | //Static V ariables | |||||
| 8 | var cas_cr mOdataEndP oint = '/X RMServices /2011/Orga nizationDa ta.svc'; | |||||
| 9 | var cas_ve teranId = null; | |||||
| 10 | var cas_co ntext = Ge tGlobalCon text(); | |||||
| 11 | var cas_se rverUrl = cas_contex t.getClien tUrl(); | |||||
| 12 | var cas_cr mEntityId = window.p arent.Xrm. Page.data. entity.get Id(); | |||||
| 13 | cas_crmEnt ityId = ca s_reformat CrmGuid(ca s_crmEntit yId); | |||||
| 14 | var cas_cr mEntityTyp eName = wi ndow.paren t.Xrm.Page .data.enti ty.getEnti tyName(); | |||||
| 15 | var cas_ch eckedIds = {}; | |||||
| 16 | ||||||
| 17 | function c as_FormLoa d() { | |||||
| 18 | try { | |||||
| 19 | // Get the Ve teran Id ( contactid) from the parent for m | |||||
| 20 | if (parent.X rm.Page.ge tAttribute ('hrc_vete ranid').ge tValue() ! = null) { | |||||
| 21 | cas_vete ranId = ca s_reformat CrmGuid(pa rent.Xrm.P age.getAtt ribute('hr c_veterani d').getVal ue()[0].id ); | |||||
| 22 | } | |||||
| 23 | if (cas_vete ranId == n ull) { | |||||
| 24 | //No vet eran selec ted | |||||
| 25 | cas_dela yFormLoadE vent(); | |||||
| 26 | return f alse; | |||||
| 27 | } | |||||
| 28 | ||||||
| 29 | // Proceed to grid data load.... | |||||
| 30 | ca s_createAd dressSelec torGrid(); | |||||
| 31 | } | |||||
| 32 | catch (err) { | |||||
| 33 | al ert("Corre spondence Address Se lector Web Resource Function E rror(cas_F ormLoad): " + err.me ssage); | |||||
| 34 | } | |||||
| 35 | } | |||||
| 36 | ||||||
| 37 | function c as_delayFo rmLoadEven t() { | |||||
| 38 | try { | |||||
| 39 | se tTimeout(f unction () { | |||||
| 40 | //Wait 2 seconds a nd retry F orm Load f unction to check for Veteran I d | |||||
| 41 | cas_Form Load(); | |||||
| 42 | }, 2000); | |||||
| 43 | } | |||||
| 44 | catch (err) { | |||||
| 45 | al ert("Corre spondence Address Se lector Web Resource Function E rror(cas_d elayFormLo adEvent): " + err.me ssage); | |||||
| 46 | } | |||||
| 47 | } | |||||
| 48 | ||||||
| 49 | function c as_createA ddressSele ctorGrid() { | |||||
| 50 | try { | |||||
| 51 | $( '#ku_addre ssselector grid').ken doGrid({ | |||||
| 52 | columns: [ | |||||
| 53 | { field: 'ID', typ e: 'string ', hidden: true }, | |||||
| 54 | { field: 'Primary' , title: ' Primary', type: 'boo lean', tem plate: '<i nput type= "checkbox" #= Primar y ? "check ed=checked " : "" # d isabled="d isabled" />', width : 70 }, | |||||
| 55 | { field: 'Mailing' , title: ' Mailing', type: 'boo lean', tem plate: '<i nput type= "checkbox" #= Mailin g ? "check ed=checked " : "" # d isabled="d isabled" />', width : 70 }, | |||||
| 56 | { field: 'Address' , title: ' Address', type: 'str ing', widt h: 300 }, | |||||
| 57 | { field: 'Street1' , title: ' Street1', type: 'str ing', widt h: 120, hi dden: true }, | |||||
| 58 | { field: 'Street2' , title: ' Street2', type: 'str ing', widt h: 120, hi dden: true }, | |||||
| 59 | { field: 'Street3' , title: ' Street3', type: 'str ing', widt h: 120, hi dden: true }, | |||||
| 60 | { field: 'City', t itle: 'Cit y', type: 'string', width: 120 , hidden: true }, | |||||
| 61 | { field: 'StateCod e', title: 'StateCod e', type: 'integer', width: 12 0, hidden: true }, | |||||
| 62 | { field: 'StateNam e', title: 'StateNam e', type: 'string', width: 120 , hidden: true }, | |||||
| 63 | { field: 'PostalCo de', title : 'PostalC ode', type : 'string' , width: 1 20, hidden : true }, | |||||
| 64 | { field: 'CountryC ode', titl e: 'Countr yCode', ty pe: 'integ er', width : 120, hid den: true }, | |||||
| 65 | { field: 'CountryN ame', titl e: 'Countr yName', ty pe: 'strin g', width: 120, hidd en: true } , | |||||
| 66 | { field: 'Title', title: 'Ti tle', type : 'string' , width: 1 20 } | |||||
| 67 | ], | |||||
| 68 | dataSour ce: { | |||||
| 69 | sche ma: { | |||||
| 70 | model: { | |||||
| 71 | id: 'I D' | |||||
| 72 | } | |||||
| 73 | } | |||||
| 74 | }, | |||||
| 75 | groupabl e: false, | |||||
| 76 | sortable : false, | |||||
| 77 | editable : false, | |||||
| 78 | height: 170, | |||||
| 79 | resizabl e: true, | |||||
| 80 | navigata ble: true, | |||||
| 81 | selectab le: "row", | |||||
| 82 | noRecord s: true, | |||||
| 83 | change: cas_select GridRow | |||||
| 84 | }) ; | |||||
| 85 | ||||||
| 86 | // Populate A ddress Gri d | |||||
| 87 | va r cas_addr essSelecto rGrid = $( '#ku_addre ssselector grid').dat a('kendoGr id'); | |||||
| 88 | ca s_getCrmCo ntactAddre ssData(cas _addressSe lectorGrid ); | |||||
| 89 | } | |||||
| 90 | catch (err) { | |||||
| 91 | al ert('Addre ss Selecto r Script F ailure: Fu nction(cas _createAdd ressSelect orGrid) Er ror Detail : ' + err. message); | |||||
| 92 | re turn null; | |||||
| 93 | } | |||||
| 94 | } | |||||
| 95 | ||||||
| 96 | function c as_getCrmC ontactAddr essData(ca s_addressS electorCon trol) { | |||||
| 97 | try { | |||||
| 98 | va r cas_attr ibuteSet = 'ContactI d, Address 1_Line1, A ddress1_Li ne2, Addre ss1_Line3, Address1_ City, bah_ address1_s tate_code, ' + | |||||
| 99 | 'A ddress1_Po stalCode, bah_addres s1_country _code, hrc _address1_ isprimary_ bool, hrc_ address1_i smailing_b ool, ' + | |||||
| 100 | 'A ddress2_Li ne1, Addre ss2_Line2, Address2_ Line3, Add ress2_City , bah_addr ess2_state _code, Add ress2_Post alCode, ' + | |||||
| 101 | 'b ah_address 2_country_ code, hrc_ address2_i sprimary_b ool, hrc_a ddress2_is mailing_bo ol'; | |||||
| 102 | va r cas_cont actData = cas_getSin gleEntityD ataSync('C ontactSet' , cas_attr ibuteSet , cas_veter anId); | |||||
| 103 | if (cas_cont actData != null) { | |||||
| 104 | //Extrac t data ret rieved | |||||
| 105 | if (cas_ contactDat a.d.Contac tId != nul l) { | |||||
| 106 | var cas_addres s1 = ''; | |||||
| 107 | var cas_addr1_ line1 = nu ll; | |||||
| 108 | var cas_addr1_ line2 = nu ll; | |||||
| 109 | var cas_addr1_ line3 = nu ll; | |||||
| 110 | var cas_addr1_ city = nul l; | |||||
| 111 | var cas_addr1_ statecode = null; | |||||
| 112 | var cas_addr1_ statename = null; | |||||
| 113 | var cas_addr1_ postalcode = null; | |||||
| 114 | var cas_addr1_ countrycod e = null; | |||||
| 115 | var cas_addr1_ countrynam e = null; | |||||
| 116 | var cas_addr1_ isprimary = null; | |||||
| 117 | var cas_addr1_ ismailing = null; | |||||
| 118 | ||||||
| 119 | var cas_addres s2 = ''; | |||||
| 120 | var cas_addr2_ line1 = nu ll; | |||||
| 121 | var cas_addr2_ line2 = nu ll; | |||||
| 122 | var cas_addr2_ line3 = nu ll; | |||||
| 123 | var cas_addr2_ city = nul l; | |||||
| 124 | var cas_addr2_ statecode = null; | |||||
| 125 | var cas_addr2_ statename = null; | |||||
| 126 | var cas_addr2_ postalcode = null; | |||||
| 127 | var cas_addr2_ countrycod e = null; | |||||
| 128 | var cas_addr2_ countrynam e = null; | |||||
| 129 | var cas_addr2_ isprimary = null; | |||||
| 130 | var cas_addr2_ ismailing = null; | |||||
| 131 | ||||||
| 132 | //Ge t Address 1 info | |||||
| 133 | if ( cas_contac tData.d.Ad dress1_Lin e1 != null ) { cas_ad dr1_line1 = cas_cont actData.d. Address1_L ine1; } | |||||
| 134 | if ( cas_contac tData.d.Ad dress1_Lin e2 != null ) { cas_ad dr1_line2 = cas_cont actData.d. Address1_L ine2; } | |||||
| 135 | if ( cas_contac tData.d.Ad dress1_Lin e3 != null ) { cas_ad dr1_line3 = cas_cont actData.d. Address1_L ine3; } | |||||
| 136 | if ( cas_contac tData.d.Ad dress1_Cit y != null) { cas_add r1_city = cas_contac tData.d.Ad dress1_Cit y; } | |||||
| 137 | if ( cas_contac tData.d.ba h_address1 _state_cod e != null) { | |||||
| 138 | cas_addr1_ statecode = cas_cont actData.d. bah_addres s1_state_c ode.Value; | |||||
| 139 | if (cas_ad dr1_statec ode != nul l) { | |||||
| 140 | cas_ad dr1_staten ame = pare nt.Xrm.Pag e.getAttri bute('hrc_ state_code ').getOpti on(cas_add r1_stateco de).text; | |||||
| 141 | } | |||||
| 142 | } | |||||
| 143 | if ( cas_contac tData.d.Ad dress1_Pos talCode != null) { c as_addr1_p ostalcode = cas_cont actData.d. Address1_P ostalCode; } | |||||
| 144 | if ( cas_contac tData.d.ba h_address1 _country_c ode != nul l) { | |||||
| 145 | cas_addr1_ countrycod e = cas_co ntactData. d.bah_addr ess1_count ry_code.Va lue; | |||||
| 146 | if (cas_ad dr1_countr ycode != n ull) { | |||||
| 147 | cas_ad dr1_countr yname = pa rent.Xrm.P age.getAtt ribute('hr c_country_ code').get Option(cas _addr1_cou ntrycode). text; | |||||
| 148 | } | |||||
| 149 | } | |||||
| 150 | if ( cas_contac tData.d.hr c_address1 _isprimary _bool != n ull) { cas _addr1_isp rimary = c as_contact Data.d.hrc _address1_ isprimary_ bool; } | |||||
| 151 | if ( cas_contac tData.d.hr c_address1 _ismailing _bool != n ull) { cas _addr1_ism ailing = c as_contact Data.d.hrc _address1_ ismailing_ bool; } | |||||
| 152 | ||||||
| 153 | //Ge t Address 2 info | |||||
| 154 | if ( cas_contac tData.d.Ad dress2_Lin e1 != null ) { cas_ad dr2_line1 = cas_cont actData.d. Address2_L ine1; } | |||||
| 155 | if ( cas_contac tData.d.Ad dress2_Lin e2 != null ) { cas_ad dr2_line2 = cas_cont actData.d. Address2_L ine2; } | |||||
| 156 | if ( cas_contac tData.d.Ad dress2_Lin e3 != null ) { cas_ad dr2_line3 = cas_cont actData.d. Address2_L ine3; } | |||||
| 157 | if ( cas_contac tData.d.Ad dress2_Cit y != null) { cas_add r2_city = cas_contac tData.d.Ad dress2_Cit y; } | |||||
| 158 | if ( cas_contac tData.d.ba h_address2 _state_cod e != null) { | |||||
| 159 | cas_addr2_ statecode = cas_cont actData.d. bah_addres s2_state_c ode.Value; | |||||
| 160 | if (cas_ad dr2_statec ode != nul l) { | |||||
| 161 | cas_ad dr2_staten ame = pare nt.Xrm.Pag e.getAttri bute('hrc_ state_code ').getOpti on(cas_add r2_stateco de).text; | |||||
| 162 | } | |||||
| 163 | } | |||||
| 164 | if ( cas_contac tData.d.Ad dress2_Pos talCode != null) { c as_addr2_p ostalcode = cas_cont actData.d. Address2_P ostalCode; } | |||||
| 165 | if ( cas_contac tData.d.ba h_address2 _country_c ode != nul l) { | |||||
| 166 | cas_addr2_ countrycod e = cas_co ntactData. d.bah_addr ess2_count ry_code.Va lue; | |||||
| 167 | if (cas_ad dr2_countr ycode != n ull) { | |||||
| 168 | cas_ad dr2_countr yname = pa rent.Xrm.P age.getAtt ribute('hr c_country_ code').get Option(cas _addr2_cou ntrycode). text; | |||||
| 169 | } | |||||
| 170 | } | |||||
| 171 | if ( cas_contac tData.d.hr c_address2 _isprimary _bool != n ull) { cas _addr2_isp rimary = c as_contact Data.d.hrc _address2_ isprimary_ bool; } | |||||
| 172 | if ( cas_contac tData.d.hr c_address2 _ismailing _bool != n ull) { cas _addr2_ism ailing = c as_contact Data.d.hrc _address2_ ismailing_ bool; } | |||||
| 173 | ||||||
| 174 | //Co nstruct Ad dress 1 | |||||
| 175 | if ( cas_addr1_ line1 != n ull) { cas _address1 = cas_addr ess1 + cas _addr1_lin e1; } | |||||
| 176 | if ( cas_addr1_ line2 != n ull) { if (cas_addre ss1 == '') { cas_add ress1 = ca s_address1 + cas_add r1_line2; } else { c as_address 1 = cas_ad dress1 + ' ' + cas_ addr1_line 2; } } | |||||
| 177 | if ( cas_addr1_ city != nu ll) { if ( cas_addres s1 == '') { cas_addr ess1 = cas _address1 + cas_addr 1_city + ' ,'; } else { cas_add ress1 = ca s_address1 + ' ' + cas_addr1_ city + ',' ; } } | |||||
| 178 | if ( cas_addr1_ statename != null) { if (cas_a ddress1 == '') { cas _address1 = cas_addr ess1 + cas _addr1_sta tename; } else { cas _address1 = cas_addr ess1 + ' ' + cas_add r1_statena me; } } | |||||
| 179 | if ( cas_addr1_ postalcode != null) { if (cas_ address1 = = '') { ca s_address1 = cas_add ress1 + ca s_addr1_po stalcode; } else { c as_address 1 = cas_ad dress1 + ' ' + cas_a ddr1_posta lcode; } } | |||||
| 180 | if ( cas_addr1_ countrynam e != null) { if (cas _address1 == '') { c as_address 1 = cas_ad dress1 + c as_addr1_c ountryname ; } else { cas_addre ss1 = cas_ address1 + ' ' + cas _addr1_cou ntryname; } } | |||||
| 181 | ||||||
| 182 | //Co nstruct Ad dress 2 | |||||
| 183 | if ( cas_addr2_ line1 != n ull) { cas _address2 = cas_addr ess2 + cas _addr2_lin e1; } | |||||
| 184 | if ( cas_addr2_ line2 != n ull) { if (cas_addre ss2 == '') { cas_add ress2 = ca s_address2 + cas_add r2_line2; } else { c as_address 2 = cas_ad dress2 + ' ' + cas_ addr2_line 2; } } | |||||
| 185 | if ( cas_addr2_ city != nu ll) { if ( cas_addres s2 == '') { cas_addr ess2 = cas _address2 + cas_addr 2_city + ' ,'; } else { cas_add ress2 = ca s_address2 + ' ' + c as_addr2_c ity + ','; } } | |||||
| 186 | if ( cas_addr2_ statename != null) { if (cas_a ddress2 == '') { cas _address2 = cas_addr ess2 + cas _addr2_sta tename; } else { cas _address2 = cas_addr ess2 + ' ' + cas_add r2_statena me; } } | |||||
| 187 | if ( cas_addr2_ postalcode != null) { if (cas_ address2 = = '') { ca s_address2 = cas_add ress2 + ca s_addr2_po stalcode; } else { c as_address 2 = cas_ad dress2 + ' ' + cas_a ddr2_posta lcode; } } | |||||
| 188 | if ( cas_addr2_ countrynam e != null) { if (cas _address2 == '') { c as_address 2 = cas_ad dress2 + c as_addr2_c ountryname ; } else { cas_addre ss2 = cas_ address2 + ' ' + cas _addr2_cou ntryname; } } | |||||
| 189 | ||||||
| 190 | //De termine if Address 1 info shou ld be adde d | |||||
| 191 | if ( cas_addr1_ line1 != n ull || cas _addr1_lin e2 != null ) { | |||||
| 192 | cas_addres sSelectorC ontrol.dat aSource.pu shCreate({ | |||||
| 193 | ID: '0 1', | |||||
| 194 | Primar y: cas_add r1_isprima ry, | |||||
| 195 | Mailin g: cas_add r1_ismaili ng, | |||||
| 196 | Addres s: cas_add ress1, | |||||
| 197 | Street 1: cas_add r1_line1, | |||||
| 198 | Street 2: cas_add r1_line2, | |||||
| 199 | Street 3: cas_add r1_line3, | |||||
| 200 | City: cas_addr1_ city, | |||||
| 201 | StateC ode: cas_a ddr1_state code, | |||||
| 202 | StateN ame: cas_a ddr1_state name, | |||||
| 203 | Postal Code: cas_ addr1_post alcode, | |||||
| 204 | Countr yCode: cas _addr1_cou ntrycode, | |||||
| 205 | Countr yName: cas _addr1_cou ntryname, | |||||
| 206 | Title: 'Address 1' | |||||
| 207 | }); | |||||
| 208 | } | |||||
| 209 | ||||||
| 210 | //De termine if Address 2 info shou ld be adde d | |||||
| 211 | if ( cas_addr2_ line1 != n ull || cas _addr2_lin e2 != null ) { | |||||
| 212 | cas_addres sSelectorC ontrol.dat aSource.pu shCreate({ | |||||
| 213 | ID: '0 2', | |||||
| 214 | Primar y: cas_add r2_isprima ry, | |||||
| 215 | Mailin g: cas_add r2_ismaili ng, | |||||
| 216 | Addres s: cas_add ress2, | |||||
| 217 | Street 1: cas_add r2_line1, | |||||
| 218 | Street 2: cas_add r2_line2, | |||||
| 219 | Street 3: cas_add r2_line3, | |||||
| 220 | City: cas_addr2_ city, | |||||
| 221 | StateC ode: cas_a ddr2_state code, | |||||
| 222 | StateN ame: cas_a ddr2_state name, | |||||
| 223 | Postal Code: cas_ addr2_post alcode, | |||||
| 224 | Countr yCode: cas _addr2_cou ntrycode, | |||||
| 225 | Countr yName: cas _addr2_cou ntryname, | |||||
| 226 | Title: 'Address 2' | |||||
| 227 | }); | |||||
| 228 | } | |||||
| 229 | } | |||||
| 230 | } | |||||
| 231 | ||||||
| 232 | // Get additi onal Addre ss Entity Data for t his vetera n | |||||
| 233 | ca s_getCrmAd dressEntit yData(0, c as_address SelectorCo ntrol); | |||||
| 234 | } | |||||
| 235 | catch (err) { | |||||
| 236 | al ert('Addre ss Selecto r Script F ailure: Fu nction(cas _getCrmCon tactAddres sData) Err or Detail: ' + err.m essage); | |||||
| 237 | re turn null; | |||||
| 238 | } | |||||
| 239 | } | |||||
| 240 | ||||||
| 241 | function c as_getCrmA ddressEnti tyData(cas _skipCount , cas_addr essSelecto rControl) { | |||||
| 242 | try { | |||||
| 243 | va r cas_cond itionalFil ter = '(Pa rentId/Id eq (guid' + "'" + ca s_veteranI d + "'" + ') and Obj ectTypeCod e eq ' + " 'contact'" + ' and A ddressNumb er ge 4)'; | |||||
| 244 | ca s_getMulti pleEntityD ataAsync(' CustomerAd dressSet', 'Customer AddressId, Name, Lin e1, Line2, Line3, Ci ty, bah_st ate_code, PostalCode , bah_coun try_code, hrc_isprim ary_bool, hrc_ismail ing_bool', cas_condi tionalFilt er, 'Addre ssNumber', 'asc', ca s_skipCoun t, cas_get CrmAddress EntityData _response, cas_addre ssSelector Control); | |||||
| 245 | } | |||||
| 246 | catch (err) { | |||||
| 247 | al ert('Addre ss Selecto r Script F ailure: Fu nction(cas _getCrmAdd ressEntity Data) Erro r Detail: ' + err.me ssage); | |||||
| 248 | re turn null; | |||||
| 249 | } | |||||
| 250 | } | |||||
| 251 | ||||||
| 252 | function c as_getCrmA ddressEnti tyData_res ponse(cas_ addressEnt ityData, c as_lastSki p, cas_add ressSelect orControl) { | |||||
| 253 | try { | |||||
| 254 | // cas_lastSk ip is the starting p oint in th e result ( use if mor e than 50 records) | |||||
| 255 | fo r (var i = 0; i <= c as_address EntityData .d.results .length - 1; i++) { | |||||
| 256 | var cas_ addressid = null; | |||||
| 257 | var cas_ addresstit le = null; | |||||
| 258 | var cas_ address1 = ''; | |||||
| 259 | var cas_ addr1_line 1 = null; | |||||
| 260 | var cas_ addr1_line 2 = null; | |||||
| 261 | var cas_ addr1_line 3 = null; | |||||
| 262 | var cas_ addr1_city = null; | |||||
| 263 | var cas_ addr1_stat ecode = nu ll; | |||||
| 264 | var cas_ addr1_stat ename = nu ll; | |||||
| 265 | var cas_ addr1_post alcode = n ull; | |||||
| 266 | var cas_ addr1_coun trycode = null; | |||||
| 267 | var cas_ addr1_coun tryname = null; | |||||
| 268 | var cas_ addr1_ispr imary = nu ll; | |||||
| 269 | var cas_ addr1_isma iling = nu ll; | |||||
| 270 | ||||||
| 271 | //Get Ad dress 1 in fo | |||||
| 272 | if (cas_ addressEnt ityData.d. results[i] .CustomerA ddressId ! = null) { cas_addres sid = cas_ addressEnt ityData.d. results[i] .CustomerA ddressId; } | |||||
| 273 | if (cas_ addressEnt ityData.d. results[i] .Name != n ull) { cas _addressti tle = cas_ addressEnt ityData.d. results[i] .Name; } | |||||
| 274 | if (cas_ addressEnt ityData.d. results[i] .Line1 != null) { ca s_addr1_li ne1 = cas_ addressEnt ityData.d. results[i] .Line1; } | |||||
| 275 | if (cas_ addressEnt ityData.d. results[i] .Line2 != null) { ca s_addr1_li ne2 = cas_ addressEnt ityData.d. results[i] .Line2; } | |||||
| 276 | ||||||
| 277 | if (cas_ addressEnt ityData.d. results[i] .Line3 != null) { ca s_addr1_li ne3 = cas_ addressEnt ityData.d. results[i] .Line3; } | |||||
| 278 | if (cas_ addressEnt ityData.d. results[i] .City != n ull) { cas _addr1_cit y = cas_ad dressEntit yData.d.re sults[i].C ity; } | |||||
| 279 | if (cas_ addressEnt ityData.d. results[i] .bah_state _code != n ull) { | |||||
| 280 | cas_ addr1_stat ecode = ca s_addressE ntityData. d.results[ i].bah_sta te_code.Va lue; | |||||
| 281 | if ( cas_addr1_ statecode != null) { | |||||
| 282 | cas_addr1_ statename = parent.X rm.Page.ge tAttribute ('hrc_stat e_code').g etOption(c as_addr1_s tatecode). text; | |||||
| 283 | } | |||||
| 284 | } | |||||
| 285 | if (cas_ addressEnt ityData.d. results[i] .PostalCod e != null) { cas_add r1_postalc ode = cas_ addressEnt ityData.d. results[i] .PostalCod e; } | |||||
| 286 | if (cas_ addressEnt ityData.d. results[i] .bah_count ry_code != null) { | |||||
| 287 | cas_ addr1_coun trycode = cas_addres sEntityDat a.d.result s[i].bah_c ountry_cod e.Value; | |||||
| 288 | if ( cas_addr1_ countrycod e != null) { | |||||
| 289 | cas_addr1_ countrynam e = parent .Xrm.Page. getAttribu te('hrc_co untry_code ').getOpti on(cas_add r1_country code).text ; | |||||
| 290 | } | |||||
| 291 | } | |||||
| 292 | if (cas_ addressEnt ityData.d. results[i] .hrc_ispri mary_bool != null) { cas_addr1 _isprimary = cas_add ressEntity Data.d.res ults[i].hr c_isprimar y_bool; } | |||||
| 293 | if (cas_ addressEnt ityData.d. results[i] .hrc_ismai ling_bool != null) { cas_addr1 _ismailing = cas_add ressEntity Data.d.res ults[i].hr c_ismailin g_bool; } | |||||
| 294 | ||||||
| 295 | //Constr uct Addres s 1 | |||||
| 296 | if (cas_ addr1_line 1 != null) { cas_add ress1 = ca s_address1 + cas_add r1_line1; } | |||||
| 297 | if (cas_ addr1_line 2 != null) { if (cas _address1 == '') { c as_address 1 = cas_ad dress1 + c as_addr1_l ine2; } el se { cas_a ddress1 = cas_addres s1 + ' ' + cas_addr 1_line2; } } | |||||
| 298 | if (cas_ addr1_city != null) { if (cas_ address1 = = '') { ca s_address1 = cas_add ress1 + ca s_addr1_ci ty + ','; } else { c as_address 1 = cas_ad dress1 + ' ' + cas_ addr1_city + ','; } } | |||||
| 299 | if (cas_ addr1_stat ename != n ull) { if (cas_addre ss1 == '') { cas_add ress1 = ca s_address1 + cas_add r1_statena me; } else { cas_add ress1 = ca s_address1 + ' ' + c as_addr1_s tatename; } } | |||||
| 300 | if (cas_ addr1_post alcode != null) { if (cas_addr ess1 == '' ) { cas_ad dress1 = c as_address 1 + cas_ad dr1_postal code; } el se { cas_a ddress1 = cas_addres s1 + ' ' + cas_addr1 _postalcod e; } } | |||||
| 301 | if (cas_ addr1_coun tryname != null) { i f (cas_add ress1 == ' ') { cas_a ddress1 = cas_addres s1 + cas_a ddr1_count ryname; } else { cas _address1 = cas_addr ess1 + ' ' + cas_add r1_country name; } } | |||||
| 302 | ||||||
| 303 | //Determ ine if Add ress info should be added | |||||
| 304 | if (cas_ addr1_line 1 != null || cas_add r1_line2 ! = null) { | |||||
| 305 | cas_ addressSel ectorContr ol.dataSou rce.pushCr eate({ | |||||
| 306 | ID: cas_ad dressid, | |||||
| 307 | Primary: c as_addr1_i sprimary, | |||||
| 308 | Mailing: c as_addr1_i smailing, | |||||
| 309 | Address: c as_address 1, | |||||
| 310 | Street1: c as_addr1_l ine1, | |||||
| 311 | Street2: c as_addr1_l ine2, | |||||
| 312 | Street3: c as_addr1_l ine3, | |||||
| 313 | City: cas_ addr1_city , | |||||
| 314 | StateCode: cas_addr1 _statecode , | |||||
| 315 | StateName: cas_addr1 _statename , | |||||
| 316 | PostalCode : cas_addr 1_postalco de, | |||||
| 317 | CountryCod e: cas_add r1_country code, | |||||
| 318 | CountryNam e: cas_add r1_country name, | |||||
| 319 | Title: cas _addressti tle | |||||
| 320 | }); | |||||
| 321 | } | |||||
| 322 | } | |||||
| 323 | if (cas_addr essEntityD ata.d.__ne xt != null ) { | |||||
| 324 | cas_getC rmAddressE ntityData( cas_lastSk ip + 50, c as_address SelectorCo ntrol); | |||||
| 325 | } | |||||
| 326 | } | |||||
| 327 | catch (err) { | |||||
| 328 | al ert('Addre ss Selecto r Script F ailure: Fu nction(cas _getCrmAdd ressEntity Data_respo nse) Error Detail: ' + err.mes sage); | |||||
| 329 | re turn null; | |||||
| 330 | } | |||||
| 331 | } | |||||
| 332 | ||||||
| 333 | //Common S cript Func tions | |||||
| 334 | //******** ********** ********** ********** ********** ******** | |||||
| 335 | function c as_reforma tCrmGuid(c as_crmGuid ) { | |||||
| 336 | cas_cr mGuid = ca s_crmGuid. replace('% 7b', ''); | |||||
| 337 | cas_cr mGuid = ca s_crmGuid. replace('% 7d', ''); | |||||
| 338 | cas_cr mGuid = ca s_crmGuid. replace('{ ', ''); | |||||
| 339 | cas_cr mGuid = ca s_crmGuid. replace('} ', ''); | |||||
| 340 | return cas_crmGu id; | |||||
| 341 | } | |||||
| 342 | //******** ********** ********** ********** ********** ********* | |||||
| 343 | ||||||
| 344 | //Address Selector G rid Event Functions | |||||
| 345 | //******** ********** ********** ********** ********** ********* | |||||
| 346 | function c as_selectG ridRow(arg ) { | |||||
| 347 | try { | |||||
| 348 | va r cas_sele ctedRows = this.sele ct(); | |||||
| 349 | va r cas_sele ctedDataIt ems = []; | |||||
| 350 | fo r (var i = 0; i < ca s_selected Rows.lengt h; i++) { | |||||
| 351 | var cas_ dataItem = this.data Item(cas_s electedRow s[i]); | |||||
| 352 | //Write back selec ted data t o CRM pare nt form | |||||
| 353 | parent.X rm.Page.ge tAttribute ('hrc_line 1_text').s etValue(ca s_dataItem .Street1); | |||||
| 354 | parent.X rm.Page.ge tAttribute ('hrc_line 2_text').s etValue(ca s_dataItem .Street2); | |||||
| 355 | parent.X rm.Page.ge tAttribute ('hrc_city _text').se tValue(cas _dataItem. City); | |||||
| 356 | parent.X rm.Page.ge tAttribute ('hrc_stat e_code').s etValue(ca s_dataItem .StateCode ); | |||||
| 357 | parent.X rm.Page.ge tAttribute ('hrc_post alcode_tex t').setVal ue(cas_dat aItem.Post alCode); | |||||
| 358 | parent.X rm.Page.ge tAttribute ('hrc_coun try_code') .setValue( cas_dataIt em.Country Code); | |||||
| 359 | } | |||||
| 360 | } | |||||
| 361 | catch (err) { | |||||
| 362 | al ert("Corre spondence Address Se lector Web Resource Function E rror(cas_s electGridR ow): " + e rr.message ); | |||||
| 363 | } | |||||
| 364 | } | |||||
| 365 | //******** ********** ********** ********** ********** ********* | |||||
| 366 | ||||||
| 367 | //Crm Ajax Query Fun cions | |||||
| 368 | //******** ********** ********** ********** ********** ********* | |||||
| 369 | function c as_execute CrmOdataGe tRequest(c as_jsonQue ry, cas_aS ync, cas_a SyncCallba ck, cas_sk ipCount, c as_optionA rray) { | |||||
| 370 | //This function executes a CRM Odata web servi ce call to retrieve Crm data | |||||
| 371 | //*cas _jsonQuery * - a prop erly forma tted CRM O data Query string (r equired) | |||||
| 372 | //*cas _aSync* - specify 't rue' to ex ecute asyn chronously otherwise 'false' ( required) | |||||
| 373 | //*cas _aSyncCall back* - sp ecify the name of th e return f unction to call upon completio n (require d if cas_a Sync = tru e. Otherw ise '') | |||||
| 374 | //*cas _skipCount * - Initia l setting is always '0', incre ments by 5 0 per CRM SDK Odata standards (required) | |||||
| 375 | //*cas _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) | |||||
| 376 | try { | |||||
| 377 | va r cas_enti tyData = n ull; | |||||
| 378 | $. ajax({ | |||||
| 379 | type: 'G ET', | |||||
| 380 | contentT ype: 'appl ication/js on; charse t=utf-8', | |||||
| 381 | datatype : 'json', | |||||
| 382 | url: cas _jsonQuery , | |||||
| 383 | beforeSe nd: functi on (XMLHtt pRequest) { | |||||
| 384 | XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json'); | |||||
| 385 | }, | |||||
| 386 | success: function (data, tex tStatus, X mlHttpRequ est) { | |||||
| 387 | cas_ entityData = data; | |||||
| 388 | if ( cas_aSync == true) { | |||||
| 389 | cas_aSyncC allback(ca s_entityDa ta, cas_sk ipCount, c as_optionA rray); | |||||
| 390 | } | |||||
| 391 | }, | |||||
| 392 | error: f unction (X MLHttpRequ est, textS tatus, err orThrown) { | |||||
| 393 | aler t('Fail: A jax Error in cas_exe cuteCrmOda taGetReque st: ' + er rorThrown) ; | |||||
| 394 | }, | |||||
| 395 | async: c as_aSync, | |||||
| 396 | cache: f alse | |||||
| 397 | }) ; | |||||
| 398 | re turn cas_e ntityData; | |||||
| 399 | } | |||||
| 400 | catch (err) { | |||||
| 401 | al ert('An er ror occure d in the c as_execute CrmOdataGe tRequest f unction. Error Deta il Message : ' + err) ; | |||||
| 402 | } | |||||
| 403 | } | |||||
| 404 | ||||||
| 405 | function c as_getSing leEntityDa taSync(cas _entitySet Name, cas_ attributeS et, cas_en tityId) { | |||||
| 406 | //This function returns a CRM JSON d ataset for a single entity rec ord based on the ent ity id pro vided Sync ronously | |||||
| 407 | //*cas _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |||||
| 408 | //*cas _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |||||
| 409 | //*cas _entityId* - is the Guid for t he entity record | |||||
| 410 | ||||||
| 411 | try { | |||||
| 412 | va r cas_enti tyIdNoBrac ket = cas_ entityId.r eplace(/({ |})/g, '') ; | |||||
| 413 | va r cas_sele ctString = '(guid' + "'" + cas _entityIdN oBracket + "'" + ')? $select=' + cas_attr ibuteSet; | |||||
| 414 | va r cas_json Query = ca s_serverUr l + cas_cr mOdataEndP oint + '/' + cas_ent itySetName + cas_sel ectString; | |||||
| 415 | va r cas_enti tyData = c as_execute CrmOdataGe tRequest(c as_jsonQue ry, false, '', 0, nu ll); | |||||
| 416 | re turn cas_e ntityData; | |||||
| 417 | } | |||||
| 418 | catch (err) { | |||||
| 419 | al ert('An er ror occure d in the c as_getSing leEntityDa taSync fun ction. Er ror Detail Message: ' + err); | |||||
| 420 | } | |||||
| 421 | } | |||||
| 422 | ||||||
| 423 | function c as_getMult ipleEntity DataAsync( cas_entity SetName, c as_attribu teSet, cas _condition alFilter, cas_sortAt tribute, c as_sortDir ection, ca s_skipCoun t, cas_aSy ncCallback , cas_opti onArray) { | |||||
| 424 | //This function returns a CRM JSON d ataset for all entit y records matching c riteria pr ovided Asy ncronously | |||||
| 425 | //*cas _entitySet Name* - is the name of the ent ity set e. g 'Contact Set' | |||||
| 426 | //*cas _attribute Set* - is a string containing the Crm A ttributes to retriev e e.g. 'Fi rstName, L astName, T elephone1, EMailAddr ess1' | |||||
| 427 | //*cas _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 | |||||
| 428 | //*cas _sortAttri bute* - is a string containing the name of the att ribute to sort the r esult set by e.g. 'L astName' | |||||
| 429 | //*cas _sortDirec tion* - is a string specifying the sort as Ascendi ng or Desc ending e.g . 'asc' or 'desc' | |||||
| 430 | //*cas _skipCount * - is the starting point in t he result (use if mo re than 50 ), (Put 0 if not use d) | |||||
| 431 | //*cas _aSyncCall back* - is the name of the fun ction to c all when r eturning t he result | |||||
| 432 | //*cas _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 | |||||
| 433 | ||||||
| 434 | try { | |||||
| 435 | va r cas_json Query = ca s_serverUr l + cas_cr mOdataEndP oint + '/' + cas_ent itySetName + '?$sele ct=' + cas _attribute Set + '&$f ilter=' + cas_condit ionalFilte r + '&$ord erby=' + c as_sortAtt ribute + ' ' + cas_s ortDirecti on + '&$sk ip=' + cas _skipCount ; | |||||
| 436 | ca s_executeC rmOdataGet Request(ca s_jsonQuer y, true, c as_aSyncCa llback, ca s_skipCoun t, cas_opt ionArray); | |||||
| 437 | } | |||||
| 438 | catch (err) { | |||||
| 439 | al ert('An er ror occure d in the c as_getMult ipleEntity DataAsync function. Error Det ail Messag e: ' + err ); | |||||
| 440 | } | |||||
| 441 | } | |||||
| 442 | //******** ********** ********** ********** ********** ********* |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.