86. EPMO Open Source Coordination Office Redaction File Detail Report

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

86.1 Files compared

# Location File Last Modified
1 VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_1_0_0_6.zip\WebResources ftp_VistaAddendumIntegrationFormScriptVistaAddendu9B734B60-18FD-E611-944C-0050568D743D Thu Mar 23 13:44:30 2017 UTC
2 VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_1_0_0_6.zip\WebResources ftp_VistaAddendumIntegrationFormScriptVistaAddendu9B734B60-18FD-E611-944C-0050568D743D Thu Nov 30 17:21:06 2017 UTC

86.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 4 1408
Changed 3 6
Inserted 0 0
Removed 0 0

86.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

86.4 Active regular expressions

No regular expressions were active.

86.5 Comparison detail

  1   //VistaAdd endumInteg rationForm Script.js
  2   //Contains  variables  and funct ions used  by the CRM  Form and  Ribbon
  3   //Requires  jQuery lo aded on th e CRM Form
  4  
  5   //Static V ariables
  6   var vadi_c rmOdataEnd Point = '/ XRMService s/2011/Org anizationD ata.svc';
  7   var vadi_s erverUrl =  Xrm.Page. context.ge tClientUrl ();
  8  
  9   //var vadi _VistaUser sURLbase =  'https:// qacrmdac.n p.crm.vrm. vba. DNS     /WebParts/ DEV/api/Vi staUsers/1 .0/json/ft pCRM/john/ smith/1234 ?noFilter= true';    //OLD MANU AL DEV URL
  10   var vadi_V istaUsersU RLbase = ' ';
  11   //var vadi _AddSigner sUrl = 'ht tps://qacr mdac.np.cr m.vrm.vba. DNS     /WebParts/ DEV/api/VI A/AddSigne rs/1.0/jso n';    //OLD MANU AL DEV URL
  12   var vadi_A ddSignersU rl = '';
  13   //var vadi _CreateAdd endumUrl =  'https:// qacrmdac.n p.crm.vrm. vba. DNS     /WebParts/ DEV/api/VI A/CreateAd dendum/1.0 /json';    //OLD MANU AL DEV URL
  14   var vadi_C reateAdden dumUrl = ' ';
  15  
  16   //Producti on Environ ment Indic ator
  17   var vadi_I sProductio nEnvironme nt = false ;
  18  
  19   //Word Wra p Line Lim it
  20   var vadi_W ordWrapLim it = 75;
  21  
  22   //Addition al Signers  Data
  23   var vadi_A ddlSigners NameArray  = null;
  24   var vadi_A ddlSigners IenArray =  null;
  25   var vadi_l ocalStorag eVarName =  "";
  26  
  27   //Intializ e LoginCon trol Depen decies if  they exist
  28   function v cmn_initVi aDropdownC ontrols()  { /*No Act ion necess ary*/ }
  29  
  30   function v adi_launch AddendumSi gnerSearch () {
  31       try {
  32           // Refresh th e web reso urce URL
  33           va r vadi_Add endumSigne rSearchURL  = Xrm.Pag e.getContr ol('WebRes ource_Adde ndumSigner Search').g etSrc();
  34           Xr m.Page.get Control('W ebResource _AddendumS ignerSearc h').setSrc (vadi_Adde ndumSigner SearchURL) ;
  35           // Prep the t ab
  36           if  (Xrm.Page .ui.tabs.g et('Tab_Ad ditionalSi gners').ge tVisible()  == false)  {
  37                Xrm.Page .ui.tabs.g et('Tab_Ad ditionalSi gners').se tVisible(t rue);
  38           }
  39           if  (Xrm.Page .ui.tabs.g et('Tab_Ad ditionalSi gners').ge tDisplaySt ate() != ' expanded')  {
  40                Xrm.Page .ui.tabs.g et('Tab_Ad ditionalSi gners').se tDisplaySt ate('expan ded');
  41           }
  42           // Set focus  to the sig ners tab
  43           Xr m.Page.ui. tabs.get(' Tab_Additi onalSigner s').setFoc us();
  44       }
  45       catch  (err) {
  46           al ert('Adden dum Signer  Search Ri bbon Funct ion Error( vadi_launc hAddendumS ignerSearc h): ' + er r.message) ;
  47       }
  48   }
  49  
  50   function v adi_newAdd endumLoad( ) {
  51       try {
  52           // GET CRM SE TTINGS WEB  SERVICE U RLS
  53           va r vadi_con ditionalFi lter = "(m cs_name eq  'Active S ettings')" ;
  54           va di_getMult ipleEntity DataAsync( 'mcs_setti ngSet', 'f tp_DACURL,  ftp_Vista UsersAPIUR L, ftp_IsP roductionE nvironment , ftp_VIAA dditionalS ignersURL,  ftp_VIACr eateAddend umURL', va di_conditi onalFilter , 'mcs_nam e', 'asc',  0, vadi_n ewAddendum Load_respo nse);
  55       }
  56       catch  (err) {
  57           // Display Er ror
  58           al ert('Adden dum Form L oad Script  Function  Error(vadi _newAddend umLoad): '  + err.mes sage);
  59       }
  60   }
  61  
  62   function v adi_newAdd endumLoad_ response(v adi_settin gData, vad i_lastSkip ) {
  63       try {
  64           // vadi_lastS kip is the  starting  point in t he result  (use if mo re than 50  records)  //Not used  in this s cenario
  65           va r vadi_Dac Url = null ;
  66           va r vadi_Vis taUserApiU rl = null;
  67           va r vadi_Via AddlSigner sApiUrl =  null;
  68           va r vadi_Via CreateAdde ndumApiUrl  = null;
  69  
  70           fo r (var i =  0; i <= v adi_settin gData.d.re sults.leng th - 1; i+ +) {
  71                //Get in fo
  72                if (vadi _settingDa ta.d.resul ts[i].ftp_ DACURL !=  null) { va di_DacUrl  = vadi_set tingData.d .results[i ].ftp_DACU RL; }
  73                if (vadi _settingDa ta.d.resul ts[i].ftp_ VistaUsers APIURL !=  null) { va di_VistaUs erApiUrl =  vadi_sett ingData.d. results[i] .ftp_Vista UsersAPIUR L; }
  74                if (vadi _settingDa ta.d.resul ts[i].ftp_ IsProducti onEnvironm ent != nul l) { vadi_ IsProducti onEnvironm ent = vadi _settingDa ta.d.resul ts[i].ftp_ IsProducti onEnvironm ent; }
  75                if (vadi _settingDa ta.d.resul ts[i].ftp_ VIAAdditio nalSigners URL != nul l) { vadi_ ViaAddlSig nersApiUrl  = vadi_se ttingData. d.results[ i].ftp_VIA Additional SignersURL ; }
  76                if (vadi _settingDa ta.d.resul ts[i].ftp_ VIACreateA ddendumURL  != null)  { vadi_Via CreateAdde ndumApiUrl  = vadi_se ttingData. d.results[ i].ftp_VIA CreateAdde ndumURL; }
  77                break;
  78           }
  79  
  80           if  (vadi_Dac Url != nul l && vadi_ VistaUserA piUrl != n ull) {
  81                //Constr uct full w eb service  URL
  82                vadi_Vis taUsersURL base = vad i_DacUrl +  vadi_Vist aUserApiUr l;
  83           }
  84           el se {
  85                Xrm.Page .ui.setFor mNotificat ion("ERROR : THE VIST A USERS SE RVICE URL  IS MISSING , PLEASE C ONTACT TEC HNICAL SUP PORT!", "E RROR", "VI STASERVICE ");
  86           }
  87           if  (vadi_Dac Url != nul l && vadi_ ViaAddlSig nersApiUrl  != null)  {
  88                //Constr uct full w eb service  URL
  89                vadi_Add SignersUrl  = vadi_Da cUrl + vad i_ViaAddlS ignersApiU rl;
  90           }
  91           el se {
  92                Xrm.Page .ui.setFor mNotificat ion("ERROR : THE VIA  ADDITIONAL  SIGNERS S ERVICE URL  IS MISSIN G, PLEASE  CONTACT TE CHNICAL SU PPORT!", " ERROR", "V ISTASERVIC E");
  93           }
  94  
  95           if  (vadi_Dac Url != nul l && vadi_ ViaCreateA ddendumApi Url != nul l) {
  96                //Constr uct full w eb service  URL
  97                vadi_Cre ateAddendu mUrl = vad i_DacUrl +  vadi_ViaC reateAdden dumApiUrl;
  98           }
  99           el se {
  100                Xrm.Page .ui.setFor mNotificat ion("ERROR : THE VIA  CREATE ADD ENDUM SERV ICE URL IS  MISSING,  PLEASE CON TACT TECHN ICAL SUPPO RT!", "ERR OR", "VIST ASERVICE") ;
  101           }
  102       }
  103       catch  (err) {
  104           al ert('Adden dum Form L oad Script  Function  Error(vadi _newAddend umLoad_res ponse): '  + err.mess age);
  105       }
  106   }
  107  
  108   function v adi_ribbon ButtonSave ToVistA()  {
  109       try {
  110           // Check the  value of t he Integra tion Statu s Field, i f = 'OK',  stop and e xit this s cript
  111           va r vadi_int egrationSt atus = Xrm .Page.getA ttribute(' ftp_integr ationstatu s').getVal ue();
  112           if  (vadi_int egrationSt atus == 'O K') { retu rn false;  }
  113  
  114           // Check for  additional  signers,  if they ex ist, the s igners mus t be in sy nc with ma tching Ses sion varia bles
  115           va di_AddlSig nersNameAr ray = null ;
  116           va di_AddlSig nersIenArr ay = null;
  117  
  118           va r vadi_sel ectedSigne rs = Xrm.P age.getAtt ribute('ft p_selected signers'). getValue() ;
  119           if  (vadi_sel ectedSigne rs != null  && vadi_s electedSig ners != '' ) {
  120                //Additi onal Signe rs exist i n CRM, ver ify sessio n variable s
  121                var vadi _selectedA rray = vad i_selected Signers.sp lit('~~~') ;
  122                var vadi _selectedA rrayRecord Count = va di_selecte dArray.len gth;
  123                if (vadi _selectedA rrayRecord Count > 1)  {
  124                    vadi _AddlSigne rsNameArra y = vadi_s electedArr ay;
  125                }
  126  
  127                var vadi _selectedI ENArray =  '';
  128                var vadi _selectedI ENArrayRec ordCount =  0;
  129                var vadi _addendumI d = Xrm.Pa ge.data.en tity.getId ();  //Use d to be pr ogressNote Id
  130  
  131                var vadi _arrayMism atch = fal se;
  132  
  133                //Get No te's Brows er Local S torage Val ues
  134                if (vadi _addendumI d != null  && vadi_ad dendumId ! = '') {
  135                    vadi _localStor ageVarName  = "PN" +  vadi_adden dumId;
  136                    var  vadi_local StorageStr ingValue =  localStor age.getIte m(vadi_loc alStorageV arName);
  137                    if ( vadi_local StorageStr ingValue ! = null &&  vadi_local StorageStr ingValue ! = '') {
  138                         vadi_selec tedIENArra y = vadi_l ocalStorag eStringVal ue.split(' ~~~');
  139                         vadi_selec tedIENArra yRecordCou nt = vadi_ selectedIE NArray.len gth;
  140                         if (vadi_s electedIEN ArrayRecor dCount > 1 ) {
  141                             vadi_A ddlSigners IenArray =  vadi_sele ctedIENArr ay;
  142                         }
  143                    }
  144                }
  145                //Compar e CRM sign er array l ength with  LocalStor age array  length
  146                if (vadi _selectedA rrayRecord Count != v adi_select edIENArray RecordCoun t) { vadi_ arrayMisma tch = true ; }
  147  
  148                if (vadi _arrayMism atch == tr ue) {
  149                    aler t("The cou nt of Addi tional Sig ners selec ted in CRM , does not  match the  count of  Additional  Signers i n VISTA!\n \nPlease r emove all  the additi onal signe rs on this  Addemdum  and perfor m the sele ction proc ess again! \n\nThis a ddendum ca nnot be in tegrated w ith VISTA/ CPRS until  this has  been resol ved.");
  150                    retu rn false;
  151                }
  152           }
  153  
  154           // Check if V IA Login c ookie exis t (not exp ired)
  155           va r vadi_Via LoginCooki e = vadi_g etCookie(" viasession link");
  156           if  (vadi_Via LoginCooki e == "") {
  157                alert("Y our VISTA  session ha s expired.  In order  to integra te an adde ndum, you  must be lo gged into  VISTA!");
  158                Xrm.Page .ui.tabs.g et('Tab_Vi stALogin') .setVisibl e(true);
  159                Xrm.Page .ui.tabs.g et('Tab_Vi stALogin') .setFocus( );
  160                return f alse;
  161           }
  162  
  163           // Save the c urrent CRM  data
  164           Xr m.Page.dat a.entity.s ave();
  165           // Display YE LLOW Progr ess....
  166           Xr m.Page.ui. setFormNot ification( "Verifying  addendum  data, plea se wait.." , "INFO",  "SAVEVISTA ");
  167  
  168           va r vadi_con firmSaveTo Vista = co nfirm('Are  you sure  you want t o save thi s addendum  to VistA/ CPRS?\nThi s action c annot be c ancelled!\ n\nUpon co mpletion o f this pro cess, the  addendum w ill automa tically be  marked as  completed  and you w ill be pro mpted to e xit the re cord!');
  169           if  (vadi_con firmSaveTo Vista == f alse) {
  170                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  171                return f alse;
  172           }
  173  
  174           // Get VistA  Note Id to  relate ad dedndum to  existing  note in Vi stA
  175           va r vadi_vis taNoteId =  Xrm.Page. getAttribu te('ftp_vi stanoteid' ).getValue ();
  176           if  (vadi_vis taNoteId = = null ||  vadi_vista NoteId ==  '') {
  177                alert('T he VistA N ote Id fie ld does no t have a v alue, the  addendum c annot be c reated in  VistA/CPRS !');
  178                Xrm.Page .getContro l('ftp_vis tanoteid') .setFocus( );
  179                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  180                return f alse;
  181           }
  182  
  183           // Get Addend um Note Te xt
  184           va r vadi_add endumText  = Xrm.Page .getAttrib ute('descr iption').g etValue();
  185           if  (vadi_add endumText  == null ||  vadi_adde ndumText = = '') {
  186                alert('T he Note fi eld does n ot have te xt, the ad dendum can not be cre ated in Vi stA/CPRS!' );
  187                Xrm.Page .getContro l('descrip tion').set Focus();
  188                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  189                return f alse;
  190           }
  191          
  192           // Get user d ata
  193           va r vadi_crm UserId = X rm.Page.ge tAttribute ('ownerid' ).getValue ();
  194           va r vadi_use rDomainId  = '';
  195           va r vadi_use rFirstName  = '';
  196           va r vadi_use rLastName  = '';
  197           va r vadi_use rMiddleNam e = '';
  198           va r vadi_use rSiteId =  '';
  199  
  200           if  (vadi_crm UserId !=  null) {
  201                //Verify  the owner  type
  202                if (vadi _crmUserId [0].entity Type != 's ystemuser' ) {
  203                    aler t('The add endum owne r must be  an individ ual user a nd not a t eam, the a ddendum ca nnot be cr eated in V istA/CPRS! ');
  204                    Xrm. Page.ui.cl earFormNot ification( "SAVEVISTA ");
  205                    retu rn false;
  206                }
  207  
  208                var vadi _userData  = vadi_get SingleEnti tyDataSync ('SystemUs erSet', 'D omainName,  FirstName , LastName , MiddleNa me, ftp_Fa cilitySite Id', vadi_ crmUserId[ 0].id);
  209                if (vadi _userData  != null) {
  210                    if ( vadi_userD ata.d.Doma inName !=  null) { va di_userDom ainId = va di_userDat a.d.Domain Name; }
  211                    if ( vadi_userD ata.d.Firs tName != n ull) { vad i_userFirs tName = va di_userDat a.d.FirstN ame; }
  212                    if ( vadi_userD ata.d.Last Name != nu ll) { vadi _userLastN ame = vadi _userData. d.LastName ; }
  213                    if ( vadi_userD ata.d.Midd leName !=  null) { va di_userMid dleName =  vadi_userD ata.d.Midd leName; }
  214                    if ( vadi_userD ata.d.ftp_ FacilitySi teId != nu ll) { vadi _userSiteI d = vadi_u serData.d. ftp_Facili tySiteId.I d; }
  215                }
  216           }
  217           el se {
  218                alert('U nable to v erify the  user accou nt for the  current a uthor/owne r assigned  to this a ddendum, t he addendu m cannot b e created  in VistA/C PRS!');
  219                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  220                return f alse;
  221           }
  222  
  223           // Verify tha t the curr ent owner  and the cu rrent user  is the sa me person,  if not do  not proce ed
  224           if  ((vadi_cr mUserId[0] .id).toUpp erCase() ! = (Xrm.Pag e.context. getUserId( )).toUpper Case()) {
  225                alert('T he current  author/ow ner does n ot match t he current  CRM user,  the adden dum cannot  be create d in VistA /CPRS!');
  226                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  227                return f alse;
  228           }
  229           va r vadi_Not eUserTeam  = "NONE";
  230           // Check Team  membershi p
  231           if  (vadi_Use rHasTeam(" Pharmacy",  Xrm.Page. context.ge tUserId()) ) { vadi_N oteUserTea m = "PHARM ACY"; }
  232           if  (vadi_Use rHasTeam(" CCA Team",  Xrm.Page. context.ge tUserId()) ) { vadi_N oteUserTea m = "CCA";  }
  233           if  (vadi_Use rHasTeam(" TAN", Xrm. Page.conte xt.getUser Id())) { v adi_NoteUs erTeam = " TAN"; }
  234           // **TEMP, ve rify these  team valu es that th ey are cor rect **FUT URE NEED**
  235           if  (vadi_Use rHasTeam(" PACT User" , Xrm.Page .context.g etUserId() )) { vadi_ NoteUserTe am = "PACT "; }
  236           if  (vadi_Use rHasTeam(" MSA User",  Xrm.Page. context.ge tUserId()) ) { vadi_N oteUserTea m = "MSA";  }
  237  
  238           // Verify Tea m Value, t hat one ha s been ass igned
  239           if  (vadi_Not eUserTeam  == "NONE")  {
  240                alert('T he current  author/ow ner does n ot belong  to a CRM t eam that c an integra te addendu ms, the ad dendum can not be cre ated in Vi stA/CPRS!' );
  241                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  242                return f alse;
  243           }
  244  
  245           // Execute In tegration
  246           va di_execute VistaAdden dumIntegra tion(vadi_ vistaNoteI d, vadi_ad dendumText );
  247       }
  248       catch  (err) {
  249           al ert('Adden dum Ribbon  Function  Error(vadi _ribbonBut tonSaveToV istA): ' +  err.messa ge);
  250           Xr m.Page.ui. clearFormN otificatio n("SAVEVIS TA");
  251       }
  252   }
  253  
  254   function v adi_execut eVistaAdde ndumIntegr ation(vadi _originalN oteId, vad i_noteDesc ription) {
  255       try {
  256           // Reformat N ote Descri ption as n eeded to h andle long  lines of  text (Word Wrap)
  257           va r vadi_Not eText = va di_noteDes cription;
  258           va r vadi_Rev isedNoteTe xt = "";
  259  
  260           // Do Breakdo wn of line s
  261           va r vadi_Tex tLines = v adi_NoteTe xt.split(' \n');
  262           if  (vadi_Tex tLines.len gth > 0) {
  263                //Reform at text
  264                for (var  i = 0; i  < vadi_Tex tLines.len gth; i++)  {
  265                    //Te st for a l ong line
  266                    if ( vadi_TextL ines[i].le ngth > vad i_WordWrap Limit) {
  267                         //Break do wn line
  268                         var vadi_N ewString =  vadi_word Wrap(vadi_ TextLines[ i], vadi_W ordWrapLim it, '\n');
  269                         //Add revi sed text b ack
  270                         vadi_Revis edNoteText  = vadi_Re visedNoteT ext + vadi _NewString  + "\n";   //Add back  the CR/LF  used to s plit on
  271                    }
  272                    else  {
  273                         //Add text  to new no te
  274                         vadi_Revis edNoteText  = vadi_Re visedNoteT ext + vadi _TextLines [i] + "\n" ; //Add ba ck the CR/ LF used to  split on
  275                    }
  276                }
  277           }
  278           if  (vadi_Rev isedNoteTe xt != "" & & vadi_Rev isedNoteTe xt != null ) {
  279                vadi_not eDescripti on = vadi_ RevisedNot eText;
  280           }
  281  
  282           // Add list o f addition al signer  names to N ote Text i f they exi sts
  283           if  (vadi_Add lSignersNa meArray !=  null && v adi_AddlSi gnersIenAr ray != nul l) {
  284                //Create  text stri ngs from a dditional  signers ar ray
  285                var vadi _SignerNam es = "\nAd ditional N ote Signer s\n" + "-- ---------- ---------- -------\n" ;
  286                for (var  i = 0; i  <= vadi_Ad dlSignersN ameArray.l ength - 1;  i++) {
  287                    if ( i >= 1) {
  288                         var vadi_s ingleSigne rName = va di_AddlSig nersNameAr ray[i].spl it("___");
  289                         vadi_Signe rNames = v adi_Signer Names + va di_singleS ignerName[ 1] + "\n";
  290                    }
  291                }
  292                //Add to  Note Desc ription
  293                vadi_not eDescripti on = vadi_ noteDescri ption + va di_SignerN ames;
  294           }
  295  
  296           va r vadi_use rSiteId =  "";
  297           va r vadi_Use rSiteNo =  "";
  298           va r vadi_duz  = "";
  299           va r vadi_pro vidername  = "";
  300  
  301           va r vadi_use rData = va di_getSing leEntityDa taSync('Sy stemUserSe t', 'ftp_F acilitySit eId', Xrm. Page.conte xt.getUser Id());
  302           if  (vadi_use rData != n ull) {
  303                if (vadi _userData. d.ftp_Faci litySiteId  != null)  {
  304                    vadi _userSiteI d = vadi_u serData.d. ftp_Facili tySiteId.I d;
  305                }
  306           }
  307  
  308           // Lookup the  Facility/ Site #
  309           if  (vadi_use rSiteId !=  null && v adi_userSi teId != '' ) {
  310                var vadi _facilityD ata = vadi _getSingle EntityData Sync('ftp_ facilitySe t', 'ftp_f acilitycod e', vadi_u serSiteId) ;
  311                if (vadi _facilityD ata != nul l) {
  312                    if ( vadi_facil ityData.d. ftp_facili tycode !=  null) { va di_UserSit eNo = vadi _facilityD ata.d.ftp_ facilityco de; }
  313                }
  314           }
  315  
  316           // Check if V IA Login c ookie exis t (not exp ired)
  317           va r vadi_Via LoginCooki e = vadi_g etCookie(" viasession link");
  318           if  (vadi_Via LoginCooki e != null  && vadi_Vi aLoginCook ie != '')  {
  319                var vadi _cookiearr ay = vadi_ ViaLoginCo okie.split ("~~~~", 2 );
  320                vadi_duz  = vadi_co okiearray[ 0];
  321                vadi_pro vidername  = vadi_coo kiearray[1 ];
  322           }
  323  
  324           // Create the  VIA Adden dum Record
  325           va r vadi_via Addendum =  new Objec t();
  326           va di_viaAdde ndum.Provi derName =  vadi_provi dername;
  327           va di_viaAdde ndum.Duz =  vadi_duz;
  328           va di_viaAdde ndum.Login SiteCode =  vadi_User SiteNo;
  329           va di_viaAdde ndum.Targe t = vadi_o riginalNot eId;
  330           va di_viaAdde ndum.Adden dumNote =  vadi_noteD escription ;
  331  
  332           $. ajax({
  333                type: "P OST",
  334                url: vad i_CreateAd dendumUrl,
  335                data: JS ON.stringi fy(vadi_vi aAddendum) ,
  336                contentT ype: "appl ication/js on; charse t=utf-8",
  337                dataType : "json",
  338                success:  function  (data) {
  339                    var  vadi_newda ta = data. Data;
  340                    vadi _requestRe sponse = v adi_newdat a;
  341                    vadi _executeVi staAddendu mIntegrati on_respons e(null, va di_request Response,  vadi_noteD escription );
  342                },
  343                error: f unction (j qXHR, text Status, er rorThrown)  {
  344                    //Sy stem Error
  345                    vadi _executeVi staAddendu mIntegrati on_respons e(errorThr own, null,  vadi_note Descriptio n);
  346                },
  347                async: f alse,
  348                cache: f alse
  349           }) ;
  350  
  351       }
  352       catch  (err) {
  353           al ert('Adden dum Ribbon  Function  Error(vadi _executeVi staAddendu mIntegrati on): ' + e rr.message );
  354           Xr m.Page.ui. clearFormN otificatio n("SAVEVIS TA");
  355       }
  356   }
  357  
  358   function v adi_execut eVistaAdde ndumIntegr ation_resp onse(vadi_ errorThrow n, vadi_re questRespo nse, vadi_ noteDescri ption) {
  359       try {
  360           // Process In tegration  Request Re sponse
  361           if  (vadi_err orThrown ! = null) {
  362                //Write  Error
  363                Xrm.Page .getAttrib ute('ftp_i ntegration status').s etValue('E RROR');
  364                Xrm.Page .getAttrib ute('ftp_i ntegration status').s etSubmitMo de('always ');
  365                Xrm.Page .getAttrib ute('ftp_i ntegration error').se tValue(Str ing(vadi_e rrorThrown ));
  366                Xrm.Page .getAttrib ute('ftp_i ntegration error').se tSubmitMod e('always' );
  367                Xrm.Page .getAttrib ute('ftp_i ntegration date').set Value(new  Date());
  368                Xrm.Page .getAttrib ute('ftp_i ntegration date').set SubmitMode ('always') ;
  369                Xrm.Page .getAttrib ute('ftp_a ddendumnot eid').setV alue('');
  370                Xrm.Page .getAttrib ute('ftp_a ddendumnot eid').setS ubmitMode( 'always');
  371                alert('T he addendu m creation  in VistA/ CPRS faile d!\nPlease  see the i ntegration  error fie ld for det ails.');
  372                Xrm.Page .getContro l('ftp_int egrationer ror').setF ocus();
  373                Xrm.Page .data.enti ty.save();
  374                Xrm.Page .ui.clearF ormNotific ation("SAV EVISTA");
  375                return f alse;
  376           }
  377           el se {
  378                //Write  web servic e response  Success o r Failure
  379                if (vadi _requestRe sponse[0]. Fault == n ull) {
  380                    //Ve rify that  a Note Id  was create d for the  addendum a nd that it  is a numb er (not er ror messag e)
  381                    if ( isNaN(vadi _requestRe sponse[0]. Text) == f alse) {
  382                         //Call Add itional Si gners & Fi nalize Add endum func tion
  383                         vadi_final izeAddendu mCreation( "OK", vadi _requestRe sponse[0]. Text, vadi _noteDescr iption)
  384                    }
  385                    else  {
  386                         //Write Fa ilure entr y since th e NoteId i s not a nu mber
  387                         Xrm.Page.g etAttribut e('ftp_int egrationst atus').set Value('ERR OR');
  388                         Xrm.Page.g etAttribut e('ftp_int egrationst atus').set SubmitMode ('always') ;
  389                         Xrm.Page.g etAttribut e('ftp_int egrationer ror').setV alue(vadi_ requestRes ponse[0].T ext);
  390                         Xrm.Page.g etAttribut e('ftp_int egrationer ror').setS ubmitMode( 'always');
  391                         Xrm.Page.g etAttribut e('ftp_int egrationda te').setVa lue(new Da te());
  392                         Xrm.Page.g etAttribut e('ftp_int egrationda te').setSu bmitMode(' always');
  393                         Xrm.Page.g etAttribut e('ftp_add endumnotei d').setVal ue('');
  394                         Xrm.Page.g etAttribut e('ftp_add endumnotei d').setSub mitMode('a lways');
  395                         alert('The  addendum  creation i n VistA/CP RS failed! \nPlease s ee the int egration e rror field  for detai ls.');
  396                         Xrm.Page.g etControl( 'ftp_integ rationerro r').setFoc us();
  397                         Xrm.Page.d ata.entity .save();
  398                         Xrm.Page.u i.clearFor mNotificat ion("SAVEV ISTA");
  399                         return fal se;
  400                    }
  401                }
  402                else {
  403                    //Wr ite Failur e entry
  404                    Xrm. Page.getAt tribute('f tp_integra tionstatus ').setValu e('ERROR') ;
  405                    Xrm. Page.getAt tribute('f tp_integra tionstatus ').setSubm itMode('al ways');
  406                    Xrm. Page.getAt tribute('f tp_integra tionerror' ).setValue (vadi_requ estRespons e[0].Fault .Message);
  407                    Xrm. Page.getAt tribute('f tp_integra tionerror' ).setSubmi tMode('alw ays');
  408                    Xrm. Page.getAt tribute('f tp_integra tiondate') .setValue( new Date() );
  409                    Xrm. Page.getAt tribute('f tp_integra tiondate') .setSubmit Mode('alwa ys');
  410                    Xrm. Page.getAt tribute('f tp_addendu mnoteid'). setValue(' ');
  411                    Xrm. Page.getAt tribute('f tp_addendu mnoteid'). setSubmitM ode('alway s');
  412                    aler t('The add endum crea tion in Vi stA/CPRS f ailed!\nPl ease see t he integra tion error  field for  details.' );
  413                    Xrm. Page.getCo ntrol('ftp _integrati onerror'). setFocus() ;
  414                    Xrm. Page.data. entity.sav e();
  415                    Xrm. Page.ui.cl earFormNot ification( "SAVEVISTA ");
  416                    retu rn false;
  417                }
  418           }
  419       }
  420       catch  (err) {
  421           al ert('Adden dum Ribbon  Function  Error(vadi _executeVi staAddendu mIntegrati on_respons e): ' + er r.message) ;
  422           Xr m.Page.ui. clearFormN otificatio n("SAVEVIS TA");
  423       }
  424   }
  425  
  426   function v adi_finali zeAddendum Creation(v adi_integr ationStatu s, vadi_in tegrationN oteId, vad i_noteDesc ription) {
  427       //The  Addendum w as sucessf ully creat ed in Vist a/CPRS, ad d addition al signers  if needed
  428       try {
  429           // Determine  if additio nal signer s exists
  430           if  (vadi_Add lSignersNa meArray !=  null && v adi_AddlSi gnersIenAr ray != nul l) {
  431                //Get th e current  CRM User's  assigned  site/facil ity
  432                var vadi _userSiteI d = "";
  433                var vadi _UserSiteN o = "";
  434                var vadi _duz = "";
  435                var vadi _providern ame = "";
  436  
  437                var vadi _userData  = vadi_get SingleEnti tyDataSync ('SystemUs erSet', 'f tp_Facilit ySiteId',  Xrm.Page.c ontext.get UserId());
  438                if (vadi _userData  != null) {
  439                    if ( vadi_userD ata.d.ftp_ FacilitySi teId != nu ll) {
  440                         vadi_userS iteId = va di_userDat a.d.ftp_Fa cilitySite Id.Id;
  441                    }
  442                }
  443  
  444                //Lookup  the Facil ity/Site #
  445                if (vadi _userSiteI d != null  && vadi_us erSiteId ! = '') {
  446                    var  vadi_facil ityData =  vadi_getSi ngleEntity DataSync(' ftp_facili tySet', 'f tp_facilit ycode', va di_userSit eId);
  447                    if ( vadi_facil ityData !=  null) {
  448                         if (vadi_f acilityDat a.d.ftp_fa cilitycode  != null)  { vadi_Use rSiteNo =  vadi_facil ityData.d. ftp_facili tycode; }
  449                    }
  450                }
  451  
  452                //Check  if VIA Log in cookie  exist (not  expired)
  453                var vadi _ViaLoginC ookie = va di_getCook ie("viases sionlink") ;
  454                if (vadi _ViaLoginC ookie != n ull && vad i_ViaLogin Cookie !=  '') {
  455                    var  vadi_cooki earray = v adi_ViaLog inCookie.s plit("~~~~ ", 2);
  456                    vadi _duz = vad i_cookiear ray[0];
  457                    vadi _providern ame = vadi _cookiearr ay[1];
  458                }
  459  
  460                //Create  text stri ngs from a dditional  signers ar ray
  461                var vadi _SignerIEN  = "";
  462                for (var  i = 0; i  <= vadi_Ad dlSignersI enArray.le ngth - 1;  i++) {
  463                    if ( i == 1) {  vadi_Signe rIEN = vad i_AddlSign ersIenArra y[i]; }
  464                    if ( i > 1) { v adi_Signer IEN = vadi _SignerIEN  + " " + v adi_AddlSi gnersIenAr ray[i]; }
  465                }
  466  
  467                //Create  the Addit ional Sign ers
  468                var vadi _viaSigner s = new Ob ject();
  469                vadi_via Signers.Pr oviderName  = vadi_pr ovidername ;
  470                vadi_via Signers.Du z = vadi_d uz;
  471                vadi_via Signers.Lo ginSiteCod e = vadi_U serSiteNo;
  472                vadi_via Signers.Ta rget = vad i_integrat ionNoteId;
  473                vadi_via Signers.Su pplemental Parameters  = vadi_Si gnerIEN;
  474  
  475                $.ajax({
  476                    type : "POST",
  477                    url:  vadi_AddS ignersUrl,
  478                    data : JSON.str ingify(vad i_viaSigne rs),
  479                    cont entType: " applicatio n/json; ch arset=utf- 8",
  480                    data Type: "jso n",
  481                    succ ess: funct ion (data)  {
  482                         vadi_viaSi gnersRespo nse = JSON .stringify (data.Data );
  483                         //Test for  Failure
  484                         if (vadi_v iaSignersR esponse.Er rorOccurre d == true)  {
  485                             alert( "Error: Un able to ad d the addi tional sig ners selec ted to thi s addendum .\n\nPleas e review t he addendu m and sign ers in you r Vista/CP RS applica tion!");
  486                         }
  487                    },
  488                    erro r: functio n (jqXHR,  textStatus , errorThr own) {
  489                         //System E rror
  490                         alert("Err or: Unable  to add th e addition al signers  selected  to this ad dendum.\n\ nPlease re view the n ote and si gners in y our Vista/ CPRS appli cation!");
  491                    },
  492                    asyn c: false,
  493                    cach e: false
  494                });
  495  
  496                if (vadi _localStor ageVarName  != "" &&  vadi_local StorageVar Name != nu ll) {
  497                    //Cl ear existi ng session  storage v ariable.
  498                    loca lStorage.r emoveItem( vadi_local StorageVar Name);
  499                }
  500           }
  501  
  502           // Perform st andard for m updates  to signify  completio n
  503           // Write Succ ess entry
  504           Xr m.Page.get Attribute( 'descripti on').setVa lue(vadi_n oteDescrip tion);
  505           Xr m.Page.get Attribute( 'descripti on').setSu bmitMode(' always');
  506           Xr m.Page.get Attribute( 'ftp_integ rationstat us').setVa lue(vadi_i ntegration Status);
  507           Xr m.Page.get Attribute( 'ftp_integ rationstat us').setSu bmitMode(' always');
  508           Xr m.Page.get Attribute( 'ftp_integ rationerro r').setVal ue(null);
  509           Xr m.Page.get Attribute( 'ftp_integ rationerro r').setSub mitMode('a lways');
  510           Xr m.Page.get Attribute( 'ftp_integ rationdate ').setValu e(new Date ());
  511           Xr m.Page.get Attribute( 'ftp_integ rationdate ').setSubm itMode('al ways');
  512           Xr m.Page.get Attribute( 'ftp_adden dumnoteid' ).setValue (vadi_inte grationNot eId);
  513           Xr m.Page.get Attribute( 'ftp_adden dumnoteid' ).setSubmi tMode('alw ays');
  514           Xr m.Page.get Control('f tp_integra tionstatus ').setFocu s();
  515           al ert('The a ddendum cr eation in  VistA/CPRS  was succe ssful, thi s addendum  will now  be marked  as complet ed. \n\nPl ease exit  this adden dum record  after cli cking OK t o this pro mpt!');
  516           Xr m.Page.ui. clearFormN otificatio n("SAVEVIS TA");
  517           Xr m.Page.dat a.entity.s ave();
  518       }
  519       catch  (err) {
  520           al ert('Adden dum Ribbon  Function  Error(vadi _finalizeA ddendumCre ation): '  + err.mess age);
  521           Xr m.Page.ui. clearFormN otificatio n("SAVEVIS TA");
  522       }
  523   }
  524  
  525   function v adi_UserHa sTeam(team Name, user Guid) {
  526       try {
  527           va r vadi_tea mid = null ;
  528           va r vadi_cur rentUserId  = userGui d;
  529           va r vadi_con ditionalFi lter = "(N ame eq '"  + teamName  + "')";
  530           va r vadi_tea mData = va di_getMult ipleEntity DataSync(' TeamSet',  'TeamId',  vadi_condi tionalFilt er, 'Name' , 'asc', 0 );
  531           if  (vadi_tea mData != n ull) {
  532                for (var  i = 0; i  <= vadi_te amData.d.r esults.len gth - 1; i ++) {
  533                    //Ge t Info
  534                    if ( vadi_teamD ata.d.resu lts[i].Tea mId != nul l) { vadi_ teamid = v adi_teamDa ta.d.resul ts[i].Team Id; }
  535                    brea k;
  536                }
  537           }
  538           // If Team ex ists, chec k if the c urrent use r is part  of that te am
  539           va r vadi_tea mMembershi pId = null ;
  540           if  (vadi_tea mid != nul l && vadi_ currentUse rId != nul l) {
  541                var vadi _condition alFilter =  "(TeamId  eq (guid'"  + vadi_te amid + "')  and Syste mUserId eq  (guid'" +  vadi_curr entUserId  + "'))";
  542                var vadi _teamMembe rshipData  = vadi_get MultipleEn tityDataSy nc('TeamMe mbershipSe t', 'TeamI d, SystemU serId,Team Membership Id', vadi_ conditiona lFilter, ' TeamId', ' asc', 0);
  543                if (vadi _teamMembe rshipData  != null) {
  544                    for  (var i = 0 ; i <= vad i_teamMemb ershipData .d.results .length -  1; i++) {
  545                         //Get Info
  546                         if (vadi_t eamMembers hipData.d. results[i] .TeamMembe rshipId !=  null) { v adi_teamMe mbershipId  = vadi_te amMembersh ipData.d.r esults[i]. TeamMember shipId; }
  547                         break;
  548                    }
  549                }
  550           }
  551           if  (vadi_tea mMembershi pId != nul l) { retur n true; }
  552  
  553           // otherwise  return fal se                 
  554           re turn false ;
  555       }
  556       catch  (err) {
  557           // Display Er ror
  558           al ert("An er ror occure d in the v adi_UserHa sTeam func tion.  Err or Detail  Message: "  + err);
  559       }
  560   }
  561  
  562   function v adi_getCoo kie(cname)  {
  563       try {
  564           va r name = c name + "=" ;
  565           va r ca = doc ument.cook ie.split(' ;');
  566           fo r (var i =  0; i < ca .length; i ++) {
  567                var c =  ca[i];
  568                while (c .charAt(0)  == ' ') {
  569                    c =  c.substrin g(1);
  570                }
  571                if (c.in dexOf(name ) == 0) {
  572                    retu rn c.subst ring(name. length, c. length);
  573                }
  574           }
  575           re turn "";
  576       }
  577       catch  (err) {
  578           al ert('Adden dum Ribbon  Function  Error(vadi _getCookie ): ' + err .message);
  579       }
  580   }
  581  
  582   function v adi_wordWr ap(str, in tWidth, st rBreak, cu t) {
  583       try {
  584           // Takes a st ring that  exceeds a  set length  and inser ts word wr ap
  585           va r m = ((ar guments.le ngth >= 2)  ? argumen ts[1] : 75 )
  586           va r b = ((ar guments.le ngth >= 3)  ? argumen ts[2] : '\ n')
  587           va r c = ((ar guments.le ngth >= 4)  ? argumen ts[3] : fa lse)
  588  
  589           va r i, j, l,  s, r
  590  
  591           st r += ''
  592  
  593           if  (m < 1) {
  594                return s tr
  595           }
  596  
  597           fo r (i = -1,  l = (r =  str.split( /\r\n|\n|\ r/)).lengt h; ++i < l ; r[i] +=  s) {
  598                for (s =  r[i], r[i ] = '';
  599                    s.le ngth > m;
  600                    r[i]  += s.slic e(0, j) +  ((s = s.sl ice(j)).le ngth ? b :  '')) {
  601                    j =  c === 2 ||  (j = s.sl ice(0, m +  1).match( /\S*(\s)?$ /))[1]
  602                         ? m
  603                         : j.input. length - j [0].length  || c ===  true && m  ||
  604                         j.input.le ngth + (j  = s.slice( m).match(/ ^\S*/))[0] .length
  605                }
  606           }
  607  
  608           re turn r.joi n('\n')
  609       }
  610       catch  (err) {
  611           al ert('Adden dum Ribbon  Function  Error(vadi _wordWrap) : ' + err. message);
  612       }
  613   }
  614  
  615  
  616   function v adi_execut eCrmOdataG etRequest( vadi_jsonQ uery, vadi _aSync, va di_aSyncCa llback, va di_skipCou nt, vadi_o ptionArray ) {
  617       //This  function  executes a  CRM Odata  web servi ce call to  retrieve  Crm data
  618       //*vad i_jsonQuer y* - a pro perly form atted CRM  Odata Quer y string ( required)
  619       //*vad i_aSync* -  specify ' true' to e xecute asy nchronousl y otherwis e 'false'  (required)
  620       //*vad i_aSyncCal lback* - s pecify the  name of t he return  function t o call upo n completi on (requir ed if vadi _aSync = t rue.  Othe rwise '')
  621       //*vad i_skipCoun t* - Initi al setting  is always  '0', incr ements by  50 per CRM  SDK Odata  standards  (required )
  622       //*vad i_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)
  623       try {
  624           va r vadi_ent ityData =  null;
  625           $. ajax({
  626                type: 'G ET',
  627                contentT ype: 'appl ication/js on; charse t=utf-8',
  628                datatype : 'json',
  629                url: vad i_jsonQuer y,
  630                beforeSe nd: functi on (XMLHtt pRequest)  {
  631                    XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json');
  632                },
  633                success:  function  (data, tex tStatus, X mlHttpRequ est) {
  634                    vadi _entityDat a = data;
  635                    if ( vadi_aSync  == true)  {
  636                         vadi_aSync Callback(v adi_entity Data, vadi _skipCount , vadi_opt ionArray);
  637                    }
  638                },
  639                error: f unction (X MLHttpRequ est, textS tatus, err orThrown)  {
  640                    aler t('Fail: A jax Error  in vadi_ex ecuteCrmOd ataGetRequ est: ' + e rrorThrown  + " Reque st: " + va di_jsonQue ry);
  641                },
  642                async: v adi_aSync,
  643                cache: f alse
  644           }) ;
  645           re turn vadi_ entityData ;
  646       }
  647       catch  (err) {
  648           al ert('An er ror occure d in the v adi_execut eCrmOdataG etRequest  function.   Error Det ail Messag e: ' + err );
  649       }
  650   }
  651  
  652   function v adi_getMul tipleEntit yDataAsync (vadi_enti tySetName,  vadi_attr ibuteSet,  vadi_condi tionalFilt er, vadi_s ortAttribu te, vadi_s ortDirecti on, vadi_s kipCount,  vadi_aSync Callback,  vadi_optio nArray) {
  653       //This  function  returns a  CRM JSON d ataset for  all entit y records  matching c riteria pr ovided Asy ncronously
  654       //*vad i_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  655       //*vad i_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  656       //*vad i_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
  657       //*vad i_sortAttr ibute* - i s a string  containin g the name  of the at tribute to  sort the  result set  by e.g. ' LastName'
  658       //*vad i_sortDire ction* - i s a string  specifyin g the sort  as Ascend ing or Des cending e. g. 'asc' o r 'desc'
  659       //*vad i_skipCoun t* - is th e starting  point in  the result  (use if m ore than 5 0), (Put 0  if not us ed)
  660       //*vad i_aSyncCal lback* - i s the name  of the fu nction to  call when  returning  the result
  661       //*vad i_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
  662  
  663       try {
  664           va r vadi_jso nQuery = v adi_server Url + vadi _crmOdataE ndPoint +  '/' + vadi _entitySet Name + '?$ select=' +  vadi_attr ibuteSet +  '&$filter =' + vadi_ conditiona lFilter +  '&$orderby =' + vadi_ sortAttrib ute + ' '  + vadi_sor tDirection  + '&$skip =' + vadi_ skipCount;
  665           va di_execute CrmOdataGe tRequest(v adi_jsonQu ery, true,  vadi_aSyn cCallback,  vadi_skip Count, vad i_optionAr ray);
  666       }
  667       catch  (err) {
  668           al ert('An er ror occure d in the v adi_getMul tipleEntit yDataAsync  function.   Error De tail Messa ge: ' + er r);
  669       }
  670   }
  671  
  672   function v adi_getSin gleEntityD ataSync(va di_entityS etName, va di_attribu teSet, vad i_entityId ) {
  673       //This  function  returns a  CRM JSON d ataset for  a single  entity rec ord based  on the ent ity id pro vided Sync ronously
  674       //*vad i_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  675       //*vad i_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  676       //*vad i_entityId * - is the  Guid for  the entity  record
  677  
  678       try {
  679           va r vadi_ent ityIdNoBra cket = vad i_entityId .replace(/ ({|})/g, ' ');
  680           va r vadi_sel ectString  = '(guid'  + "'" + va di_entityI dNoBracket  + "'" + ' )?$select= ' + vadi_a ttributeSe t;
  681           va r vadi_jso nQuery = v adi_server Url + vadi _crmOdataE ndPoint +  '/' + vadi _entitySet Name + vad i_selectSt ring;
  682           va r vadi_ent ityData =  vadi_execu teCrmOdata GetRequest (vadi_json Query, fal se, '', 0,  null);
  683           re turn vadi_ entityData ;
  684       }
  685       catch  (err) {
  686           al ert('An er ror occure d in the v adi_getSin gleEntityD ataSync fu nction.  E rror Detai l Message:  ' + err);
  687       }
  688   }
  689  
  690   function v adi_getMul tipleEntit yDataSync( vadi_entit ySetName,  vadi_attri buteSet, v adi_condit ionalFilte r, vadi_so rtAttribut e, vadi_so rtDirectio n, vadi_sk ipCount) {
  691       //This  function  returns a  CRM JSON d ataset for  all entit y records  matching c riteria pr ovided Syn cronously
  692       //*vad i_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  693       //*vad i_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  694       //*vad i_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
  695       //*vad i_sortAttr ibute* - i s a string  containin g the name  of the at tribute to  sort the  result set  by e.g. ' LastName'
  696       //*vad i_sortDire ction* - i s a string  specifyin g the sort  as Ascend ing or Des cending e. g. 'asc' o r 'desc'
  697       //*vad i_skipCoun t* - is th e starting  point in  the result  (use if m ore than 5 0), (Put 0  if not us ed)
  698  
  699       try {
  700           va r vadi_jso nQuery = v adi_server Url + vadi _crmOdataE ndPoint +  '/' + vadi _entitySet Name + '?$ select=' +  vadi_attr ibuteSet +  '&$filter =' + vadi_ conditiona lFilter +  '&$orderby =' + vadi_ sortAttrib ute + ' '  + vadi_sor tDirection  + '&$skip =' + vadi_ skipCount;
  701           va r vadi_ent ityData =  vadi_execu teCrmOdata GetRequest (vadi_json Query, fal se, '', va di_skipCou nt, null);
  702           re turn vadi_ entityData ;
  703       }
  704       catch  (err) {
  705           al ert('An er ror occure d in the v adi_getMul tipleEntit yDataSync  function.   Error Det ail Messag e: ' + err );
  706       }
  707   }