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 / Capture app notificati...
Power Apps
Answered

Capture app notification in collection

(0) ShareShare
ReportReport
Posted on by 943

Hi all..

 

I want to log every notification that came out of my app. And create collection for it, and show it in a data table.

 

For example,
Assume that i have multiple notification when the user load master data:

If(CountRows(ProductTranslationColl1)=2000, Notify("Error, only 2000 Product translation Iter 1 have been loaded. Contact IT team.", NotificationType.Error));

If(CountRows(ProductTranslationColl2)=2000, Notify("Error, only 2000 Product translation Iter 2 have been loaded. Contact IT team.", NotificationType.Error));

If(CountRows(ProductTranslationColl3)=2000, Notify("Error, only 2000 Product translation Iter 3 have been loaded. Contact IT team.", NotificationType.Error));

If(CountRows(ProductTranslationColl4)=2000, Notify("Error, only 2000 Product translation Iter 4 have been loaded. Contact IT team.", NotificationType.Error));

If(CountRows(ProductTranslationColl5)=2000, Notify("Error, only 2000 Product translation Iter 5 have been loaded. Contact IT team.", NotificationType.Error));

If(CountRows(ProductTranslationColl6)=2000, Notify("Error, only 2000 Product translation Iter 6 have been loaded. Contact IT team.", NotificationType.Error));

If(CountRows(ProductTranslationColl7)=2000, Notify("Error, only 2000 Product translation Iter 7 have been loaded. Contact IT team.", NotificationType.Error));

Now, what i need to achieve is capture all notification that appears in the app screen and store it in a collection. 
Is this possible to achieve in powerapps?
How can i do this?

Please help.

Regards.
pytbyt

