Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

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

(0) ShareShare
ReportReport
Posted on by 2,645

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
    Linn Zaw Win Profile Picture
    Linn Zaw Win 3,405 on at
    How to make the audit history its own tab on a form?
  • JR91 Profile Picture
    JR91 15 on at
    RE: How to make the audit history its own tab on a form?

    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,

  • Jessie1122 Profile Picture
    Jessie1122 10 on at
    RE: How to make the audit history its own tab on a form?

    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.

  • Basvb Profile Picture
    Basvb 62 on at
    RE: How to make the audit history its own tab on a form?

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

  • G35 Profile Picture
    G35 5 on at
    RE: How to make the audit history its own tab on a form?

    where to add this code

  • Suggested answer
    Linn Zaw Win Profile Picture
    Linn Zaw Win 3,405 on at
    RE: How to make the audit history its own tab on a form?

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

  • Verified answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: How to make the audit history its own tab on a form?

    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
    RE: How to make the audit history its own tab on a form?

    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/ 

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,391 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans