24. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 12/4/2017 8:32:30 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.

24.1 Files compared

# Location File Last Modified
1 VCCM.zip\VCCM\CRM_solutions\FTPResources\source\WebResources\ftp_\VistACPRSNote\js VistACPRSNoteButtonsScriptLib.js Thu Nov 30 12:26:44 2017 UTC
2 VCCM.zip\VCCM\CRM_solutions\FTPResources\source\WebResources\ftp_\VistACPRSNote\js VistACPRSNoteButtonsScriptLib.js Thu Nov 30 16:39:47 2017 UTC

24.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 622
Changed 1 2
Inserted 0 0
Removed 0 0

24.3 Comparison options

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

24.4 Active regular expressions

No regular expressions were active.

24.5 Comparison detail

  1   //VistACPR SNoteButto nsScriptLi b.js
  2   //Contains  variables  and funct ions used  by the Vis tACPRSNote Buttons.ht ml page
  3  
  4   //Static V ariables
  5   var vcnb_c rmOdataEnd Point = '/ XRMService s/2011/Org anizationD ata.svc';
  6   var vcnb_c ontext = G etGlobalCo ntext();
  7   var vcnb_s erverUrl =  vcnb_cont ext.getCli entUrl();
  8  
  9   var vcnb_N oteWriteUr l = 'https ://qacrmda c.np.crm.v rm.vba. DNS     /WebParts/ api/notesw rite';
  10  
  11   function v cnb_formLo ad() {
  12       try {
  13           // Initialize  content b ased on Re quest/Note  Status
  14  
  15           // Disable bu ttons if c ase is no  longer ope n
  16           if  (parent.X rm.Page.ge tAttribute ('statusco de').getVa lue() == 5  || parent .Xrm.Page. ui.getForm Type() ==  3 || paren t.Xrm.Page .getAttrib ute('ftp_i ntegration result').g etValue()  == 'OK') {
  17                document .getElemen tById('btn SaveOnly') .disabled  = true;
  18                document .getElemen tById('btn SaveToVist A').disabl ed = true;
  19           }
  20  
  21           // Set focus  to cancel  button if  PROGRESS N OTE SECTIO N is Visib le
  22           if  (parent.X rm.Page.ui .tabs.get( 'PROGRESSN OTE_TAB'). getVisible () == true ) {
  23                document .getElemen tById('btn Cancel').f ocus();
  24           }
  25       }
  26       catch  (err) {
  27           al ert('Vista  CPRS Note  Buttons F unction Er ror(vcnb_f ormLoad):  ' + err.me ssage);
  28       }
  29   }
  30  
  31   function v cnb_button Cancel() {
  32       try {
  33           // Set focus  to the mai n top tab  and hide c urrent tab
  34           pa rent.Xrm.P age.ui.tab s.get('gen eral').set Focus();
  35           pa rent.Xrm.P age.ui.tab s.get('PRO GRESSNOTE_ TAB').setV isible(fal se);
  36       }
  37       catch  (err) {
  38           al ert('Vista  CPRS Note  Buttons F unction Er ror(vcnb_b uttonCance l): ' + er r.message) ;
  39       }
  40   }
  41  
  42   function v cnb_button Save() {
  43       try {
  44           // Save the c urrent CRM  data
  45           pa rent.Xrm.P age.data.e ntity.save ();
  46           // Set focus  to the mai n top tab  and hide c urrent tab
  47           pa rent.Xrm.P age.ui.tab s.get('gen eral').set Focus();
  48           pa rent.Xrm.P age.ui.tab s.get('PRO GRESSNOTE_ TAB').setV isible(fal se);
  49       }
  50       catch  (err) {
  51           al ert('Vista  CPRS Note  Buttons F unction Er ror(vcnb_b uttonSave) : ' + err. message);
  52       }
  53   }
  54  
  55   function v cnb_button SaveToVist A() {
  56       try {
  57           // Save the c urrent CRM  data
  58           pa rent.Xrm.P age.data.e ntity.save ();
  59  
  60           // Get vetera n data
  61           va r vcnb_vet eranId = p arent.Xrm. Page.getAt tribute('c ustomerid' ).getValue ();
  62           if  (vcnb_vet eranId ==  null) {
  63                alert('T he current  request d oes not ha ve a veter an assigne d, the not e cannot b e created  in VistA/C PRS withou t a vetera n assigned !');
  64                document .getElemen tById('btn Cancel').f ocus();
  65                return f alse;
  66           }
  67  
  68           // Verify tha t the cust omerid is  of type co ntact
  69           if  (vcnb_vet eranId[0]. entityType  != 'conta ct') {
  70                alert('T he current  request h as an inva lid custom er type, i t must be  of the typ e veteran/ contact, t he note ca nnot be cr eated in V istA/CPRS! ');
  71                document .getElemen tById('btn Cancel').f ocus();
  72                return f alse;
  73           }
  74  
  75           // Get vetera n data
  76           // var vcnb_m emberId =  '';  //No  longer use d per Caro l Smock 2/ 23/16 (ftp _EDIPI) us e field be low instea d
  77           va r vcnb_pat ientICN =  '';  //Fro m the crm  contact en tity field  'tri_Vete ranID'
  78           va r vcnb_vet eranName =  '';
  79  
  80           va r vcnb_con tactData =  vcnb_getS ingleEntit yDataSync( 'ContactSe t', 'FullN ame, tri_V eteranID',  vcnb_vete ranId[0].i d);
  81           if  (vcnb_con tactData ! = null) {
  82                if (vcnb _contactDa ta.d.FullN ame != nul l) { vcnb_ veteranNam e = vcnb_c ontactData .d.FullNam e; }
  83                if (vcnb _contactDa ta.d.tri_V eteranID ! = null) {  vcnb_patie ntICN = vc nb_contact Data.d.tri _VeteranID ; }
  84           }
  85  
  86           // Verify Pat ient ICN
  87           if  (vcnb_pat ientICN ==  '' || vcn b_patientI CN == null ) {
  88                alert('T he assigne d veteran  does not h ave a pati ent ICN, t he note ca nnot be cr eated in V istA/CPRS! ');
  89                document .getElemen tById('btn Cancel').f ocus();
  90                return f alse;
  91           }
  92  
  93           // Get user d ata
  94           va r vcnb_crm UserId = v cnb_contex t.getUserI d();
  95           va r vcnb_use rDomainId  = '';
  96           va r vcnb_use rData = vc nb_getSing leEntityDa taSync('Sy stemUserSe t', 'Domai nName', vc nb_crmUser Id);
  97           if  (vcnb_use rData != n ull) {
  98                if (vcnb _userData. d.DomainNa me != null ) { vcnb_u serDomainI d = vcnb_u serData.d. DomainName ; }
  99           }
  100  
  101           // Get reques t form con tent
  102           va r vcnb_not eDescripti on = paren t.Xrm.Page .getAttrib ute('descr iption').g etValue();
  103           if  (vcnb_not eDescripti on == null  || vcnb_n oteDescrip tion == '' ) {
  104                alert('T he note de scription  field is e mpty, the  note canno t be creat ed in Vist A/CPRS!');
  105                document .getElemen tById('btn Cancel').f ocus();
  106                return f alse;
  107           }
  108           va r vcnb_loc alTitle =  parent.Xrm .Page.getA ttribute(' ftp_localt itle').get Value();   //Lookup
  109           if  (vcnb_loc alTitle ==  null) {
  110                alert('T he note lo cal title  field is e mpty, the  note canno t be creat ed in Vist A/CPRS!');
  111                document .getElemen tById('btn Cancel').f ocus();
  112                return f alse;
  113           }
  114           va r vcnb_cal lbackNumbe r = parent .Xrm.Page. getAttribu te('ftp_ca llbacknumb er').getVa lue();
  115           if  (vcnb_cal lbackNumbe r == null  || vcnb_ca llbackNumb er == '')  {
  116                alert('T he callbac k number f ield is em pty, the n ote cannot  be create d in VistA /CPRS!');
  117                document .getElemen tById('btn Cancel').f ocus();
  118                return f alse;
  119           }
  120           va r vcnb_rea sonForRequ est = pare nt.Xrm.Pag e.getAttri bute('ftp_ reasonforr equest').g etValue();   //Lookup
  121           if  (vcnb_rea sonForRequ est == nul l) {
  122                alert('T he reason  for reques t field is  empty, th e note can not be cre ated in Vi stA/CPRS!' );
  123                document .getElemen tById('btn Cancel').f ocus();
  124                return f alse;
  125           }
  126  
  127           // Prompt use r to confi rm save  ( Note: chan ged prompt  below, to  reflect U SD, where  form canno t be autom atically c losed)
  128           // var vcnb_c onfirmSave ToVista =  confirm('A re you sur e you want  to save t his note t o VistA/CP RS?\nThis  action can not be can celled!\n\ nUpon comp letion of  this proce ss, the re quest reco rd will au tomaticall y close!') ;
  129           va r vcnb_con firmSaveTo Vista = co nfirm('Are  you sure  you want t o save thi s note to  VistA/CPRS ?\nThis ac tion canno t be cance lled!\n\nU pon comple tion of th is process , the requ est record  will auto matically  be marked  as resolve d and you  will be pr ompted to  exit the r ecord!');
  130  
  131           if  (vcnb_con firmSaveTo Vista == f alse) {
  132                document .getElemen tById('btn Cancel').f ocus();
  133                return f alse;
  134           }
  135  
  136           va r vcnb_enc ounterCode  = parent. Xrm.Page.g etAttribut e('ftp_enc ountercode ').getValu e();
  137           if  (vcnb_enc ounterCode  == null)  { vcnb_enc ounterCode  = 'NEW';  }
  138           va r vcnb_sig nThisNote  = parent.X rm.Page.ge tAttribute ('ftp_sign thisnote') .getValue( );
  139           if  (vcnb_sig nThisNote  == 1000000 01) { vcnb _signThisN ote = true ; } else {  vcnb_sign ThisNote =  false; }
  140           va r vcnb_cre atedDateTi me = paren t.Xrm.Page .getAttrib ute('ftp_s tart').get Value();
  141  
  142           // Get Reques t/Note Gui d/Id
  143           va r vcnb_not eId = pare nt.Xrm.Pag e.data.ent ity.getId( );
  144  
  145           // Execute In tegration
  146           vc nb_execute VistAInteg rationRequ est(vcnb_n oteId, vcn b_noteDesc ription, v cnb_patien tICN, vcnb _userDomai nId, vcnb_ localTitle [0].name,  vcnb_callb ackNumber,  vcnb_reas onForReque st[0].name , vcnb_enc ounterCode , vcnb_sig nThisNote) ;
  147       }
  148       catch  (err) {
  149           al ert('Vista  CPRS Note  Buttons F unction Er ror(vcnb_b uttonSaveT oVistA): '  + err.mes sage);
  150       }
  151   }
  152  
  153   function v cnb_execut eVistAInte grationReq uest(vcnb_ noteId, vc nb_noteDes cription,  vcnb_patie ntICN, vcn b_userDoma inId, vcnb _localTitl e, vcnb_ca llbackNumb er, vcnb_r easonForRe quest, vcn b_encounte rCode, vcn b_signThis Note) {
  154       try {
  155           va r vcnb_req uestJSON =  {
  156                "NoteID" : vcnb_not eId,
  157                "NoteTex t": vcnb_n oteDescrip tion,
  158                "Patient ICN": vcnb _patientIC N
  159           };
  160  
  161           va r vcnb_req uestRespon se = "";
  162  
  163           $. ajax({
  164                type: "P OST",
  165                url: vcn b_NoteWrit eUrl,
  166                data: JS ON.stringi fy(vcnb_re questJSON) ,
  167                contentT ype: "appl ication/js on; charse t=utf-8",
  168                dataType : "json",
  169                success:  function  (data) {
  170                    var  vcnb_newda ta = JSON. parse(data );
  171                    vcnb _requestRe sponse = v cnb_newdat a;
  172                    vcnb _vistAInte grationReq uest_respo nse(null,  vcnb_reque stResponse );
  173                },
  174                error: f unction (j qXHR, text Status, er rorThrown)  {
  175                    //Sy stem Error
  176                    vcnb _vistAInte grationReq uest_respo nse(errorT hrown, nul l);
  177                },
  178                async: f alse,
  179                cache: f alse
  180           }) ;
  181       }
  182       catch  (err) {
  183           al ert('Vista  CPRS Note  Buttons F unction Er ror(vcnb_e xecuteVist AIntegrati onRequest) : ' + err. message);
  184       }
  185   }
  186  
  187   function v cnb_vistAI ntegration Request_re sponse(vcn b_errorThr own, vcnb_ requestRes ponse) {
  188       try{
  189           // Process In tegration  Request Re sponse
  190           if  (vcnb_err orThrown ! = null) {
  191                //Write  Error
  192                parent.X rm.Page.ge tAttribute ('ftp_inte grationres ult').setV alue('ERRO R');
  193                parent.X rm.Page.ge tAttribute ('ftp_inte grationres ult').setS ubmitMode( 'always');
  194                parent.X rm.Page.ge tAttribute ('ftp_inte grationerr or').setVa lue(String (vcnb_erro rThrown));
  195                parent.X rm.Page.ge tAttribute ('ftp_inte grationerr or').setSu bmitMode(' always');
  196                parent.X rm.Page.ge tAttribute ('ftp_inte grationdat e').setVal ue(new Dat e());
  197                parent.X rm.Page.ge tAttribute ('ftp_inte grationdat e').setSub mitMode('a lways');
  198                alert('T he note cr eation in  VistA/CPRS  failed!\n Please see  the integ ration err or field f or details .');
  199                parent.X rm.Page.ge tControl(' ftp_integr ationerror ').setFocu s();
  200                parent.X rm.Page.da ta.entity. save();
  201                return f alse;
  202           }
  203           el se {
  204                //Write  web servic e response  Success o r Failure
  205                if (vcnb _requestRe sponse.Err orOccurred  == false)  {
  206                    //Wr ite Succes s entry
  207                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nresult'). setValue(v cnb_reques tResponse. Status);
  208                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nresult'). setSubmitM ode('alway s');
  209                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nerror').s etValue(nu ll);
  210                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nerror').s etSubmitMo de('always ');
  211                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio ndate').se tValue(new  Date());
  212                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio ndate').se tSubmitMod e('always' );
  213                    pare nt.Xrm.Pag e.getContr ol('ftp_in tegrationr esult').se tFocus();
  214                    //al ert('The n ote creati on in Vist A/CPRS was  successfu l, this re quest will  now be cl osed and m arked reso lved.');
  215                    aler t('The not e creation  in VistA/ CPRS was s uccessful,  this requ est will n ow be mark ed as reso lved. \n\n Please exi t this req uest recor d after cl icking OK  to this pr ompt!');
  216                    //pa rent.Xrm.P age.data.e ntity.save ('saveandc lose');  / /This cann ot be used  with USD  as the USD  Tab remma ins open
  217                    vcnb _buttonSav e();
  218                }
  219                else {
  220                    //Wr ite Failur e entry
  221                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nresult'). setValue(v cnb_reques tResponse. Status);
  222                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nresult'). setSubmitM ode('alway s');
  223                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nerror').s etValue(vc nb_request Response.E rrorMessag e);
  224                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio nerror').s etSubmitMo de('always ');
  225                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio ndate').se tValue(new  Date());
  226                    pare nt.Xrm.Pag e.getAttri bute('ftp_ integratio ndate').se tSubmitMod e('always' );
  227                    aler t('The not e creation  in VistA/ CPRS faile d!\nPlease  see the i ntegration  error fie ld for det ails.');
  228                    pare nt.Xrm.Pag e.getContr ol('ftp_in tegratione rror').set Focus();
  229                    pare nt.Xrm.Pag e.data.ent ity.save() ;
  230                    retu rn false;
  231                }
  232           }
  233       }
  234       catch  (err) {
  235           al ert('Vista  CPRS Note  Buttons F unction Er ror(vcnb_v istAIntegr ationReque st_respons e): ' + er r.message) ;
  236       }
  237   }
  238  
  239  
  240   function v cnb_execut eCrmOdataG etRequest( vcnb_jsonQ uery, vcnb _aSync, vc nb_aSyncCa llback, vc nb_skipCou nt, vcnb_o ptionArray ) {
  241       //This  function  executes a  CRM Odata  web servi ce call to  retrieve  Crm data
  242       //*vcn b_jsonQuer y* - a pro perly form atted CRM  Odata Quer y string ( required)
  243       //*vcn b_aSync* -  specify ' true' to e xecute asy nchronousl y otherwis e 'false'  (required)
  244       //*vcn b_aSyncCal lback* - s pecify the  name of t he return  function t o call upo n completi on (requir ed if vcnb _aSync = t rue.  Othe rwise '')
  245       //*vcn b_skipCoun t* - Initi al setting  is always  '0', incr ements by  50 per CRM  SDK Odata  standards  (required )
  246       //*vcn b_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)
  247       try {
  248           va r vcnb_ent ityData =  null;
  249           $. ajax({
  250                type: 'G ET',
  251                contentT ype: 'appl ication/js on; charse t=utf-8',
  252                datatype : 'json',
  253                url: vcn b_jsonQuer y,
  254                beforeSe nd: functi on (XMLHtt pRequest)  {
  255                    XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json');
  256                },
  257                success:  function  (data, tex tStatus, X mlHttpRequ est) {
  258                    vcnb _entityDat a = data;
  259                    if ( vcnb_aSync  == true)  {
  260                         vcnb_aSync Callback(v cnb_entity Data, vcnb _skipCount , vcnb_opt ionArray);
  261                    }
  262                },
  263                error: f unction (X MLHttpRequ est, textS tatus, err orThrown)  {
  264                    aler t('Fail: A jax Error  in vcnb_ex ecuteCrmOd ataGetRequ est: ' + e rrorThrown  + " Reque st: " + vc nb_jsonQue ry);
  265                },
  266                async: v cnb_aSync,
  267                cache: f alse
  268           }) ;
  269           re turn vcnb_ entityData ;
  270       }
  271       catch  (err) {
  272           al ert('An er ror occure d in the v cnb_execut eCrmOdataG etRequest  function.   Error Det ail Messag e: ' + err );
  273       }
  274   }
  275  
  276   function v cnb_getMul tipleEntit yDataAsync (vcnb_enti tySetName,  vcnb_attr ibuteSet,  vcnb_condi tionalFilt er, vcnb_s ortAttribu te, vcnb_s ortDirecti on, vcnb_s kipCount,  vcnb_aSync Callback,  vcnb_optio nArray) {
  277       //This  function  returns a  CRM JSON d ataset for  all entit y records  matching c riteria pr ovided Asy ncronously
  278       //*vcn b_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  279       //*vcn b_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  280       //*vcn b_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
  281       //*vcn b_sortAttr ibute* - i s a string  containin g the name  of the at tribute to  sort the  result set  by e.g. ' LastName'
  282       //*vcn b_sortDire ction* - i s a string  specifyin g the sort  as Ascend ing or Des cending e. g. 'asc' o r 'desc'
  283       //*vcn b_skipCoun t* - is th e starting  point in  the result  (use if m ore than 5 0), (Put 0  if not us ed)
  284       //*vcn b_aSyncCal lback* - i s the name  of the fu nction to  call when  returning  the result
  285       //*vcn b_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
  286  
  287       try {
  288           va r vcnb_jso nQuery = v cnb_server Url + vcnb _crmOdataE ndPoint +  '/' + vcnb _entitySet Name + '?$ select=' +  vcnb_attr ibuteSet +  '&$filter =' + vcnb_ conditiona lFilter +  '&$orderby =' + vcnb_ sortAttrib ute + ' '  + vcnb_sor tDirection  + '&$skip =' + vcnb_ skipCount;
  289           vc nb_execute CrmOdataGe tRequest(v cnb_jsonQu ery, true,  vcnb_aSyn cCallback,  vcnb_skip Count, vcn b_optionAr ray);
  290       }
  291       catch  (err) {
  292           al ert('An er ror occure d in the v cnb_getMul tipleEntit yDataAsync  function.   Error De tail Messa ge: ' + er r);
  293       }
  294   }
  295  
  296   function v cnb_getSin gleEntityD ataSync(vc nb_entityS etName, vc nb_attribu teSet, vcn b_entityId ) {
  297       //This  function  returns a  CRM JSON d ataset for  a single  entity rec ord based  on the ent ity id pro vided Sync ronously
  298       //*vcn b_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  299       //*vcn b_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  300       //*vcn b_entityId * - is the  Guid for  the entity  record
  301  
  302       try {
  303           va r vcnb_ent ityIdNoBra cket = vcn b_entityId .replace(/ ({|})/g, ' ');
  304           va r vcnb_sel ectString  = '(guid'  + "'" + vc nb_entityI dNoBracket  + "'" + ' )?$select= ' + vcnb_a ttributeSe t;
  305           va r vcnb_jso nQuery = v cnb_server Url + vcnb _crmOdataE ndPoint +  '/' + vcnb _entitySet Name + vcn b_selectSt ring;
  306           va r vcnb_ent ityData =  vcnb_execu teCrmOdata GetRequest (vcnb_json Query, fal se, '', 0,  null);
  307           re turn vcnb_ entityData ;
  308       }
  309       catch  (err) {
  310           al ert('An er ror occure d in the v cnb_getSin gleEntityD ataSync fu nction.  E rror Detai l Message:  ' + err);
  311       }
  312   }