Categories:
I have the same question (0)
  • LRVinNC Profile Picture
    2,297 on at

    You would need to create a Notifications collection, then use Patch to write a record to the collection every time you issue a notification. The syntax of the Patch command would be:

    Patch(colNotifications, Defaults(colNotifications), {columnName: data to store, columnName: data to store})

    Before your application closes, you would need to write the collection to a permanent data store if you plan to keep it beyond the current user session. 

     

    More Information on Patch

  • PytByt Profile Picture
    943 on at

    Hi @LRVinNC 

    Thank you for your reply.

    I still dont know how i can capture the notification it self.
    The notification i meant is the notification that appear on the top of the screen of the app.

    I'm new to powerapp and i dont have advance skill in programming, i'm sorry for this inconvenient. But, can you help me achieve your solution for my problem?

    Regards.
    pytbyt

  • LRVinNC Profile Picture
    2,297 on at

    You can't directly "capture" the notify messages.  But since you are the one writing them to begin with you can also write a copy of the same message to a collection or file.

     

    A few questions:

    1.  Are you wanting to save the set of errors to a file you can retrieve later and if so, what data store are you going to use - Sharepoint?

    2.  In addition to the error message, what pieces of information are you wanting to save?  Date/time of the error and the identity of the user who got the error?  Anything else?

     

    With these answers, I'll try to give you a little more guidance to get you started.

  • PytByt Profile Picture
    943 on at

    Hi @LRVinNC 

    Sorry for my late reply.

    Yes please, i need your help.

    1.  Are you wanting to save the set of errors to a file you can retrieve later and if so, what data store are you going to use - Sharepoint?
    Yes, i think about either sharepoint or CDS

    2.  In addition to the error message, what pieces of information are you wanting to save?  Date/time of the error and the identity of the user who got the error?  Anything else?
    Yes, i want to save it all.. time stamp, the user using the app, the error message and also all notification message

    I looking forward for guidance.

    Thank you.

    pytbyt


    Edit:
    This is the kind of notification that i want to capture/save/store in the collection:
    notif1.pngnotif2.png
    With the time stamp and user that using the app, etc. 

    Please help...

    Regards.

  • LRVinNC Profile Picture
    2,297 on at

    You will only be able to record any messages that you are generating via a Notify statement.  If the system has automatically issued some type of notification that you didn't specifically tell it to issue, you won't be able to record that. Basically, every time you use Notify to send a message to the user, you must at the same time write a copy of that message to a collection or file.

     

    Since you want to save this, I suggest going directly to a sharepoint list, rather than collection.  That will commit your changes and prevent the data being lost of the user suddenly shuts off the app or closes the tab.  (I don't use CDS so I can't advise you on using it).

     

    1.  Create a Sharepoint list (NotificationLog) containing the information you are going to log.  I think the only things you are going to be able to record are user, date/time, the message you are writing out and the type of message (Error, warning, success or information) so create 4 columns.  I recommend making the default Title column a non-required field in your Sharepoint list so you can create your own 4 columns.  I'm going to assume there were 4 new fields created (AppUserEmail (text, not person), MsgDateTime (date), MsgText (text), and MsgType (text) and that Title has been made non-required.  If you do it different, you'll need to adjust below.

    2.  Add NotificationLog as a data source for your app.

    3.  In your App - OnStart property include:
         Set(CurrentUserEmail, User().Email);

    4.  Everywhere you use Notify, also include a second statement to write the message to the sharepoint list:

         Patch(NotificationLog, Defaults(NotificationLog), {AppUserEmail: CurrentUserEmail, MsgDateTime: Now(), MsgText: "<put the same text you use in the notify here in quotes>", MsgType: "<one of the 4 types of message - Error, Warning, Success, Information in quotes">})

     

    This should record a copy of each message you sending the user on the screen.  As I said, there is no way to capture a system generated message (one you did not request with a Notify) that I am aware of.

  • PytByt Profile Picture
    943 on at

    Hi @LRVinNC 

    Thank you for your explanation, I will try it out.

    Just one more thing, can use variables to get my copy of notification message? How?

    Thanks.

    Regards.

    pytbyt

  • LRVinNC Profile Picture
    2,297 on at

    You could create a variable for this but I don't think it gains you anything since you would only be using it for the notify and patch like this:


    If(CountRows(ProductTranslationColl1)=2000, Notify("Error, only 2000 Product translation Iter 1 have been loaded. Contact IT team.", NotificationType.Error);Patch(NotificationLog, Defaults(NotificationLog), {AppUserEmail: CurrentUserEmail, MsgDateTime: Now(), MsgText: "Error, only 2000 Product translation Iter 1 have been loaded. Contact IT team.", MsgType: "Error"}));

  • PytByt Profile Picture
    943 on at
    Is it mean that i patch Everytime i have the error messages?

    I mean, i put the patch formula right after each error messages formula?
  • Verified answer
    LRVinNC Profile Picture
    2,297 on at

    That depends.  The way your initial post shows the set of errors, it appears you could have multiple errors generated because each IF is executed and has the potential to generate an error.  If that is the case, if you used a variable, you could overwrite the values set by the first message with a second error message and you would lose it. 

     

    So, if multiple If's may be true, I would just include within the existing IF clauses.  

    If only one If will be true out of the list of 7 you gave in your first post, I would consider restructuring to be a single IF statement to make it clear that only 1 is possible, and then, yes you could use variables for both message and type like:
    Set(ErrMsg, ""); Set(ErrType, "");

    If(CountRows(ProductTranslationColl1)=2000, Set(ErrMsg, "Error, only 2000 Product translation Iter 1 have been loaded. Contact IT team."); Set(ErrType, "Error"),Notify(ErrMsg, ErrType), CountRows(ProductTranslationColl2)=2000, Set(ErrMsg, "Error, only 2000 Product translation Iter 2 have been loaded. Contact IT team."); Set(ErrType, "Error"),Notify(ErrMsg, ErrType),<repeat for other errors...));

    If(!IsBlank(ErrMsg), 

    Patch(NotificationLog, Defaults(NotificationLog), {AppUserEmail: CurrentUserEmail, MsgDateTime: Now(), MsgText: ErrMsg, MsgType: ErrType});Set(ErrMsg, ""))

     

    Note: it isn't required to restructure into a single IF, it is just the way I would do it to make it clear that only one of those can be true at a time.  You could still leave it as it is and have one patch at the end as long as YOU are absolutely sure that you will only have 1 of those errors.  Otherwise, you could lose errors by overwriting the values you set from one error with a subsequent error.

  • PytByt Profile Picture
    943 on at
    Thank you.

    I will consider that.

    Cheers.
    pytbyt

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 421

#2
Valantis Profile Picture

Valantis 405

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard