We would like to save messages created from API’s or Background jobs, and then be able to display these afterwards. Is there a way to add messages to current logic block message list similar to adding messages from a called LB.?
@tim.vanderberg I don’t really understand the API use case - can you elaborate on that one?
As for doing something with whatever’s in the message list when a background job ends … that is an interesting idea.
@ian.p the API, basically is also to log anything performed in background, endpoint calls etc. We just wanted a type of mechanism, where we can store the message results. The reasons are:
- External system can query the errors, to check what went wrong
- Users can go to the “calling” app and view the messages (Sales order where the automatic shipping failed etc.)
Yes, I think it’s possible to do whatever you have in mind @tim.vanderberg. Short method: create messages and insert each to a messages table that you create for this application (if your table is “xyz,” you can call it “xyzMessages”.
There are a variety of logic block actions that have to do with message handling. At the most basic level, the Create Message action allows you to create a new message of any type and notification preference, and creating an Error will not immediately cause the logic block to fail - at the end of the logic block, its current message list will process and any errors will cause the callstack to fail and rollback.
You can effectively do what you’re looking for by creating a new message each time something happens that is message-worthy and adding it to the current logic block message list. At the end of the logic, you can then use the Loop Message List action to loop over the current list and insert each message to the persisted table. A variety of delivered apps use this approach to display messages to a user. Finally, clear the current message list before the end of the logic block if you want the current logic to succeed despite the errors.
Let me know if you’d like any more detail or contextual information on how those logic actions work or the standard architecture behind message list management. You might also be able to ask in the Business Applications category for detail on a specific example.
@ross Thank you for the info. However, we want to be able to capture messages from background jobs, into a table, which we are able to do. What we are looking for , is to somehow display these messages in a standard way eg. add them to the message list of the current logic block being processed. Which could then be called from various apps to display any potential messages produced by API calls or Background LB’s.
It’s definitely possible to take messages you’ve stored in a messaging table and populate them into the UI, but it isn’t a clean process. Currently, you’d probably need to populate the data item name for each message you write to the table, then use your logic block to Create Message using the specific message data item - this allows you to fetch from the messages table (according to whichever fetch parameters apply from a particular location) and create a UI message for each record.
Having said that, it sounds like you may be able to skip a step by adding an Inline Application into the detail form of your various apps - this can be built over a messaging table directly and use common context to filter, and you can hide and show it dynamically. While it wouldn’t provide the experience of showing every message to the user as a banner, it would show the user each message in a single place and in a more readable format.