Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Showing change history (audit history) on a form

  • 1.  Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 10:28 AM
    Hi CRMUG,

    We have a project that would be enhanced by being able to see change history on a single form in the UCI.  This record will be visited about once a month, have some critical notes and changes made to it which we may want to see over multiple years.

    I've researched and found a few options.
    Showing audit history in a report Dynamics CRM 2011 Audit Report in SSRS
    Documenting changes for this entity in a 'Live Feed' Livefeed of your CRM actions !

    It appears that these are the only two options but they both seem fairly dev heavy and I was looking for something lighter.  If anyone has implemented either of these I'd like their opinions on these approaches as well.

    Any ideas would be appreciated!

    Thanks!

    ------------------------------
    Travis Judd
    CRM Developer
    Trek Bicycle Corporation
    WATERLOO WI
    ------------------------------


  • 2.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 02:26 PM
    Are you looking to log changes to the form layout or changes to the record entered through the form?

    Based on the links you shared it sounds like you're looking just for an audit trail of the data itself which you can find from the Audits under the navigation on the form:



    ------------------------------
    Nick Hance
    Reenhanced
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 3.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 02:41 PM
    We are looking for a way to log changes to the record.  Audit history is good - but it's too hidden for some of our light or inexperienced CRM users.  I'd like to not have any clicks to view the audit history by seeing it directly on the form.

    These users are also using the UCI and won't be able to get to Audit History.

    A little off topic but...



    ------------------------------
    Travis Judd
    CRM Developer
    Trek Bicycle Corporation
    WATERLOO WI
    ------------------------------



  • 4.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 05:08 PM
    Happy to help with the tool!

    The two options you mentioned didn't look like they'll work but I did find another option. You could insert an IFRAME into the form that shows everything from the audit page. This would then load all of your details in a small area.

    Here's what you can do:

    - Visit a record of your entity type
    - Open chrome inspector (Control + Shift + J)
    - Visit the audit page, grab the iframe source url
    - Use this iframe source url to build a string that you'll need to update with the id of the current record
    - Change the src attribute of your iframe in your form via javascript, substituting the current record's id into the string you made above



    ------------------------------
    Nick Hance
    Reenhanced
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 5.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 08:23 PM
    It totally worked!  I didn't think that it would already be in an accessible iframe.

    I was having trouble getting var formContext = executionContext.getFormContext();  to work using window.parent -- so I guess the code will need to be updated at some point.

    Thanks for your help.



    <!DOCTYPE html>
    <html style="height: 100%">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body style="height: 100%">
        <script>
            var formContext;
            window.parent.$(window).on('load', function () {
                buildIframeSource();
            });
            function buildIframeSource() {
                var url = window.parent.Xrm.Page.context.getClientUrl();
                var recordId = window.parent.Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");
                var element = document.getElementById("areaAuditFrame");
                element.src = url + "/userdefined/areas.aspx?formid=52078acf-77c4-4e18-86b8-ebffcafc0698&inlineEdit=1&navItemName=Audit%20History&oId=%7b" + recordId + "%7d&oType=10270&pagemode=iframe&rof=true&security=852023&tabSet=areaAudit&theme=Outlook15White";
            };
    
    //3877A32E-EA20-E911-A952-000D3A34E213
    
        </script>
        <iframe src="" id="areaAuditFrame" name="areaAuditFrame" scrolling="auto" isarea="1" frameborder="0" style="width: 100%; height: 100%"></iframe>
        <!--<iframe src="https://trektest.crm.dynamics.com/userdefined/areas.aspx?formid=52078acf-77c4-4e18-86b8-ebffcafc0698&amp;inlineEdit=1&amp;navItemName=Audit%20History&amp;oId=%7b3877A32E-EA20-E911-A952-000D3A34E213%7d&amp;oType=10270&amp;pagemode=iframe&amp;rof=true&amp;security=852023&amp;tabSet=areaAudit&amp;theme=Outlook15White" id="areaAuditFrame" name="areaAuditFrame" scrolling="auto" isarea="1" frameborder="0" style="width: 100%; height: 100%"></iframe>-->
    </body>
    </html>


    ------------------------------
    Travis Judd
    CRM Developer
    Trek Bicycle Corporation
    WATERLOO WI
    ------------------------------



  • 6.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 15, 2019 08:41 PM
    You rock! Great work!






  • 7.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 18, 2019 12:54 PM
    Travis:

    I played around with what you built a little bit this morning and simplified it so you don't have to rely upon FormContext in any way. Because you're using a web resource to display you can just Pass the Object Type code and Unique Identifier as Parameters and extract that from the window.location.search

    I wrote everything up in a nice blog post with full descriptions here:

    https://www.javascriptforcrm.com/javascript-for-crm/how-to-embed-audit-history-directly-into-an-entity-form

    ------------------------------
    Nick Hance
    Reenhanced
    www.javascriptforcrm.com
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 8.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 21, 2019 10:35 AM
    Wait, Tangent, but what tool are you guys using to make the GIFs?  Looks simpler than recording a video and converting.

    ------------------------------
    Ryan Perry
    Business Systems Analyst
    Auric Solar
    ------------------------------



  • 9.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 19, 2019 01:57 PM
    Great thread!  Nick mentioned the audit trail under the form navigation.  I do not see that in my instance of CRM online.  How do you edit those options?  Is there some type of SiteMap editor?

    Also, what GIF tool are you guys referring to?

    Thanks!

    ------------------------------
    Kyle Buggie
    Columbus OH
    ------------------------------



  • 10.  RE: Showing change history (audit history) on a form

    SILVER CONTRIBUTOR
    Posted Feb 20, 2019 07:53 AM
    Audit history is now available in the Unified Interface. It showed up in our contact records in service update 24 (9.1.0.24xx).

    ------------------------------
    Neil Benson, MVP
    Customery
    Brisbane, QLD, Australia
    https://customery.com/blog
    ------------------------------



  • 11.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 20, 2019 09:31 AM
    You could use the same technique I covered in the blog post to show connections directly within a form or any other view that CRM displays within an IFRAME

    ------------------------------
    Nick Hance
    Principal Developer; President
    Reenhanced
    www.javascriptforcrm.com
    www.buildbettersoftware.com
    Green Lane PA
    ------------------------------



  • 12.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 20, 2019 01:45 PM
    The problem is I do not see the audit history option in the form navigation.  I could not find which version it was added to in Microsoft's release notes, but we are running on 9.1.0.20XX.

    ------------------------------
    Kyle Buggie
    Columbus OH
    ------------------------------



  • 13.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 20, 2019 06:27 PM
    You can add it on the left side of the form editor and it'll appear up top






  • 14.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Feb 21, 2019 09:48 AM
    Awesome!  I missed that in the available options in the form editor.  Works like a charm.  Thanks guys!

    ------------------------------
    Kyle Buggie
    Columbus OH
    ------------------------------



  • 15.  RE: Showing change history (audit history) on a form

    GOLD CONTRIBUTOR
    Posted Mar 06, 2019 11:10 AM
    Just an update -

    to make this dynamic so it works on every entity we need to specify the oType.

    I've used -

    let oType = window.parent.Xrm.Page.context.getQueryStringParameters().etc;

    ------------------------------
    Travis Judd
    CRM Developer
    Trek Bicycle Corporation
    WATERLOO WI
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role