Sunday, August 20, 2017

Lightning Component to Display SetUp Audit Trail Data

As we know, SetUp Audit Trail allow us to track all the metadata changes happened to our org. Previously we have to download the SetUp Audit Trail history data from Salesforce UI in excel file.

SetUp audit trail data was not exposed in apex or through API in past but now salesforce has provided an option to query that data in apex or through API by introduction new object called "SetUpAuditTrail". This help us to find historical metadata changes specific to any action or any metadata changes done by any particular user.

I have created a lightning component which will display the SetUpAuditTrail data based on fileters provided by user. As of now, there is limited capability of sorting and filtering SetUpAuditTrail object records, I have used jquery datatable which will help us to sort records on all columns and also to filter records easily.

I have added the component to VF page by adding it to lightning app and exposed VF page through custom tab.

SetUpAuditTrail tracking VF page snapshot:



You can download complete code from below URL:
Lightning Component For SetUpAuditTrail Tracking

This is basic code for basic functionality. You can extend it as per your requirement.

Hope this will help!!!

Looking forward for everyone comments and suggestion!!

More Blogs>>: 
INHERITANCE IN LIGHTNING    
FIRING EVENT FROM LIGHTNING COMPONENT AND PASSING IT TO VF PAGE    
CHANGES TO LIGHTNING DATA SERVICE IN SUMMER'17    
LIGHTNING DATA SERVICES    
PASSING LIGHTNING COMPONENT ATTRIBUTE VALUE FROM VF PAGE    
FIRE LIGHTNING EVENTS FROM VF PAGE    
DYNAMICALLY CREATING AND DESTROYING LIGHTNING COMPONENTS    
RAISING AND HANDLING CUSTOM EVENTS IN sALESFORCE lIGHTNING    
WHY TO USE DESIGN RESOURCE AND HOW TO ADD DYNAMIC OPTION TO DATASOURCE    
PASSING LIGHTNING COMPONENT ATTRIBUTE VALUE FROM VF PAGE    
PASSING INNER WRAPPER CLASS TO LIGHTNING COMPONENT    
LIGHTNING COMPONENT FOR RECORDTYPE SELECTION FOR ANY SOBJECT    
CUSTOM COMPONENT TO SHOW/HIDE SPINNER IMAGE    

9 comments:

  1. It's Great Sunil You are really adding some values in terms of making the things easy and valuable.

    ReplyDelete
  2. Sunil, have deployed the component into Dev Sandbox. and facing an issue like below.
    An internal server error has occurred
    Error ID: 412817542-48448 (967666843)

    org.auraframework.throwable.quickfix.DefinitionNotFoundException: No APPLICATION named markup://skforce:SK_SetUpAuditTrailApp found
    at org.auraframework.impl.DefinitionServiceImpl.getHelper(DefinitionServiceImpl.java:1504)
    at org.auraframework.impl.DefinitionServiceImpl.compileDef(DefinitionServiceImpl.java:1623)
    at org.auraframework.impl.DefinitionServiceImpl.compileDE(DefinitionServiceImpl.java:1001)
    at org.auraframework.impl.DefinitionServiceImpl.getDefinition(DefinitionServiceImpl.java:238)
    at aura.impl.util.LightningOutUtils.isLightningOutApplication(LightningOutUtils.java:49)
    at aura.impl.util.LightningOutUtils.isLightningOutAppRequest(LightningOutUtils.java:77)
    at ui.services.facades.CoreLightningOutFacadeImpl.isLightningOutAppRequest(CoreLightningOutFacadeImpl.java:26)
    at ui.aura.util.impl.AuraServletsUtilImpl.isAuraDomain(AuraServletsUtilImpl.java:314)
    at ui.aura.util.impl.AuraServletsUtilImpl.verifyAuraDomain(AuraServletsUtilImpl.java:322)
    at ui.aura.util.impl.AuraServletsUtilImpl.preAuraRequest(AuraServletsUtilImpl.java:93)
    at aura.impl.sfdc.bean.adapter.SFDCAuraServletsUtilAdapter.actionServletGetPre(SFDCAuraServletsUtilAdapter.java:75)
    at org.auraframework.http.AuraServlet.doGet(AuraServlet.java:228)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at org.eclipse.jetty9.servlet.ServletHolder.handle(ServletHolder.java:845)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1693)
    at system.filter.AuraDomainRedirectFilter.doFilter(AuraDomainRedirectFilter.java:81)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at aura.impl.http.SFDCAuraContextFilter.doFilter(SFDCAuraContextFilter.java:115)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at sfdc.commons.filters.useragent.CommonUserAgentRewriteFilter.doFilter(CommonUserAgentRewriteFilter.java:27)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at klein.filter.JettyStreamWriterAdaptorFilter.doFilter(JettyStreamWriterAdaptorFilter.java:105)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.CustomDomainMappingFilter.doFilter(CustomDomainMappingFilter.java:221)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.SiteRedirectMappingFilter.doFilter(SiteRedirectMappingFilter.java:114)
    at org.eclipse.jetty9.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1680)
    at core.dns.filter.BandwidthMeterFilter.doFilter(BandwidthMeterFilter.java:110)

    and can you check the controller on component "SK_SetUpAuditTrailCmp" it seems to be not present in branch. please confirm and if there is any post configuration required would be helpful to leverage this functionality

    ReplyDelete
  3. Hi Lokesh,

    On VF page replace skforce with c.


    $Lightning.use("c:SK_SetUpAuditTrailApp", function() {
    $Lightning.createComponent("c:SK_SetUPAuditTrailCmp",
    { },
    "lightning",
    function(cmp) {
    // do some stuff
    });
    });


    I have updated the VF page code in Github repository.

    Note:
    If you use namespace in your org then , in VF page you need to refer lightning component with namespace. In my org namespace is skforce thats why i was using "skforce:SK_SetUpAuditTrailApp".
    just replace all occurance of "skforce" with "c" in VF page.

    Hope this will help!!

    Thanks

    ReplyDelete
  4. Hi sunil,

    Thanks for your reply and yes i haven't checked about namespace and seems like you haven't added SK_SetUpAuditTrailController class into the github repository.

    ReplyDelete
    Replies
    1. Hi Lokesh,

      Thanks for informing about missing class.

      I have added SK_SetUpAuditTrailController class in GitHub.

      Thanks,

      Delete
  5. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. auditing company

    ReplyDelete
  6. Get Data Center Audit and Review solutions that will help your business plan cost-effective cloud and data center upgrades with data-driven insights. data center audit services


    Company name 4sight Technologies (Pvt) Ltd
    Phone: 923008221603
    Location: Suite # 2B, 45-C, 27th Street Tauheed Commercial Area DHA, Phase V, Ext. Karachi, Pakistan
    4sighttechnologies2@gmail.com
    Postal Code: 75500

    ReplyDelete