Skip to content

Commit

Permalink
Web API URL
Browse files Browse the repository at this point in the history
  • Loading branch information
PHAM Paul (EnergyQ) authored and PHAM Paul (EnergyQ) committed Apr 13, 2021
1 parent afe843c commit 65d1d4c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/html/ui/pane.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<li class="crm-power-pane-subgroup" id="record-url"><span><span class="icon record-url-icon"></span>Record Url</span></li>
<li class="crm-power-pane-subgroup" id="clone-record"><span><span class="icon clone-record"></span>Clone Record</span></li>
<li class="crm-power-pane-subgroup" id="record-properties"><span><span class="icon record-properties-icon"></span>Record Properties</span></li>
<li class="crm-power-pane-subgroup" id="record-webapi"><span><span class="icon record-url-icon"></span>Record Web API</span></li>
</ul>
<ul class="crm-power-pane-section" id="form-actions" style="margin-right:10px!important">
<li class="crm-power-pane-header">Form Actions</li>
Expand Down
27 changes: 27 additions & 0 deletions src/js/ui/pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,33 @@ $(function () {
} catch (e) {
CrmPowerPane.UI.ShowNotification("An error ocurred while redirecting to form editor.", "error");
}
});

$("#record-webapi").click(function () {
try {
var header = "Record Web API";
var description = "Web API of current record.";

Xrm.Utility.getEntityMetadata(Xrm.Page.data.entity.getEntityName(),"")
.then(function(result){
var url = [Xrm.Page.context.getClientUrl() + "/api/data/v9.0/"];
url.push(result.EntitySetName);
url.push("(" + Xrm.Page.data.entity.getId().replace("{", "").replace("}",""));
url.push(")");

var result = [{
label: "Record Web API",
value: url.join("")
}];

CrmPowerPane.UI.BuildOutputPopup(header, description, result);

});

} catch (e) {
CrmPowerPane.UI.ShowNotification(e);
}

});
}
};
Expand Down

0 comments on commit 65d1d4c

Please sign in to comment.