47. EPMO Open Source Coordination Office Redaction File Detail Report

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

47.1 Files compared

# Location File Last Modified
1 VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_1_0_0_15.zip\WebResources ftp_ProgressNoteSignerSearchjsProgressNoteSignerSe15D67D37-6253-E611-943F-0050568D743D Fri May 19 20:29:42 2017 UTC
2 VCCM.zip\VCCM\CRM_solutions\VCCMResources\VCCMResources_1_0_0_15.zip\WebResources ftp_ProgressNoteSignerSearchjsProgressNoteSignerSe15D67D37-6253-E611-943F-0050568D743D Thu Nov 30 17:18:52 2017 UTC

47.2 Comparison summary

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

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

47.4 Active regular expressions

No regular expressions were active.

47.5 Comparison detail

  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   //Progress NoteSigner SearchScri ptLib.js
  5   //Contains  variables  and funct ions used  by the Pro gressNoteS ignerSearc h.html pag e
  6  
  7   //Static V ariables
  8   var pnss_c rmOdataEnd Point = '/ XRMService s/2011/Org anizationD ata.svc';
  9   var pnss_c ontext = G etGlobalCo ntext();
  10   var pnss_s erverUrl =  pnss_cont ext.getCli entUrl();
  11  
  12   var pnss_o rgName = p nss_contex t.getOrgUn iqueName() ;
  13   var pnss_u serId = pn ss_context .getUserId ();
  14   var pnss_u serSiteId  = '';
  15   var pnss_U serSiteNo  = '';
  16   var pnss_d uz = '';
  17   var pnss_p rovidernam e = '';
  18   var pnss_b aseService EndpointUr l = null;
  19   var pnss_r equestingA pp = null;
  20   var pnss_c onsumingAp pToken = n ull;
  21   var pnss_c onsumingAp pPassword  = null;
  22  
  23   //var pnss _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
  24   var pnss_V istaUsersU RLbase = ' ';
  25  
  26   function p nss_Settin gsWebServi ceURL_resp onse(pnss_ settingDat a, pnss_la stSkip, pn ss_Blank_N A) {
  27       try {
  28           // pnss_lastS kip is the  starting  point in t he result  (use if mo re than 50  records)  //Not used  in this s cenario
  29           va r pnss_Dac Url = null ;
  30           va r pnss_Vis taUserApiU rl = null;
  31  
  32           fo r (var i =  0; i <= p nss_settin gData.d.re sults.leng th - 1; i+ +) {
  33                //Get in fo
  34                if (pnss _settingDa ta.d.resul ts[i].ftp_ DACURL !=  null) { pn ss_DacUrl  = pnss_set tingData.d .results[i ].ftp_DACU RL; }
  35                if (pnss _settingDa ta.d.resul ts[i].ftp_ VistaUsers APIURL !=  null) { pn ss_VistaUs erApiUrl =  pnss_sett ingData.d. results[i] .ftp_Vista UsersAPIUR L; }
  36                if (pnss _settingDa ta.d.resul ts[i].ftp_ VIAService BaseURL !=  null) { p nss_baseSe rviceEndpo intUrl = p nss_settin gData.d.re sults[i].f tp_VIAServ iceBaseURL ; }
  37                if (pnss _settingDa ta.d.resul ts[i].ftp_ VIARequest ingApplica tionCode ! = null) {  pnss_reque stingApp =  pnss_sett ingData.d. results[i] .ftp_VIARe questingAp plicationC ode; }
  38                if (pnss _settingDa ta.d.resul ts[i].ftp_ VIAConsumi ngApplicat ionToken ! = null) {  pnss_consu mingAppTok en = pnss_ settingDat a.d.result s[i].ftp_V IAConsumin gApplicati onToken; }
  39                if (pnss _settingDa ta.d.resul ts[i].ftp_ VIAConsumi ngApplicat ionPasswor d != null)  { pnss_co nsumingApp Password =  pnss_sett ingData.d. results[i] .ftp_VIACo nsumingApp licationPa ssword; }
  40                break;
  41           }
  42           if  (pnss_Dac Url != nul l && pnss_ VistaUserA piUrl != n ull) {
  43                //Constr uct full w eb service  URL
  44                pnss_Vis taUsersURL base = pns s_DacUrl +  pnss_Vist aUserApiUr l;
  45           }
  46           el se {
  47                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 ");
  48           }
  49  
  50           if  (pnss_bas eServiceEn dpointUrl  == null ||  pnss_requ estingApp  == null ||  pnss_cons umingAppTo ken == nul l || pnss_ consumingA ppPassword  == null)  {
  51                parent.X rm.Page.ui .setFormNo tification ("ERROR: T HE 'VIA Se rvice Conn ector' CON FIGURATION  IS MISSIN G DATA IN  THE 'Setti ngs Entity ', PLEASE  CONTACT TE CHNICAL SU PPORT!", " ERROR", "V ISTASERVIC E");
  52           }
  53           // Decrypt VI A Service  Connector  Items
  54           pn ss_request ingApp = p nss_decryp tServiceCo nnector(pn ss_request ingApp, 4) ;
  55           pn ss_consumi ngAppToken  = pnss_de cryptServi ceConnecto r(pnss_con sumingAppT oken, 6);
  56           pn ss_consumi ngAppPassw ord = pnss _decryptSe rviceConne ctor(pnss_ consumingA ppPassword , 8);
  57       }
  58       catch  (err) {
  59           al ert('Progr ess Note S igner Sear ch Web Res ource Func tion Error (pnss_Sett ingsWebSer viceURL_re sponse): '  + err.mes sage);
  60       }
  61   }
  62  
  63   function p nss_decryp tServiceCo nnector(pn ss_connect orArray, p nss_connec torValue)  {
  64       var pn ss_decrypt edString =  "";
  65       if (pn ss_connect orArray !=  null && p nss_connec torArray ! = "") {
  66           va r pnss_new Array = pn ss_connect orArray.to String().s plit(',');
  67           pn ss_newArra y.reverse( );
  68           fo r (i = 0;  i < pnss_n ewArray.le ngth; i++)  {
  69                var pnss _curChar =  "";
  70                if (i ==  0) {
  71                    pnss _curChar =  pnss_newA rray[i] -  pnss_conne ctorValue;
  72                }
  73                else {
  74                    pnss _curChar =  pnss_newA rray[i] -  (i + pnss_ connectorV alue);
  75                }
  76                pnss_dec ryptedStri ng = pnss_ decryptedS tring + St ring.fromC harCode(pn ss_curChar );
  77           }
  78       }
  79       return  pnss_decr yptedStrin g;
  80   }
  81  
  82   function p nss_formLo ad() {
  83       try {
  84           // Proceed to  grid data  load....
  85           pn ss_createL ookupContr ol();
  86           pn ss_createS electedCon trol();
  87  
  88           // Set focus  to cancel  button if  Tab_Additi onalSigner s is Visib le
  89           if  (parent.X rm.Page.ui .tabs.get( 'Tab_Addit ionalSigne rs').getVi sible() ==  true) {
  90                document .getElemen tById('btn Cancel').f ocus();
  91           }
  92  
  93           // Check if V IA Login c ookie exis t (not exp ired)
  94           va r pnss_Via LoginCooki e = pnss_g etCookie(" viasession link");
  95  
  96           if  (pnss_Via LoginCooki e != null  && pnss_Vi aLoginCook ie != '')  {
  97                var pnss _cookiearr ay = pnss_ ViaLoginCo okie.split ("~~~~", 2 );
  98                pnss_duz  = pnss_co okiearray[ 0];
  99                pnss_pro vidername  = pnss_coo kiearray[1 ];
  100           }
  101  
  102           // Check Cook ie return  values if  missing ex it
  103           if  (pnss_duz  == '' ||  pnss_provi dername ==  '') { ret urn false;  }
  104  
  105           // GET CRM SE TTINGS WEB  SERVICE U RLS
  106           va r pnss_con ditionalFi lter = "(m cs_name eq  'Active S ettings')" ;
  107           pn ss_getMult ipleEntity DataAsync( 'mcs_setti ngSet', 'f tp_VIAServ iceBaseURL , ftp_VIAR equestingA pplication Code, ftp_ VIAConsumi ngApplicat ionToken,  ftp_VIACon sumingAppl icationPas sword, ftp _DACURL, f tp_VistaUs ersAPIURL' , pnss_con ditionalFi lter, 'mcs _name', 'a sc', 0, pn ss_Setting sWebServic eURL_respo nse, '');
  108  
  109           // Get the cu rrent CRM  User's ass igned site /facility
  110           va r pnss_use rData = pn ss_getSing leEntityDa taSync('Sy stemUserSe t', 'ftp_F acilitySit eId', pnss _userId);
  111           if  (pnss_use rData != n ull) {
  112                if (pnss _userData. d.ftp_Faci litySiteId  != null)  {
  113                    pnss _userSiteI d = pnss_u serData.d. ftp_Facili tySiteId.I d;
  114                }
  115           }
  116  
  117           // Lookup the  Facility/ Site #
  118           if  (pnss_use rSiteId !=  null && p nss_userSi teId != '' ) {
  119                var pnss _facilityD ata = pnss _getSingle EntityData Sync('ftp_ facilitySe t', 'ftp_f acilitycod e', pnss_u serSiteId) ;
  120                if (pnss _facilityD ata != nul l) {
  121                    if ( pnss_facil ityData.d. ftp_facili tycode !=  null) { pn ss_UserSit eNo = pnss _facilityD ata.d.ftp_ facilityco de; }
  122                }
  123           }
  124       }
  125       catch  (err) {
  126           al ert('Progr ess Note S igner Sear ch Web Res ource Func tion Error (pnss_form Load): ' +  err.messa ge);
  127       }
  128   }
  129  
  130   function p nss_select AddGridRow (arg) {
  131       try {
  132           va r pnss_sel ectedRows  = this.sel ect();
  133           va r pnss_sel ectedDataI tems = [];
  134           va r pnss_rec ordID = nu ll;
  135           va r pnss_rec ordType =  null;
  136           va r pnss_rec ordIconURL  = null;
  137           va r pnss_rec ordName =  null;
  138           va r pnss_rec ordIEN = n ull;
  139           fo r (var i =  0; i < pn ss_selecte dRows.leng th; i++) {
  140                pnss_gri dDataItem  = this.dat aItem(pnss _selectedR ows[i]);
  141                pnss_rec ordID = pn ss_gridDat aItem.ID
  142                pnss_rec ordType =  pnss_gridD ataItem.Ty pe;
  143                pnss_rec ordIconURL  = pnss_gr idDataItem .IconURL;
  144                pnss_rec ordName =  pnss_gridD ataItem.Na me;
  145                pnss_rec ordIEN = p nss_gridDa taItem.IEN ;
  146           }
  147  
  148           va r pnss_ent itySearchG rid = $('# ku_lookupg rid').data ('kendoGri d');
  149           va r pnss_ent itySelecte dGrid = $( '#ku_selec tedgrid'). data('kend oGrid');
  150  
  151           if  (pnss_rec ordID != n ull) {
  152                //Add to  selected  grid
  153                //Determ ine if it  already ex ist, if so  cancel ad d...
  154                if (pnss _entitySel ectedGrid. dataSource .get(pnss_ recordID)  == null) {
  155                    pnss _entitySel ectedGrid. dataSource .pushCreat e({
  156                         ID: pnss_r ecordID,
  157                         Type: pnss _recordTyp e,
  158                         IconURL: p nss_record IconURL,
  159                         Name: pnss _recordNam e,
  160                         IEN: pnss_ recordIEN
  161                    });
  162                }
  163                //Remove  row from  lookup gri d
  164                pnss_ent itySearchG rid.dataSo urce.remov e(pnss_gri dDataItem) ;
  165           }
  166       }
  167       catch  (err) {
  168           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_selectA ddGridRow) : ' + err. message);
  169       }
  170   }
  171  
  172   function p nss_select RemoveGrid Row(arg) {
  173       try {
  174           // Disable se lect if di sabled
  175           if  (document .getElemen tById('btn Select').d isabled ==  true) { r eturn fals e; }
  176  
  177           va r pnss_sel ectedRows  = this.sel ect();
  178           va r pnss_sel ectedDataI tems = [];
  179           va r pnss_rec ordID = nu ll;
  180           va r pnss_rec ordType =  null;
  181           va r pnss_rec ordIconURL  = null;
  182           va r pnss_rec ordName =  null;
  183           fo r (var i =  0; i < pn ss_selecte dRows.leng th; i++) {
  184                pnss_gri dDataItem  = this.dat aItem(pnss _selectedR ows[i]);
  185                pnss_rec ordID = pn ss_gridDat aItem.ID
  186                pnss_rec ordType =  pnss_gridD ataItem.Ty pe;
  187                pnss_rec ordIconURL  = pnss_gr idDataItem .IconURL;
  188                pnss_rec ordName =  pnss_gridD ataItem.Na me;
  189           }
  190  
  191           va r pnss_ent itySearchG rid = $('# ku_lookupg rid').data ('kendoGri d');
  192           va r pnss_ent itySelecte dGrid = $( '#ku_selec tedgrid'). data('kend oGrid');
  193  
  194           if  (pnss_rec ordID != n ull) {
  195                //Remove  row from  selected g rid
  196                pnss_ent itySelecte dGrid.data Source.rem ove(pnss_g ridDataIte m);
  197           }
  198       }
  199       catch  (err) {
  200           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_selectR emoveGridR ow): ' + e rr.message );
  201       }
  202   }
  203  
  204   function p nss_clickA ddGridRow( e) {
  205       try {
  206           va r pnss_gri dDataItem  = this.dat aItem($(e. currentTar get).close st('tr'));
  207           va r pnss_rec ordID = pn ss_gridDat aItem.ID;
  208           va r pnss_rec ordType =  pnss_gridD ataItem.Ty pe;
  209           va r pnss_rec ordIconURL  = pnss_gr idDataItem .IconURL;
  210           va r pnss_rec ordName =  pnss_gridD ataItem.Na me;
  211           va r pnss_rec ordIEN = p nss_gridDa taItem.IEN ;
  212  
  213           va r pnss_ent itySearchG rid = $('# ku_lookupg rid').data ('kendoGri d');
  214           va r pnss_ent itySelecte dGrid = $( '#ku_selec tedgrid'). data('kend oGrid');
  215  
  216           if  (pnss_rec ordID != n ull) {
  217                //Add to  selected  grid
  218                //Determ ine if it  already ex ist, if so  cancel ad d...
  219                if (pnss _entitySel ectedGrid. dataSource .get(pnss_ recordID)  == null) {
  220                    pnss _entitySel ectedGrid. dataSource .pushCreat e({
  221                         ID: pnss_r ecordID,
  222                         Type: pnss _recordTyp e,
  223                         IconURL: p nss_record IconURL,
  224                         Name: pnss _recordNam e,
  225                         IEN: pnss_ recordIEN
  226                    });
  227                }
  228                //Remove  row from  lookup gri d
  229                pnss_ent itySearchG rid.dataSo urce.remov e(pnss_gri dDataItem) ;
  230           }
  231       }
  232       catch  (err) {
  233           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_clickAd dGridRow):  ' + err.m essage);
  234       }
  235   }
  236  
  237   function p nss_clickR emoveGridR ow(e) {
  238       try {
  239           // Disable se lect if di sabled
  240           if  (document .getElemen tById('btn Select').d isabled ==  true) { r eturn fals e; }
  241  
  242           va r pnss_gri dDataItem  = this.dat aItem($(e. currentTar get).close st('tr'));
  243           va r pnss_rec ordID = pn ss_gridDat aItem.ID;
  244           va r pnss_rec ordType =  pnss_gridD ataItem.Ty pe;
  245           va r pnss_rec ordIconURL  = pnss_gr idDataItem .IconURL;
  246           va r pnss_rec ordName =  pnss_gridD ataItem.Na me;
  247  
  248           va r pnss_ent itySearchG rid = $('# ku_lookupg rid').data ('kendoGri d');
  249           va r pnss_ent itySelecte dGrid = $( '#ku_selec tedgrid'). data('kend oGrid');
  250  
  251           if  (pnss_rec ordID != n ull) {
  252                //Remove  row from  selected g rid
  253                pnss_ent itySelecte dGrid.data Source.rem ove(pnss_g ridDataIte m);
  254           }
  255       }
  256       catch  (err) {
  257           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_clickRe moveGridRo w): ' + er r.message) ;
  258       }
  259   }
  260  
  261   function p nss_create LookupCont rol() {
  262       try {
  263           va r pnss_add ButtonText  = " Add " ;
  264           $( '#ku_looku pgrid').ke ndoGrid({
  265                columns:  [
  266                    { fi eld: 'ID',  type: 'st ring', hid den: true  },
  267                    { fi eld: 'Type ', type: ' string', h idden: tru e },
  268                    { fi eld: 'Icon URL', type : 'string' , hidden:  true },
  269                    {
  270                         template:  "<div clas s='entity- icon'" +
  271                               "sty le='backgr ound-image : url(#:da ta.IconURL #);' title ='#: Type  # - #: Nam e #'></div >" +
  272                               "<di v title='# : Type # -  #: Name # ' class='e ntity-labe l'>#: Name  #</div>",
  273                         field: 'Na me', title : 'Name',  type: 'str ing'
  274                    },
  275                    { fi eld: 'IEN' , type: 's tring', hi dden: true  },
  276                    { co mmand: { t ext: pnss_ addButtonT ext, click : pnss_cli ckAddGridR ow }, titl e: ' ', wi dth: '110p x' }
  277                ],
  278                dataSour ce: {
  279                    sche ma: {
  280                         model: {
  281                             id: 'I D'
  282                         }
  283                    }
  284                },
  285                groupabl e: false,
  286                sortable : false,
  287                editable : false,
  288                height:  300,
  289                resizabl e: true,
  290                navigata ble: true,
  291                selectab le: "row",
  292                noRecord s: true,
  293                change:  pnss_selec tAddGridRo w
  294           }) ;
  295       }
  296       catch  (err) {
  297           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_createL ookupContr ol) Error  Detail: '  + err.mess age);
  298           re turn null;
  299       }
  300   }
  301  
  302   function p nss_create SelectedCo ntrol() {
  303       try {
  304           va r pnss_rem oveButtonT ext = " Re move ";
  305           $( '#ku_selec tedgrid'). kendoGrid( {
  306                columns:  [
  307                    { fi eld: 'ID',  type: 'st ring', hid den: true  },
  308                    { fi eld: 'Type ', type: ' string', h idden: tru e },
  309                    { fi eld: 'Icon URL', type : 'string' , hidden:  true },
  310                    {
  311                         template:  "<div clas s='entity- icon'" +
  312                               "sty le='backgr ound-image : url(#:da ta.IconURL #);' title ='#: Type  # - #: Nam e #'></div >" +
  313                               "<di v title='# : Type # -  #: Name # ' class='e ntity-labe l'>#: Name  #</div>",
  314                         field: 'Na me', title : 'Name',  type: 'str ing'
  315                    },
  316                    { fi eld: 'IEN' , type: 's tring', hi dden: true  },
  317                    { co mmand: { t ext: pnss_ removeButt onText, cl ick: pnss_ clickRemov eGridRow } , title: '  ', width:  '110px' }
  318                ],
  319                dataSour ce: {
  320                    sche ma: {
  321                         model: {
  322                             id: 'I D'
  323                         }
  324                    }
  325                },
  326                groupabl e: false,
  327                sortable : false,
  328                editable : false,
  329                height:  300,
  330                resizabl e: true,
  331                navigata ble: true,
  332                selectab le: "row",
  333                noRecord s: true,
  334                change:  pnss_selec tRemoveGri dRow
  335           }) ;
  336  
  337           // Initalize  the select ed control  with valu es from CR M if they  exist
  338           va r pnss_sel ectedSigne rs = paren t.Xrm.Page .getAttrib ute('ftp_s electedsig ners').get Value();
  339           if  (pnss_sel ectedSigne rs != null  && pnss_s electedSig ners != '' ) {
  340                pnss_pop ulateSelec tedGrid(pn ss_selecte dSigners);
  341           }
  342       }
  343       catch  (err) {
  344           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_createS electedCon trol) Erro r Detail:  ' + err.me ssage);
  345           re turn null;
  346       }
  347   }
  348  
  349   function p nss_popula teSelected Grid(pnss_ selectedSi gners) {
  350       try {
  351           va r pnss_sel ectedArray  = pnss_se lectedSign ers.split( '~~~');
  352           va r pnss_sel ectedArray RecordCoun t = pnss_s electedArr ay.length;
  353           va r pnss_ent itySelecte dGrid = $( '#ku_selec tedgrid'). data('kend oGrid');
  354  
  355           va r pnss_sel ectedIENAr ray = '';
  356           va r pnss_sel ectedIENAr rayRecordC ount = 0;
  357           va r pnss_pro gressNoteI d = parent .Xrm.Page. data.entit y.getId();
  358  
  359           va r pnss_arr ayMismatch  = false;
  360  
  361           // Determine  if NEW or  INT status  of array.  (NEW - no t processe d, INT - I NT is inte grated not e)
  362           if  (pnss_sel ectedArray [0] == 'IN T') {
  363                //Disabl e controls  when not  NEW
  364                document .getElemen tById('sea rchtext'). disabled =  true;
  365                document .getElemen tById('sea rchbuttoni d').disabl ed = true;
  366                document .getElemen tById('btn Select').d isabled =  true;
  367                //Change  title of  the cancel  button
  368                document .getElemen tById('btn Cancel').v alue = 'Cl ose Search ';
  369                document .getElemen tById('btn Cancel').t itle = 'Cl ick here t o close th e search f orm.';
  370                //Hide t he grid's  remove but ton column
  371                pnss_ent itySelecte dGrid.hide Column(4);
  372           }
  373  
  374           // Get Note's  Browser L ocal Stora ge Values
  375           if  (pnss_pro gressNoteI d != null  && pnss_pr ogressNote Id != '')  {
  376                var pnss _localStor ageVarName  = "PN" +  pnss_progr essNoteId;
  377                var pnss _localStor ageStringV alue = loc alStorage. getItem(pn ss_localSt orageVarNa me);
  378                if (pnss _localStor ageStringV alue != nu ll && pnss _localStor ageStringV alue != '' ) {
  379                    //al ert("local  storage v alue: " +  pnss_local StorageStr ingValue);
  380                    pnss _selectedI ENArray =  pnss_local StorageStr ingValue.s plit('~~~' );
  381                    pnss _selectedI ENArrayRec ordCount =  pnss_sele ctedIENArr ay.length;
  382                    //al ert("Local StorageArr ayLength:  " + pnss_s electedIEN ArrayRecor dCount);
  383                }
  384           }
  385  
  386           // Compare CR M signer a rray lengt h with Loc alStorage  array leng th
  387           if  (pnss_sel ectedArray RecordCoun t != pnss_ selectedIE NArrayReco rdCount) {  pnss_arra yMismatch  = true; }
  388  
  389           // *****TESTI NG****
  390           if  (pnss_arr ayMismatch  == true)  {
  391                //alert( "TEST MESS AGE: IEN/C RM, select ed signers  mismatch" );
  392           }
  393           el se {
  394                //alert( "TEST MESS AGE: IEN/C RM, select ed signers  MATCH!");
  395           }
  396           // ********** ******
  397  
  398  
  399           // Add previo usly selec ted users
  400           fo r (var i =  1; i < pn ss_selecte dArrayReco rdCount; i ++) {
  401                //***SPL IT ID & NA ME***
  402                var pnss _recordIdN ame = (pns s_selected Array[i]). split('___ ');
  403                //var pn ss_recordI D = (pnss_ selectedAr ray[i]).su bstring(4) ;
  404                var pnss _recordID  = (pnss_re cordIdName [0]).subst ring(4);
  405                //var pn ss_recordT ype = (pns s_selected Array[i]). substring( 0, 4);
  406                var pnss _recordTyp e = (pnss_ recordIdNa me[0]).sub string(0,  4);
  407  
  408                var pnss _recordNam e = pnss_r ecordIdNam e[1];
  409                //alert( pnss_recor dName);
  410  
  411                if (pnss _arrayMism atch != tr ue) {
  412                    var  pnss_recor dIEN = pns s_selected IENArray[i ];
  413                }
  414                else {
  415                    var  pnss_recor dIEN = '0' ;
  416                }
  417  
  418                var pnss _recordIco nURL = '';
  419                if (pnss _recordTyp e == 'USER ') { pnss_ recordIcon URL = 'img /ico_user. gif'; }
  420                //Insert  in select ed grid
  421                pnss_ent itySelecte dGrid.data Source.pus hCreate({
  422                    ID:  pnss_recor dIEN,
  423                    Type : pnss_rec ordType,
  424                    Icon URL: pnss_ recordIcon URL,
  425                    Name : pnss_rec ordName,
  426                    IEN:  pnss_reco rdIEN
  427                });
  428           }
  429  
  430       }
  431       catch  (err) {
  432           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_populat eSelectedG rid) Error  Detail: '  + err.mes sage);
  433           re turn null;
  434       }
  435   }
  436  
  437   function p nss_search LookupEnti ty() {
  438       try {
  439           // Populate S ystemUser  Lookup Gri d
  440           va r pnss_ent itySearchG rid = $('# ku_lookupg rid').data ('kendoGri d');
  441           pn ss_getViaU sersData(p nss_entity SearchGrid );
  442       }
  443       catch  (err) {
  444           // Display Er ror
  445           al ert('Progr ess Note S igner Sear ch Script  Failure Fu nction(pns s_searchLo okupEntity ) Error De tail: ' +  err);
  446       }
  447   }
  448  
  449   function p nss_getVia UsersData( pnss_cprsU serGridCon trol) {
  450       try {
  451           va r pnss_sea rchString  = document .getElemen tById('sea rchtext'). value;
  452           // Clear exis ting grid
  453           pn ss_cprsUse rGridContr ol.dataSou rce.data([ ]);
  454           // Make sure  there is a  text valu e
  455           if  (pnss_sea rchString  == null ||  pnss_sear chString = = '') { re turn false ; }
  456           // Verify the  user is l ogged in t o VIA
  457           if  (pnss_duz  == '' ||  pnss_provi dername ==  '') {
  458                alert("P lease logi n to VistA , before y ou begin a  search!")
  459                return f alse;
  460           }
  461           // Execute cp rsUserLook up Service
  462           vi alib_cprsU serLookup( pnss_reque stingApp,  pnss_consu mingAppTok en, pnss_c onsumingAp pPassword,  pnss_base ServiceEnd pointUrl,  pnss_provi dername, p nss_duz, p nss_UserSi teNo, pnss _searchStr ing, pnss_ getViaUser sData_resp onse, pnss _cprsUserG ridControl );
  463       }
  464       catch  (err) {
  465           // Display Er ror
  466           al ert('Progr ess Note S igner Sear ch Script  Failure Fu nction(pns s_getViaUs ersData) E rror Detai l: ' + err );
  467       }
  468   }
  469  
  470   function p nss_getVia UsersData_ response(p nss_error,  pnss_cprs userlookup response,  pnss_exter nalObject)  {
  471       try {
  472           // Check for  non VIA se rvice erro r
  473           if  (pnss_err or != null ) {
  474                alert("T he VIA cpr sUserLooku p service  failed wit h error: "  + pnss_cp rsuserlook upresponse );
  475                return f alse;
  476           }
  477           // Test for V IA Service  Error
  478           if  (pnss_cpr suserlooku presponse. getElement sByTagName ("fault"). length > 0 ) {
  479                alert("V IA cprsUse rLookup Se rvice Erro r: " + pns s_cprsuser lookupresp onse.getEl ementsByTa gName("fau lt")[0].te xtContent) ;
  480                return f alse;
  481           }
  482           // Get VIA se rvice Resp onse
  483           if  (pnss_cpr suserlooku presponse. getElement sByTagName ("users")[ 0].childNo des.length  > 0) {
  484                var pnss _userlooku pArray = p nss_cprsus erlookupre sponse.get ElementsBy TagName("u sers")[0]. childNodes ;
  485                //Add us ers in res ult to gri d
  486                for (var  i = 0; i  <= pnss_us erlookupAr ray.length  - 1; i++)  {
  487                    //ch ildNodes[0 ] holds th e name, ch ildnodes[1 ] holds th e IEN, chi ldNodes[2]  holds the  title
  488                    var  pnss_ViaIE N = '';
  489                    var  pnss_ViaFu llName = ' ';
  490                    var  pnss_ViaTi tle = '';
  491                    if ( pnss_userl ookupArray [i].childN odes[1]) {  pnss_ViaI EN = pnss_ userlookup Array[i].c hildNodes[ 1].textCon tent; }
  492                    if ( pnss_userl ookupArray [i].childN odes[0]) {  pnss_ViaF ullName =  pnss_userl ookupArray [i].childN odes[0].te xtContent;  }
  493                    if ( pnss_userl ookupArray [i].childN odes[2]) {  pnss_ViaT itle = pns s_userlook upArray[i] .childNode s[2].textC ontent; }
  494                    if ( pnss_ViaIE N != '' &&  pnss_ViaF ullName !=  '') {
  495                         //Add to t he Grid
  496                         if (pnss_V iaTitle !=  '') { pns s_ViaFullN ame = pnss _ViaFullNa me + " " +  pnss_ViaT itle; }
  497                         pnss_exter nalObject. dataSource .pushCreat e({
  498                             ID: pn ss_ViaIEN,
  499                             Type:  'USER',
  500                             IconUR L: 'img/ic o_user.gif ',
  501                             Name:  pnss_ViaFu llName,
  502                             IEN: p nss_ViaIEN
  503                         });
  504                    }
  505                }
  506                return f alse;
  507           }
  508           el se {
  509                alert("* *No Via Us er Data Re turned**") ;
  510                return f alse;
  511           }
  512       }
  513       catch  (err) {
  514           // Display Er ror
  515           al ert('Progr ess Note S igner Sear ch Script  Failure Fu nction(pns s_getViaUs ersData_re sponse) Er ror Detail : ' + err) ;
  516       }
  517   }
  518  
  519   function p nss_search KeyPress(e vent) {
  520       try {
  521           // Determine  if 'enter'  key was p ressed if  so initiat e search
  522           va r pnss_key pressed =  event.whic h || event .keyCode;
  523           if  (pnss_key pressed ==  13) { pns s_searchLo okupEntity (); }
  524       }
  525       catch  (err) {
  526           // Display Er ror
  527           al ert('Progr ess Note S igner Sear ch Script  Failure Fu nction(pns s_searchKe yPress) Er ror Detail : ' + err) ;
  528       }
  529   }
  530  
  531   function p nss_applyP rogressNot eSigners()  {
  532       try {
  533           // Write the  selected u ser string ...
  534           va r pnss_sel ectedSigne rs = '';
  535           va r pnss_sel ectedIEN =  '';
  536           va r pnss_ent itySelecte dGrid = $( '#ku_selec tedgrid'). data('kend oGrid');
  537           // Determine  if records  have been  selected
  538           va r pnss_tot alSelected Records =  pnss_entit ySelectedG rid.dataSo urce.total ();
  539           if  (pnss_tot alSelected Records >  0) {
  540                //Add ea ch record  to the sel ected reco rd string  to be stor ed in CRM  (NEW indic ates that  it is an u nprocessed  array)
  541                pnss_sel ectedSigne rs = 'NEW' ;
  542                pnss_sel ectedIEN =  'NEW';
  543                var pnss _gridData  = pnss_ent itySelecte dGrid.data Source.dat a();
  544                var pnss _totalNumG ridRows =  pnss_gridD ata.length ;
  545  
  546                for (var  i = 0; i  < pnss_tot alNumGridR ows; i++)  {
  547                    var  pnss_curre ntGridData Row = pnss _gridData[ i];
  548                    var  pnss_gridR owID = (10 00 + i).to String();
  549                    pnss _selectedS igners = p nss_select edSigners  + '~~~' +  pnss_curre ntGridData Row.Type +  pnss_grid RowID + '_ __' + pnss _currentGr idDataRow. Name;
  550                    pnss _selectedI EN = pnss_ selectedIE N + '~~~'  + pnss_cur rentGridDa taRow.IEN;
  551                }
  552           }
  553  
  554           // Write to C RM field
  555           pa rent.Xrm.P age.getAtt ribute('ft p_selected signers'). setValue(p nss_select edSigners) ;
  556           // Enforce sa ve of valu es in read  only fiel d
  557           pa rent.Xrm.P age.getAtt ribute('ft p_selected signers'). setSubmitM ode('alway s');
  558  
  559           // Write to B rowser Loc alStorage
  560           va r pnss_pro gressNoteI d = parent .Xrm.Page. data.entit y.getId();
  561           if  (pnss_pro gressNoteI d != null)  {
  562                var pnss _localStor ageVarName  = "PN" +  pnss_progr essNoteId;
  563                if (pnss _selectedS igners !=  '') {
  564                    loca lStorage.s etItem(pns s_localSto rageVarNam e, pnss_se lectedIEN) ;
  565                }
  566                else {
  567                    //If  Selected  Signers is  blank, th en remove  LocalStora ge values
  568                    loca lStorage.r emoveItem( pnss_local StorageVar Name);
  569                }
  570           }
  571  
  572           // Set focus  to the mai n top tab  and hide c urrent tab
  573           pa rent.Xrm.P age.ui.tab s.get('Tab _General') .setFocus( );
  574           pa rent.Xrm.P age.ui.tab s.get('Tab _Additiona lSigners') .setVisibl e(false);
  575  
  576           // Save the c urrent CRM  data
  577           pa rent.Xrm.P age.data.e ntity.save ();
  578       }
  579       catch  (err) {
  580           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_applyPr ogressNote Signers) E rror Detai l: ' + err .message);
  581           re turn null;
  582       }
  583   }
  584  
  585   function p nss_cancel ProgressNo teSigners( ) {
  586       try {
  587           // Set focus  to the mai n top tab  and hide c urrent tab
  588           pa rent.Xrm.P age.ui.tab s.get('Tab _General') .setFocus( );
  589           pa rent.Xrm.P age.ui.tab s.get('Tab _Additiona lSigners') .setVisibl e(false);
  590       }
  591       catch  (err) {
  592           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction(pn ss_cancelP rogressNot eSigners)  Error Deta il: ' + er r.message) ;
  593           re turn null;
  594       }
  595   }
  596  
  597   function p nss_getCoo kie(cname)  {
  598       try {
  599           va r name = c name + "=" ;
  600           va r ca = doc ument.cook ie.split(' ;');
  601           fo r (var i =  0; i < ca .length; i ++) {
  602                var c =  ca[i];
  603                while (c .charAt(0)  == ' ') {
  604                    c =  c.substrin g(1);
  605                }
  606                if (c.in dexOf(name ) == 0) {
  607                    retu rn c.subst ring(name. length, c. length);
  608                }
  609           }
  610           re turn "";
  611       }
  612       catch  (err) {
  613           al ert('Progr ess Note S igner Sear ch Script  Failure: F unction Er ror(pnss_g etCookie):  ' + err.m essage);
  614       }
  615   }
  616  
  617   function p nss_execut eCrmOdataG etRequest( pnss_jsonQ uery, pnss _aSync, pn ss_aSyncCa llback, pn ss_skipCou nt, pnss_o ptionArray ) {
  618       //This  function  executes a  CRM Odata  web servi ce call to  retrieve  Crm data
  619       //*pns s_jsonQuer y* - a pro perly form atted CRM  Odata Quer y string ( required)
  620       //*pns s_aSync* -  specify ' true' to e xecute asy nchronousl y otherwis e 'false'  (required)
  621       //*pns s_aSyncCal lback* - s pecify the  name of t he return  function t o call upo n completi on (requir ed if pnss _aSync = t rue.  Othe rwise '')
  622       //*pns s_skipCoun t* - Initi al setting  is always  '0', incr ements by  50 per CRM  SDK Odata  standards  (required )
  623       //*pns s_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)
  624       try {
  625           va r pnss_ent ityData =  null;
  626           $. ajax({
  627                type: 'G ET',
  628                contentT ype: 'appl ication/js on; charse t=utf-8',
  629                datatype : 'json',
  630                url: pns s_jsonQuer y,
  631                beforeSe nd: functi on (XMLHtt pRequest)  {
  632                    XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json');
  633                },
  634                success:  function  (data, tex tStatus, X mlHttpRequ est) {
  635                    pnss _entityDat a = data;
  636                    if ( pnss_aSync  == true)  {
  637                         pnss_aSync Callback(p nss_entity Data, pnss _skipCount , pnss_opt ionArray);
  638                    }
  639                },
  640                error: f unction (X MLHttpRequ est, textS tatus, err orThrown)  {
  641                    aler t('Fail: A jax Error  in pnss_ex ecuteCrmOd ataGetRequ est: ' + e rrorThrown  + " Reque st: " + pn ss_jsonQue ry);
  642                },
  643                async: p nss_aSync,
  644                cache: f alse
  645           }) ;
  646           re turn pnss_ entityData ;
  647       }
  648       catch  (err) {
  649           al ert('An er ror occure d in the p nss_execut eCrmOdataG etRequest  function.   Error Det ail Messag e: ' + err );
  650       }
  651   }
  652  
  653   function p nss_execut eCrmOdataP ostRequest (pnss_json Query, pns s_aSync, p nss_jsonEn tityData,  pnss_recor dAction, p nss_crmGui dFieldName ) {
  654       //This  function  executes a  CRM Odata  web servi ce call to  create/up date a Crm  Record
  655       //*pns s_jsonQuer y* - the c omplete qu ery (url)  to be exec uted
  656       //*pns s_aSync* -  specify ' true' to e xecute asy nchronousl y otherwis e 'false'  (required)
  657       //*pns s_jsonEnti tyData* -  the crm en tity data  record to  be created /updated
  658       //*pns s_recordAc tion* - th e action t o be perfo rmed in CA PS 'CREATE ', 'UPDATE , 'DELETE'
  659       //*pns s_crmGuidF ieldName*  - the name  of the un ique ident ifier fiel d that has  the Guid/ Id for the  crm recor d created
  660  
  661       try {
  662           va r pnss_crm EntityId =  'FAIL';
  663  
  664           $. ajax({
  665                type: 'P OST',
  666                contentT ype: 'appl ication/js on; charse t=utf-8',
  667                datatype : 'json',
  668                url: pns s_jsonQuer y,
  669                data: pn ss_jsonEnt ityData,
  670                beforeSe nd: functi on (XMLHtt pRequest)  {
  671                    XMLH ttpRequest .setReques tHeader('A ccept', 'a pplication /json');
  672                    if ( pnss_recor dAction ==  'UPDATE')  { XMLHttp Request.se tRequestHe ader('X-HT TP-Method' , 'MERGE') ; }
  673                    if ( pnss_recor dAction ==  'DELETE')  { XMLHttp Request.se tRequestHe ader('X-HT TP-Method' , 'DELETE' ); }
  674                },
  675                success:  function  (data, tex tStatus, X mlHttpRequ est) {
  676                    if ( pnss_recor dAction ==  'CREATE')  { pnss_cr mEntityId  = data.d[p nss_crmGui dFieldName ].toString (); }
  677                },
  678                error: f unction (X mlHttpRequ est, textS tatus, err orThrown)  {
  679                    aler t('Ajax Er ror in pns s_executeC rmOdataPos tRequest:  ' + errorT hrown);
  680                    pnss _crmEntity Id = 'FAIL ';
  681                },
  682                async: p nss_aSync
  683           }) ;
  684           if  (pnss_rec ordAction  == 'CREATE ') { retur n pnss_crm EntityId;  }
  685       }
  686       catch  (err) {
  687           al ert('An er ror occure d in the p nss_execut eCrmOdataP ostRequest  function.   Error De tail Messa ge: ' + er r);
  688       }
  689   }
  690  
  691   function p nss_getMul tipleEntit yDataAsync (pnss_enti tySetName,  pnss_attr ibuteSet,  pnss_condi tionalFilt er, pnss_s ortAttribu te, pnss_s ortDirecti on, pnss_s kipCount,  pnss_aSync Callback,  pnss_optio nArray) {
  692       //This  function  returns a  CRM JSON d ataset for  all entit y records  matching c riteria pr ovided Asy ncronously
  693       //*pns s_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  694       //*pns s_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  695       //*pns s_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
  696       //*pns s_sortAttr ibute* - i s a string  containin g the name  of the at tribute to  sort the  result set  by e.g. ' LastName'
  697       //*pns s_sortDire ction* - i s a string  specifyin g the sort  as Ascend ing or Des cending e. g. 'asc' o r 'desc'
  698       //*pns s_skipCoun t* - is th e starting  point in  the result  (use if m ore than 5 0), (Put 0  if not us ed)
  699       //*pns s_aSyncCal lback* - i s the name  of the fu nction to  call when  returning  the result
  700       //*pns s_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
  701  
  702       try {
  703           va r pnss_jso nQuery = p nss_server Url + pnss _crmOdataE ndPoint +  '/' + pnss _entitySet Name + '?$ select=' +  pnss_attr ibuteSet +  '&$filter =' + pnss_ conditiona lFilter +  '&$orderby =' + pnss_ sortAttrib ute + ' '  + pnss_sor tDirection  + '&$skip =' + pnss_ skipCount;
  704           pn ss_execute CrmOdataGe tRequest(p nss_jsonQu ery, true,  pnss_aSyn cCallback,  pnss_skip Count, pns s_optionAr ray);
  705       }
  706       catch  (err) {
  707           al ert('An er ror occure d in the p nss_getMul tipleEntit yDataAsync  function.   Error De tail Messa ge: ' + er r);
  708       }
  709   }
  710  
  711   function p nss_getSin gleEntityD ataSync(pn ss_entityS etName, pn ss_attribu teSet, pns s_entityId ) {
  712       //This  function  returns a  CRM JSON d ataset for  a single  entity rec ord based  on the ent ity id pro vided Sync ronously
  713       //*pns s_entitySe tName* - i s the name  of the en tity set e .g 'Contac tSet'
  714       //*pns s_attribut eSet* -  i s a string  containin g the Crm  Attributes  to retrie ve e.g. 'F irstName,  LastName,  Telephone1 , EMailAdd ress1'
  715       //*pns s_entityId * - is the  Guid for  the entity  record
  716  
  717       try {
  718           va r pnss_ent ityIdNoBra cket = pns s_entityId .replace(/ ({|})/g, ' ');
  719           va r pnss_sel ectString  = '(guid'  + "'" + pn ss_entityI dNoBracket  + "'" + ' )?$select= ' + pnss_a ttributeSe t;
  720           va r pnss_jso nQuery = p nss_server Url + pnss _crmOdataE ndPoint +  '/' + pnss _entitySet Name + pns s_selectSt ring;
  721           va r pnss_ent ityData =  pnss_execu teCrmOdata GetRequest (pnss_json Query, fal se, '', 0,  null);
  722           re turn pnss_ entityData ;
  723       }
  724       catch  (err) {
  725           al ert('An er ror occure d in the p nss_getSin gleEntityD ataSync fu nction.  E rror Detai l Message:  ' + err);
  726       }
  727   }