title: Xrm.Page.getAttribute returning null
body: <p>I am trying to do a filter for a lookup that is based upon what is in the job and candidate fields. When grabbing attributes for job and candidate it keeps returning null even though there are values in those fields. I also then get an error :</p>
  
  <pre><code>Query Builder Error. 
  The specified record type does not exist in Microsoft Dynamics 365.
  </code></pre>
  
  <p>I even tried doing <code>Xrm.Page.getAttribute("hc_joborder").getValue()</code> and it returns cant get value of null.</p>
  
  <p>Any idea on what is going on here?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function CustomPpcLookupView() {
      // Some GUID but only needs to be unique among the other available views for the lookup
      var viewId = "{00000000-0000-0000-0000-000000000001}";
      var viewDisplayName = "PPC records for this contact";
  
      //Only need ppc records for the selected candidate and job order
      var jobOrder = Xrm.Page.getAttribute("hc_joborder");
      var candidate = Xrm.Page.getAttribute("hc_candidate");
      Xrm.Utility.alertDialog(jobOrder);
      Xrm.Utility.alertDialog(candidate);
      if (!jobOrder) { return; }
      if (!jobOrder[0]) { return; }
      if (!jobOrder[0].id) { return; }
      if (!candidate) { return; }
      if (!candidate[0]) { return; }
      if (!candidate[0].id) { return; }
  
      //Get all approved ppcs that pertain to the selected joborder,candidate 
      var fetchXml = "&lt;fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'&gt;" +
         "&lt;entity name='hc_candidateppc'&gt;" +
          "&lt;attribute name='hc_candidateppcid' /&gt;" +
          "&lt;attribute name='hc_ppc_name' /&gt;" +
                      "&lt;attribute name='createdon' /&gt;" +
                      "&lt;order attribute='hc_ppc_name' descending='false' /&gt;" +
                      "&lt;filter type='and'&gt;" +
                         " &lt;condition attribute='hc_approved' operator='eq' value='948050002' /&gt;" +
  
                         " &lt;condition attribute='hc_candidate' operator='eq' value='" + candidate[0].id + " uitype='contact'  /&gt;" +
                         "&lt;condition attribute='hc_joborder' operator='eq'  value='" + jobOrder[0].id + " uitype='hc_joborder'  /&gt;" +
  
                            " &lt;condition attribute='hc_approvalstatusmanager' operator='eq' value='948050001' /&gt;" +
                           "&lt;condition attribute='hc_approvalstatusleadership' operator='eq' value='948050001' /&gt;" +
  
                   "&lt;/filter&gt;" +
                   "&lt;/entity&gt;" +
               "&lt;/fetch&gt;";
      //Set up the whole view's UI
      var layoutXml = "&lt;grid name='resultset' object='1' jump='hc_contract' select='1' icon='1' preview='2'&gt;" +
        "&lt;row name='result' id='contractid'&gt;" +
         "&lt;cell name='hc_candidateppcid' width='300' /&gt;" +
         "&lt;cell name='hc_ppc_name' width='200' /&gt;" +
         "&lt;cell name='createdon' width='100' /&gt;" +
  
        "&lt;/row&gt;" +
       "&lt;/grid&gt;";
  
      try {
          //Set the view
          Xrm.Page.getControl("hc_candidateppc").addCustomView(viewId, "hc_candidateppc ", viewDisplayName, fetchXml, layoutXml, true);
      } catch (e) {
          Xrm.Utility.alertDialog("Error: " + e.message);
      }
  }</code></pre>
  </div>
  </div>
  </p>