web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to make the audit history its own tab on a form?

(0) ShareShare
ReportReport
Posted on by 26

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.

  • Suggested answer
    AJ-22040756-0 Profile Picture
    Microsoft Employee on at

    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/ 

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

  • Suggested answer
    Linn Zaw Win Profile Picture
    3,407 on at

    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.

    pastedimage1591971242072v1.png

        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();
    	}

  • G35 Profile Picture
    5 on at

    where to add this code

  • Basvb Profile Picture
    62 on at

    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 :)

  • Jessie1122 Profile Picture
    10 on at

    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.

  • JR91 Profile Picture
    15 on at

    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,

  • Suggested answer
    Linn Zaw Win Profile Picture
    3,407 on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
11manish Profile Picture

11manish 46 Super User 2026 Season 2

#2
Travis South Profile Picture

Travis South 35

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 35 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans