Skip to main content

Notifications

Supply chain | Supply Chain Management, Commerce
Answered

How to create a utility class for insert record into log table

Posted on by 504
Hi,
 
I want to create a log table that will keep inserting the timestamp whenever my custom class being called. I have created the log table, but now I'm wondering how to create a utility class that will handle this inserting time stamp.
For example: I have class A, B, C, and D. And in one of their method of class A/B/C/D, I want to call my /utility class/ that will insert the time it is called, what is the class name, what is the method name, and probably when call those method in Class A/B/C/D, they have parameter, I want to record that parameter as well.
 
Is there any example of such process ? a simple one I guess, because if too complex and includes many classes will be too excessive to create.
 
Thanks,
  • Verified answer
    Layan Jwei Profile Picture
    Layan Jwei 7,345 Super User 2024 Season 2 on at
    How to create a utility class for insert record into log table
    Hi Ken,
     
    You just create a class and add a static method that accepts className, methodName etc..
    And inside it, you fill the log table with those values then insert into it.
     
    And inside class A,B,C and D you can call this static method and pass those values.
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future. You can do this by ticking the box "Does this answer your question"

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans