8. EPMO Open Source Coordination Office Redaction File Detail Report

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

8.1 Files compared

# Location File Last Modified
1 VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources ftp_patientSummary49661535-FE15-E611-9436-0050568D743D Thu Nov 17 16:48:12 2016 UTC
2 VCCM.zip\VCCM\CRM_solutions\FTPResources\FTPResources_3_35.zip\WebResources ftp_patientSummary49661535-FE15-E611-9436-0050568D743D Thu Nov 30 16:22:00 2017 UTC

8.2 Comparison summary

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

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

8.4 Active regular expressions

No regular expressions were active.

8.5 Comparison detail

  1   /// <refer ence path= "CrmAjaxFu nctions.js " />
  2  
  3   if (typeof  (CrmAjaxF unctions)  === "undef ined") {
  4       CrmAja xFunctions  = { __nam espace: tr ue };
  5   }
  6  
  7   CrmAjaxFun ctions =
  8   {
  9       Create NewRecord:  function  (entitySet Name, attr ibuteUpdat eString) {
  10           // This funct ion create s a basic  CRM entity  record wi th new dat a values
  11           // *entitySet Name* - is  the name  of the CRM  entity se t (Case Se nsitive)
  12           // *attribute UpdateStri ng* - is t he atribut es and val ues to upd ate, forma t CrmAttri buteName +  __ + Attr ibuteTextV alue + ~~  + CrmAttri buteName +  __ + Attr ibuteTextV alue
  13  
  14           va r crmEntit yRecord =  new Object ;
  15           fo r (var i =  0; i < at tributeStr ing.length ; i++) {
  16                var pair  = attribu teString[i ].split("_ _");
  17                crmEntit yRecord[pa ir[0]] = p air[1];
  18           }
  19  
  20           va r jsonEnti tyData = J SON.string ify(crmEnt ityRecord) ;
  21           va r jsonQuer y = CrmAja xFunctions .GetServer Url() + "/ XRMService s/2011/Org anizationD ata.svc" +  "/" + ent itySetName ;
  22           th is.PostReq uest(jsonQ uery, true , jsonEnti tyData, "C REATE", "" );
  23  
  24           re turn;
  25       },
  26       Update SingleEnti ty: functi on (entity SetName, a ttributeUp dateString , entityId ) {
  27           // This funct ion update s a basic  CRM entity  record wi th new dat a values
  28           // *entitySet Name* - is  the name  of the CRM  entity se t (Case Se nsitive)
  29           // *attribute UpdateStri ng* - is t he atribut es and val ues to upd ate, forma t CrmAttri buteName +  __ + Attr ibuteTextV alue + ~~  + CrmAttri buteName +  __ + Attr ibuteTextV alue
  30           // *entityId*  - is the  Guid for t he entity  record
  31  
  32           va r crmEntit yRecord =  new Object ;
  33           va r entityId NoBracket  = CommonSc ript.Refor matCRMGuid (entityId) ;
  34           va r attribut eString =  attributeU pdateStrin g.split("~ ~");
  35           fo r (var i =  0; i < at tributeStr ing.length ; i++) {
  36                var pair  = attribu teString[i ].split("_ _");
  37                crmEntit yRecord[pa ir[0]] = p air[1];
  38           }
  39  
  40           va r jsonEnti tyData = J SON.string ify(crmEnt ityRecord) ;
  41           va r jsonQuer y = CrmAja xFunctions .GetServer Url() + "/ XRMService s/2011/Org anizationD ata.svc" +  "/" + ent itySetName  + "(guid"  + "'" + e ntityIdNoB racket + " '" + ")";
  42           th is.PostReq uest(jsonQ uery, true , jsonEnti tyData, "U PDATE", "" );
  43  
  44           re turn;
  45       },
  46       PostRe quest: fun ction (jso nQuery, aS ync, jsonE ntityData,  recordAct ion, crmGu idFieldNam e) {
  47           va r crmEntit yId = "FAI L";
  48           $. ajax({
  49                type: "P OST",
  50                contentT ype: "appl ication/js on; charse t=utf-8",
  51                datatype : "json",
  52                url: jso nQuery,
  53                data: js onEntityDa ta,
  54                beforeSe nd: functi on (XMLHtt pRequest)  {
  55                    XMLH ttpRequest .setReques tHeader("A ccept", "a pplication /json");
  56                    if ( recordActi on === "UP DATE") {
  57                         XMLHttpReq uest.setRe questHeade r("X-HTTP- Method", " MERGE");
  58                    }
  59                    if ( recordActi on === "DE LETE") {
  60                         XMLHttpReq uest.setRe questHeade r("X-HTTP- Method", " DELETE");
  61                    }
  62                },
  63                success:  function  (data, tex tStatus, X mlHttpRequ est) {
  64                    if ( recordActi on === "CR EATE") {
  65                         crmEntityI d = data.d [crmGuidFi eldName].t oString();
  66                    } el se {
  67                         crmEntityI d = "SUCCE SS";
  68                    }
  69                },
  70                error: f unction (X mlHttpRequ est, textS tatus, err orThrown)  {
  71                    aler t("Ajax Er ror in Crm AjaxFuncti ons.PostRe quest: " +  errorThro wn + "\n"  + textStat us);
  72                    crmE ntityId =  "FAIL";
  73                },
  74                async: a Sync
  75           }) ;
  76  
  77           re turn crmEn tityId;
  78       },
  79       GetSer verUrl: fu nction ()  {
  80           // / <summary >Returns t he URL for  the SOAP  endpoint u sing the c ontext inf ormation a vailable i n the form  or HTML W eb resourc e.</summar y>
  81           va r OrgServi cePath = " /XRMServic es/2011/Or ganization .svc/web";
  82           va r serverUr l = "";
  83           if  (typeof G etGlobalCo ntext == " function")  {
  84                var cont ext = GetG lobalConte xt();
  85                serverUr l = contex t.getClien tUrl();
  86           }
  87           el se {
  88                if (type of Xrm.Pag e.context  == "object ") {
  89                    serv erUrl = Xr m.Page.con text.getCl ientUrl();
  90                }
  91                else {
  92                    thro w new Erro r("Unable  to access  the server  URL");
  93                }
  94           }
  95           if  (serverUr l.match(/\ /$/)) {
  96                serverUr l = server Url.substr ing(0, ser verUrl.len gth - 1);
  97           }
  98  
  99           re turn serve rUrl + Org ServicePat h;
  100       },
  101       GetReq uestObject : function  () {
  102           if  (window.X MLHttpRequ est) {
  103                return n ew window. XMLHttpReq uest;
  104           }
  105           el se {
  106                try {
  107                    retu rn new Act iveXObject ("MSXML2.X MLHTTP.3.0 ");
  108                }
  109                catch (e x) {
  110                    retu rn null;
  111                }
  112           }
  113       },
  114       GetXML HttpReques t: functio n () {
  115           // / <summary >
  116           // /     Gets  the XmlHt tpRequest  Object.
  117           // /     Cert ain browse rs and ver sions of W indows hav e to be ha ndled diff erently
  118           // / </summar y>
  119  
  120           va r xmlHttp  = null;
  121  
  122           tr y {
  123                // Opera  8.0+, Fir efox, Safa ri.
  124                xmlHttp  = new XMLH ttpRequest ();
  125           }
  126           ca tch (e) {
  127                try {
  128                    // I nternet Ex plorer Bro wser.
  129                    xmlH ttp = new  ActiveXObj ect("Msxml 2.XMLHTTP" );
  130                }
  131                catch (e ) {
  132                    try  {
  133                         // Interne t Explorer  Browser.
  134                         xmlHttp =  new Active XObject("M icrosoft.X MLHTTP");
  135                    }
  136                    catc h (e) {
  137                         // Somethi ng went ve ry wrong                      
  138                         return nul l;
  139                    }
  140                }
  141           }
  142  
  143           re turn xmlHt tp;
  144       },
  145       GetEnt ityASyncJS ON: functi on (entity Set, id, C olumns) {
  146           //  call exam ple
  147           //  var entit ySet = "Ac countSet";
  148           //  var colum ns = "Acco untId eq ( guid'" + i d + "')&$s elect=mhi_ acounttype ";
  149           //  var resul t = GetEnt ityASyncJS ON(entityS et, id, co lumns);
  150  
  151           va r serverUr l = CrmAja xFunctions .GetServer Url();
  152           va r oDataEnd pointUrl =  serverUrl  + "/XRMSe rvices/201 1/Organiza tionData.s vc/";
  153           oD ataEndpoin tUrl += en titySet +  "?$filter= " + Column s;
  154           va r service  = CrmAjaxF unctions.G etRequestO bject();
  155           if  (service  != null) {
  156                service. open("GET" , oDataEnd pointUrl,  false);
  157                service. setRequest Header("X- Requested- Width", "X MLHttpRequ est");
  158                service. setRequest Header("Ac cept", "ap plication/ json, text /javascrip t, */*");
  159                service. onreadysta techange =  function  () {
  160                    CrmA jaxFunctio ns.GetEnti tyASyncJSO NCallBack( this);
  161                };
  162                service. send();  / /service.s end(null);
  163           }
  164       },
  165       GetEnt ityASyncJS ONCallBack : function  (Retrieve EntityReq)  {
  166           if  (retrieve ProjectReq .status ==  200) {
  167                // set e ntityConta ins
  168               // var re questResul ts = eval( '(' + serv ice.respon seText + ' )').d;
  169                requestR esults = R etrieveEnt ityReq.res ponseText;
  170                // retur n requestR esults;
  171           }
  172           el se {
  173                alert("E rror fetch ing data i n GetEntit ySyncJSON  function") ;
  174           }
  175       },
  176       Execut eFetchXmlR equest: fu nction (fe tchXml, on Success, o nError, as ync) {
  177           // / <summary >
  178           // /     Exec utes the F etch XML R equest, ex ecuting th e onSucces s and onEr ror functi ons as app ropriate.   
  179           // /     If o nSuccess i s null or  reutrns nu ll, a Java script Obj ect repres entation o f the resp onse will 
  180           // /     be r eturned, e lse the re sult of on Success wi ll be retu rned.
  181           // / </summar y>
  182           // / <param n ame="fetch Xml" type= "String">
  183           // /     The  Fetch XML  to be Exec tued.
  184           // /     This  will be X ML Encoded .
  185           // / </param>
  186           // / <param n ame="onSuc cess" type ="function ">
  187           // /     Func tion that  will be ca lled if no  errors oc cur.  
  188           // /     The  Javascript  Object re presentati on of the  response w ill be pas sed in.
  189           // / </param>
  190           // / <param n ame="onErr or" type=" function"> Function t hat will b e called i f an eror  occurs.</p aram>
  191           // / <param n ame="async " type="Bo olean"> 
  192           // /     Cont rols if th e request  is perform ed asynchr onously.
  193           // /     Defa ults to fa lse
  194           // / </param>
  195  
  196           if  (async ==  null) {
  197                async =  false;
  198           }
  199  
  200           va r request  = "<reques t i:type=' b:Retrieve MultipleRe quest' xml ns:b='http ://schemas .microsoft .com/xrm/2 011/Contra cts' xmlns :i='http:/ /www.w3.or g/2001/XML Schema-ins tance'>"
  201                + "    < b:Paramete rs xmlns:c ='http://s chemas.dat acontract. org/2004/0 7/System.C ollections .Generic'> "
  202                + "         <b:KeyV aluePairOf stringanyT ype>"
  203                + "             <c: key>Query< /c:key>"
  204                + "             <c: value i:ty pe='b:Fetc hExpressio n'>"
  205                + "                  <b:Query> " + CrmEnc odeDecode. CrmXmlEnco de(fetchXm l)     //  parent.Crm EncodeDeco de.CrmXmlE ncode(sFet chXml);
  206                + "                  </b:Query >"
  207                + "             </c :value>"
  208                + "         </b:Key ValuePairO fstringany Type>"
  209                + "    < /b:Paramet ers>"
  210                + "    < b:RequestI d i:nil='t rue'/>"
  211                + "    < b:RequestN ame>Retrie veMultiple </b:Reques tName>"
  212                + "</req uest>";
  213  
  214           va r response  = null;
  215           va r internal OnSuccess;
  216           if  (onSucces s == null)  {
  217                internal OnSuccess  = function  (r) { res ponse = Cr mAjaxFunct ions.OnFet chXmlSucce ss(r); };
  218           }  else {
  219                internal OnSuccess  = function  (r) {
  220                    var  temp = Crm AjaxFuncti ons.OnFetc hXmlSucces s(r);
  221                    resp onse = onS uccess(tem p);
  222                    if ( response = = null) {
  223                         response =  temp;
  224                    }
  225                };
  226           }
  227  
  228           Cr mAjaxFunct ions.Execu teRequest( request, i nternalOnS uccess, on Error, asy nc);
  229           re turn respo nse;
  230       },
  231       OnFetc hXmlSucces s: functio n (respons e) {
  232           // / <summary >Parses th e response  text, and  returns a  Javascrip t Object r epresentat ion of the  it. </sum mary>
  233           // / <param n ame="respo nse" type= "String">R esponse XM L from SOA P Request< /param>
  234  
  235           //  Remove na me spaces  so XML2jso bj returns  valid pro perty name s
  236           //  http://st ackoverflo w.com/ques tions/3704 466/easy-w ay-to-drop -xml-names paces-with -javascrip t
  237           //  RegEx Exp ects every  node to h ave a name space pref ix, add th e two miss ing prefix es
  238           re sponse = C rmAjaxFunc tions.Repl aceAll(res ponse, "<E xecuteResp onse ", "< a:ExecuteR esponse ") ;
  239           re sponse = C rmAjaxFunc tions.Repl aceAll(res ponse, "<E xecuteResu lt ", "<a: ExecuteRes ult ");
  240           if  (null !=  response)  response =  response. replace(/< (\/?)([^:> ]*:)?([^>] +)>/g, "<$ 1$3>");
  241           va r doc = Cr mAjaxFunct ions.Parse XmlString( response);
  242  
  243           if  (CrmAjaxF unctions.G etElementT ext(doc.ge tElementsB yTagName(" ResponseNa me")[0]) = = "Retriev eMultiple" ) {
  244                var elem ents = doc .getElemen tsByTagNam e("Entity" );
  245                var enti ties = new  Array();
  246                for (var  i = 0; i  < elements .length; i ++) {
  247                    enti ties[i] =  CrmAjaxFun ctions.XML 2jsobj(ele ments[i]);
  248                }
  249                return e ntities;
  250           }  else {
  251                return d oc.getElem entsByTagN ame("Resul ts")[0];
  252           }
  253       },
  254       Execut eRequest:  function ( requestXml , onSucces s, onError , async) {
  255           // / <summary >Wraps the  requestXM L in a SOA P Envelope  and execu tes the re quest, cal ling the a ppropriate  result fu nctions</s ummary>
  256           // / <param n ame="reque stXml" typ e="String" >CRM Reque st Xml</pa ram>
  257           // / <param n ame="onSuc cess" type ="function ">function  to handle  the respo nse XML.</ param>
  258           // / <param n ame="onErr or" type=" function">
  259           // /     func tion to ha ndle an er ror.  
  260           // /     Defa ults to al erting the  error mes sage.
  261           // / </param>
  262           // / <param n ame="async " type="Bo olean">
  263           // /     Cont rols if th e request  is perform ed asynchr onously.
  264           // /     Defa ults to fa lse
  265           // / </param>
  266  
  267           if  (async ==  null) {
  268                async =  false;
  269           }
  270           va r soapEnve lope = ""
  271                + "<s:En velope xml ns:s=\"htt p://schema s.xmlsoap. org/soap/e nvelope/\" >"
  272                + "<s:Bo dy>"
  273                + "    < Execute xm lns=\"http ://schemas .microsoft .com/xrm/2 011/Contra cts/Servic es\" xmlns :i=\"http: //www.w3.o rg/2001/XM LSchema-in stance\">"
  274                + reques tXml
  275                + "    < /Execute>"
  276                + "  </s :Body>"
  277                + "</s:E nvelope>";
  278           va r req = Cr mAjaxFunct ions.GetXM LHttpReque st();
  279           re q.open("PO ST", CrmAj axFunction s.GetServe rUrl(), as ync)
  280           tr y { req.re sponseType  = "msxml- document";  } catch ( e) { } //  IE10 suppo rt
  281           //  Responses  will retu rn XML. It  isn't pos sible to r eturn JSON .
  282           re q.setReque stHeader(" Accept", " applicatio n/xml, tex t/xml, */* ");
  283           re q.setReque stHeader(" Content-Ty pe", "text /xml; char set=utf-8" );
  284           re q.setReque stHeader(" SOAPAction ", "http:/ /schemas.m icrosoft.c om/xrm/201 1/Contract s/Services /IOrganiza tionServic e/Execute" );
  285           re q.onreadys tatechange  = functio n () { Crm AjaxFuncti ons.Execut eSOAPRespo nse(req, o nSuccess,  onError);  };
  286           re q.send(soa pEnvelope) ;
  287       },
  288       GetEle mentText:  function ( element) {
  289           // / <summary >Handles i ssues betw een IE9 an d IE10.  I E9 doesn't  support t ext, IE10  doesn't su pport text Content </ summary>
  290           // / <param n ame="eleme nt" type=" XmlElement ">Element  to return  the textCo ntent or t ext of</pa ram>
  291           re turn eleme nt.textCon tent || el ement.text ;
  292       },
  293       Replac eAll: func tion (str,  find, rep lace) {
  294           if  (null !=  str) retur n str.repl ace(new Re gExp(find,  "g"), rep lace);
  295           el se return  str;
  296       },
  297       ParseX mlString:  function ( txt) {
  298           va r xmlDoc;
  299           if  (window.D OMParser)  {
  300                parser =  new DOMPa rser();
  301                xmlDoc =  parser.pa rseFromStr ing(txt, " text/xml") ;
  302           }
  303           el se // Inte rnet Explo rer
  304           {
  305                xmlDoc =  new Activ eXObject(" Microsoft. XMLDOM");
  306                xmlDoc.a sync = fal se;
  307                xmlDoc.l oadXML(txt );
  308           }
  309           re turn xmlDo c;
  310       },
  311       XML2js obj: funct ion (node)  {
  312           va r data = { };
  313           va r isNull =  true;
  314  
  315           //  append a  value
  316           fu nction Add (name, val ue) {
  317                isNull =  false;
  318                if (data [name]) {
  319                    if ( data[name] .construct or != Arra y) {
  320                         data[name]  = [data[n ame]];
  321                    }
  322                    data [name][dat a[name].le ngth] = va lue;
  323                }
  324                else {
  325                    data [name] = v alue;
  326                }
  327           };
  328  
  329           fu nction Add Attributes (entity, n ode) {
  330                for (var  i = 0; i  < node.chi ldNodes.le ngth; i++)  {
  331                    isNu ll = false ;
  332                    //Ke yValuePair Ofstringan yType
  333                    var  valuePair  = node.chi ldNodes[i] ;
  334                    var  key = CrmA jaxFunctio ns.GetElem entText(va luePair.fi rstChild);
  335                    var  value = va luePair.ch ildNodes[1 ].childNod es;
  336                    if ( value.leng th == 1 &&  value[0]. tagName ==  "Value")  {
  337                         data[key]  = CrmAjaxF unctions.G etElementT ext(value[ 0]);
  338                    } el se if (val ue.length  == 1 && va lue[0].nod eType == 3 ) {
  339                         data[key]  = value[0] .nodeValue ;
  340                    } el se {
  341                         data[key]  = CrmAjaxF unctions.X ML2jsobj(v aluePair.c hildNodes[ 1]);
  342                    }
  343                }
  344           };
  345  
  346           //  element a ttributes
  347           va r c, cn;
  348           //  skip type  and names pace value s
  349           // for (c = 0 ; cn = nod e.attribut es[c]; c++ ) {
  350           //     Add(cn .name, cn. value);
  351           // }
  352  
  353           //  child ele ments
  354           fo r (c = 0;  cn = node. childNodes [c]; c++)  {
  355                if (cn.n odeType ==  1) {
  356                    if ( cn.childNo des.length  == 1 && c n.firstChi ld.nodeTyp e == 3) {
  357                         // text va lue
  358                         Add(cn.nod eName, cn. firstChild .nodeValue );
  359                    }
  360                    else  if (cn.no deName ==  "Attribute s") {
  361                         AddAttribu tes(data,  cn)
  362                    } el se {
  363                         // sub-obj ect
  364                         Add(cn.nod eName, Crm AjaxFuncti ons.XML2js obj(cn));
  365                    }
  366                }
  367           }
  368  
  369           if  (isNull)  {
  370                data = n ull;
  371           }
  372           re turn data;
  373       },
  374       GetSer verUrl: fu nction ()  {
  375           // / <summary >Returns t he URL for  the SOAP  endpoint u sing the c ontext inf ormation a vailable i n the form  or HTML W eb resourc e.</summar y>
  376           va r OrgServi cePath = " /XRMServic es/2011/Or ganization .svc/web";
  377           va r serverUr l = "";
  378           if  (typeof G etGlobalCo ntext == " function")  {
  379                var cont ext = GetG lobalConte xt();
  380                serverUr l = contex t.getClien tUrl();
  381           }
  382           el se {
  383                if (type of Xrm.Pag e.context  == "object ") {
  384                    serv erUrl = Xr m.Page.con text.getCl ientUrl();
  385                }
  386                else {
  387                    thro w new Erro r("Unable  to access  the server  URL");
  388                }
  389           }
  390           if  (serverUr l.match(/\ /$/)) {
  391                serverUr l = server Url.substr ing(0, ser verUrl.len gth - 1);
  392           }
  393  
  394           re turn serve rUrl + Org ServicePat h;
  395       },
  396       GetErr or: functi on (faultX ml) {
  397           // /<summary>
  398           // / Parses t he WCF fau lt returne d in the e vent of an  error.
  399           // /</summary >
  400           // /<param na me="faultX ml" Type=" XML">
  401           // / The resp onseXML pr operty of  the XMLHtt pRequest r esponse.
  402           // /</param>
  403           va r errorMes sage = "Un known Erro r (Unable  to parse t he fault)" ;
  404           if  (typeof f aultXml ==  "object")  {
  405                try {
  406                    var  bodyNode =  faultXml. firstChild .firstChil d;
  407                    //Re trieve the  fault nod e
  408                    for  (var i = 0 ; i < body Node.child Nodes.leng th; i++) {
  409                         var node =  bodyNode. childNodes [i];
  410                         //NOTE: Th is compari son does n ot handle  the case w here the X ML namespa ce changes
  411                         if (node.n odeName ==  "s:Fault"  || node.n odeName ==  "Fault")  {
  412                             for (v ar j = 0;  j < node.c hildNodes. length; j+ +) {
  413                                 va r faultStr ingNode =  node.child Nodes[j];
  414                                 if  ("faultst ring" == f aultString Node.nodeN ame) {
  415                                      errorMes sage = Crm AjaxFuncti ons.GetEle mentText(f aultString Node);
  416                                      break;
  417                                 }
  418                             }
  419                             break;
  420                         }
  421                    }
  422                }
  423                catch (e ) { };
  424           }
  425           re turn new E rror(error Message);
  426       },
  427       Execut eSOAPRespo nse: funct ion (req,  successCal lback, err orCallback ) {
  428           // / <summary >Receives  the assign  Response< /summary>
  429           // / <param n ame="req"  Type="XMLH ttpRequest ">
  430           // /     The  XMLHttpReq uest respo nse
  431           // / </param>
  432           // / <param n ame="succe ssCallback " Type="Fu nction">
  433           // /     The  function t o perform  when an su ccessfult  response i s returned .
  434           // /     For  this messa ge no data  is return ed so a su ccess call back is no t really n ecessary.
  435           // / </param>
  436           // / <param n ame="error Callback"  Type="Func tion">
  437           // /     The  function t o perform  when an er ror is ret urned.
  438           // /     This  function  accepts a  JScript er ror return ed by the  GetError f unction
  439           // / </param>
  440  
  441           if  (req.read yState ==  2 || req.r eadyState  == 4 /* co mplete */)  {
  442                if (req. status ==  200 && req .responseX ML != null  && req.re sponseXML. documentEl ement != n ull) {
  443                    if ( successCal lback != n ull) {
  444                         var respon se = null;
  445                         if (req.re sponseXML  != null) {
  446                             succes sCallback( req.respon seXML.xml  || new XML Serializer ().seriali zeToString (req.respo nseXML));
  447                         }
  448                    }
  449                }
  450                else {
  451                    if ( errorCallb ack == nul l) {
  452                         alert(CrmA jaxFunctio ns.GetErro r(req.resp onseXML));
  453                    } el se {
  454                         errorCallb ack(CrmAja xFunctions .GetError( req.respon seXML));
  455                    }
  456                }
  457           }
  458       }
  459   };
  460  
  461  
  462   function G etPatientT eam() {
  463  
  464       var ve tId = Xrm. Page.getAt tribute("t ri_veteran id")
  465       if (ve tId !== 'u ndefined'  && vetId ! = null) {
  466  
  467             var webSer viceURL =  "https://q acrmdac.np .crm.vrm.v ba. DNS     /WebParts/ INT/api/PC MM/Patient Summary/1. 0/xml/ftpC RM/991/101 2667110V21 6290?idTyp e=ICN";
  468             //var webS erviceURL  = "https:/ /qacrmdac. np.crm.vrm .vba. DNS     /WebParts/ INT/api/PC MM/Patient Summary/1. 0/xml/ftpC RM/991/" +  vetId + " ?idType=IC N";
  469  
  470           va r soapMess age = '<so ap12:Envel ope xmlns: xsi="http: //www.w3.o rg/2001/XM LSchema-in stance" xm lns:xsd="h ttp://www. w3.org/200 1/XMLSchem a" xmlns:s oap12="htt p://www.w3 .org/2003/ 05/soap-en velope"><s oap12:Body ><GetAllCa tegoryFami lies xmlns ="http://t empuri.org /" /></soa p12:Body>< /soap12:En velope';
  471  
  472           $. ajax({
  473                url: web ServiceURL ,
  474                type: "G ET",
  475                dataType : "xml",
  476                data: so apMessage,
  477                contentT ype: "text /xml; char set=\"utf- 8\"",
  478                success:  OnPatient TeamSucces s,
  479                error: O nPatientTe amError
  480           }) ;
  481       }
  482  
  483       return  false;
  484   }
  485  
  486  
  487   function O nPatientTe amSuccess( data, stat us) {
  488       var my Obj = new  Array();
  489  
  490       if (da ta !== nul l) {
  491  
  492           $( data)
  493                .find('p rimaryCare Assignment ')  // .fi nd('contac tInfo') de mographics /contactIn fo/preferr edFacility
  494                .each(fu nction ()  {
  495                    myOb j.push($(t his)); //  Should't u se .text()  because y ou'll lose  the abili ty to use  .find('tag Name') 
  496                });
  497  
  498           fo r (var i =  0; i < my Obj.length ; i++) {
  499                var pf =  myObj[i]. find('team Name').tex t();
  500           };
  501  
  502           if  (pf !== n ull && pf  !== 'undef ined') {
  503                //var fo rValue = p f.split("- ");
  504                //var co deValue =  parseInt(f orValue[0] .trim());
  505                //var na meValue =  forValue[1 ].trim();
  506                var resu ltsArray =  GetTeamIn fo(pf);
  507  
  508                if (resu ltsArray ! == null &&   resultsA rray !== ' undefined' ) {
  509                    // S etLookupVa lue("ftp_f acilityid" , resultsA rray[0].ft p_facility id, result sArray[0]. ftp_name,  "ftp_facil ity");
  510                    Xrm. Page.getAt tribute("f tp_pactid" ).setValue ([{
  511                         id: result sArray[0]. ftp_pactid ,
  512                         name: resu ltsArray[0 ].ftp_name ,
  513                         entityType : "ftp_pac t"
  514                    }]);
  515                }
  516                else {
  517                    // t his code h as to be t ested once  we have a nother rec ord with d ifferent P atient Sum mary data  not found  in CRM
  518                    // a dd to look  up entity
  519                    // Y ou have to  check ftp _team if n ot found,  it is refe renced in  a non-requ ired field  in ftp_pa ct
  520                    // W onder way  a flag wou ld not of  worked ins teaed of c reated a t eam based  entity dep endent on  yet anothe r team bas ed entity
  521                    // n eed rules  again
  522                    //Cr mAjaxFunct ions.Creat eNewRecord ("ftp_pact ", "ftp_na me" + "__"  + pf);
  523                    aler t("The Pac t Team rec eived from  the Patie nt Summary  service w as not fou nd in CRM  and was ad ded.");
  524                }
  525           }
  526  
  527       } else  {
  528           re turn;
  529       }
  530   }
  531  
  532   function O nPatientTe amError(re quest, sta tus, error ) {
  533       alert( 'error');
  534   }
  535  
  536   function G etTeamInfo (srcValue)  {
  537       var fe tchXml = " <?xml vers ion='1.0'? >" +
  538       "<fetc h distinct ='false' m apping='lo gical' out put-format ='xml-plat form' vers ion='1.0'> " +
  539       "<enti ty name='f tp_pact'>"  +
  540       "<attr ibute name ='ftp_name '/>" +
  541       "<orde r descendi ng='false'  attribute ='ftp_name '/>" +
  542       "<filt er type='a nd'>" +
  543       "<cond ition attr ibute='sta tecode' va lue='0' op erator='eq '/>" +
  544       "<cond ition attr ibute='ftp _name' val ue='" + sr cValue + " ' operator ='eq'/>" +
  545       "</fil ter>" +
  546       "</ent ity>" +
  547       "</fet ch>";
  548  
  549  
  550       // "<c ondition a ttribute=' ftp_name'  value='442  - CHEYENN E VA MEDIC AL' operat or='eq'/>"  +
  551  
  552       return  CrmAjaxFu nctions.Ex ecuteFetch XmlRequest (fetchXml) ;
  553   }