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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / SQL triggers alternati...
Power Apps
Answered

SQL triggers alternative for powerapps

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

hi, I have an app where I want the database to log the time it was used, what parts of the app was used etc so I can use power bi to do some analytics (im aware PowerApps has built in analytics but im a student and my lecturer told me I need to do my own) as PowerApps doesn't allow triggers to be used is there an alternative?

 

thanks,

 

mattSQ

Categories:
I have the same question (0)
  • Verified answer
    mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 

    Create a very simple datasource called ActivityLog using your preferred connector (examples: SharePoint, SQL, CDS).

     

    Make a new table and ensure there are at least 3 columns.

    • ID (autonumber)
    • Activity (single line text)
    • ActvityDateTime (date & time)

     

    Then anytime you want to record some activity in the app use this code.  It must be placed in a property starting with the word On (examples: OnSelect, OnVisible, OnStart).  Be sure to change the Activity field to your own value.

    Patch(
     your_datasource_name,
     Defaults(your_datasource_name),
     {
     Activity: "some text here",
     ActivityDateTime: Now()
     }
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    hi thanks for your help. so just to clear a few things up would it be:

     

    Patch( SQL, Defaults

    (your_datasource_name), <---- does this mean the name of the table in SQL?

    { Activity: "sucessfully completed job application", ActivityDateTime: Now() }


    )

  • mdevaney Profile Picture
    29,991 Moderator on at

    @Anonymous 

    Yes, your_datasource_name does mean the name of your SQL table.

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney hi I know its been a while but ive been trying your solution and It isn't working I just want to make sure ive done it right. ive created the table activity log like you said with the columns ID, Activity and ActivityDateTime in Sql and ive attached an image of the code in powerapps... could you take a look to see if its all correct?

    thanks

     

     
    patch.PNG

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 534

#2
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 306

Last 30 days Overall leaderboard