Hello,
Is it possible to create a tab and bring in the audit history on a form, rather than going to "Related" and then "Audit History"? If so, how?
Thank you.
Hello,
Is it possible to create a tab and bring in the audit history on a form, rather than going to "Related" and then "Audit History"? If so, how?
Thank you.
Hi,
I know it's been a while since you've posted this but I'm getting an error message when using this in VS Code, it's the setAduitIframeURL: function(exectionContext) line, it's throwing:
function (Missing)(executionContext)
Any help would be great.
Thanks,
From the Audit History page, if using Chrome press Control + Shift + J to open the developer tools, then scroll to the iframe in the elements tab. Hold on to this, because we'll be using it to customize your web like https://protrackinghub.com/ resource that will handle the embed of this IFRAME.
You can add this Javascript by first adding the script into a webresource.
After adding it into a webresource you go to the form settings of the form you would like to add it, and add the webresource as a library so you can call the function in the bottom menu below. You should add the function as an onload function. After calling the specific name of the function SetAuditIframeURL, don't forget to pass the executioncontext as a first parameter (it's a tickbox on the menu).
If you can't manage to do it, send me a message :)
where to add this code
I managed to create a new tab and embed the Audit History in the IFrame. For some reasons, it shows a bit differently (Filter dropdown and Delete Change History button is now shown). Please be aware that the current Audit History is one of the certain legacy dialogs 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.
Embedding the Audit History in the IFrame will require JavaScript to populate the entity ID and object type code parameters. WebAPI request will be required to get Object Type Code and the sample JavaScript code is at the end of this reply.
setAuditIframeURL: function(executionContext) { var formContext = executionContext.getFormContext(); var requestUrl = "/api/data/v9.1/EntityDefinitions?$filter=LogicalName eq '" formContext.data.entity.getEntityName() "'&$select=ObjectTypeCode"; var req = new XMLHttpRequest(); req.open("GET", Xrm.Utility.getGlobalContext().getClientUrl() requestUrl, true); req.setRequestHeader("OData-MaxVersion", "4.0"); req.setRequestHeader("OData-Version", "4.0"); req.setRequestHeader("Accept", "application/json"); req.setRequestHeader("Content-Type", "application/json; charset=utf-8"); req.onreadystatechange = function () { if (this.readyState === 4) { req.onreadystatechange = null; if (this.status === 200) { var result = JSON.parse(this.response); var objectTypeCode = result.value[0].ObjectTypeCode; formContext.getControl("IFRAME_audit").setSrc(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"); } else { Xrm.Navigation.openAlertDialog({ text: this.responseText }); } } }; req.send(); }
Audit entity is a system entity and we can not customize Audit entity like other system entity. So the answer is no, you can not bring audit record in a tab or section without any custom code.
Hi Partner,
As far as I know Unfortunately this is not possible as of now, you have to navigate to related -> Audit history
You can post this as a feature request in https://experience.dynamics.com/ideas/
André Arnaud de Cal... 291,391 Super User 2024 Season 2
Martin Dráb 230,445 Most Valuable Professional
nmaenpaa 101,156