title: Bad request error when calling a custom action through Javascript
body: <p>I created a custom action on CRM 365 which has one input parameter of type entity reference and it refers to the user entity, I tried to change the input parameter into another type and it works well. So I think the issue is in the way I pass the entity reference value, I tried to change it but I haven't had any luck so can someone tell me what is the wrong in the below code? </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 CreateBlockHistory() {
      var Id = Xrm.Page.data.entity.getId();
      Id = Id.replace("{", "").replace("}", "");
      var data = {
          "BlockedBy": {
              "ohd_blockedby": Xrm.Page.context.getUserId().replace("}", "").replace("{", ""),
              "@odata.type": "Microsoft.Dynamics.CRM.systemuser"
          }
      };
      var serverURL = window.parent.Xrm.Page.context.getClientUrl();
      var req = new XMLHttpRequest();
      req.open("POST", serverURL + "/api/data/v8.1/new_units(" + Id + ")/Microsoft.Dynamics.CRM.ohd_ActionTest", false);
      req.setRequestHeader("Accept", "application/json");
      req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
      req.setRequestHeader("OData-MaxVersion", "4.0");
      req.setRequestHeader("OData-Version", "4.0");
      req.onreadystatechange = function () {
          if (this.readyState == 4 /* request completed */) {
              req.onreadystatechange = null;
              if (this.status == 200 /* response ready */) {
                  var data = JSON.parse(this.response);
              }
              else {
                  var error = JSON.parse(this.response).error;
              }
          }
      };
      req.send(window.JSON.stringify(data));
  }</code></pre>
  </div>
  </div>
  </p>