Please be aware that the current Audit History is one of the certain legacy UI which is enabled as part of hybrid experience in Unified Interface. When Microsoft implement the Audit History in full Unified Interface experience, you will have to re-implement this functionality.
this.formOnLoad = function (executionContext)
{
setAuditIframeURL(executionContext);
}
this.setAuditIframeURL = function (executionContext)
{
let formContext = executionContext.getFormContext();
Xrm.Utility.getEntityMetadata(formContext.data.entity.getEntityName()).then(
function success(entityMetadata)
{
if (entityMetadata && entityMetadata.ObjectTypeCode)
{
let objectTypeCode = entityMetadata.ObjectTypeCode;
let auditIFrameUrl = location.protocol + "//" + location.hostname + "/userdefined/areas.aspx?oId=" + formContext.data.entity.getId().replace("{", "").replace("}", "") + "&oType=" + objectTypeCode + "&inlineEdit=1&navItemName=Audit History&pagemode=iframe&rof=true&security=852023&tabSet=areaAudit&theme=Outlook15White";
formContext.getControl("IFRAME_audit").setSrc(auditIFrameUrl);
}
},
function (error)
{
Xrm.Navigation.openAlertDialog(
{
text: error.message
});
});
}
this.formOnLoad = function (executionContext)
{
showAuditTab(executionContext);
}
this.showAuditTab = function (executionContext)
{
let formContext = executionContext.getFormContext();
const navigations = formContext.ui.navigation.items;
const tabs = formContext.ui.tabs;
const focusedTab = tabs.get().find(tab => tab.getDisplayState() == 'expanded')
navigations.get("navAudit").setFocus(); // set focus on audit history tab
focusedTab.setFocus(); // set focus on the original default tab
}
Original Post http://linnzawwin.blogspot.com/2024/01/how-to-embed-audit-history-on-table_30.html