Messaging is a design pattern that ensures the correct routing of messages from backend TI processes to the user interface in UX. The primary motivation behind messaging is to provide the user with more than just basic success/error messages. It aims to provide as much information as possible about the execution of TI processes, eliminating the need for users to refer to system error logs, which are typically only accessible to admin users.
Messages are created within the TI process itself and are formatted as JSON strings. This allows them to be parsed and displayed as structured information on the UX frontend. The flexibility of the JSON structure allows for the inclusion of any details about the TI process. Furthermore, it can accommodate details about any child TI processes called from the parent process, nesting this information within the structure.
Basic Code Snippet
Following code needs to be added into suitable part of prolog, ideally to variables declaration part. The snippet defines variables that are used to communicate results of the process to its caller.
### Global Variables StringGlobalVariable('sProcessReturnCode'); NumericGlobalVariable('nProcessReturnCode'); nProcessReturnCode= 0; cMsgErrorLevel = 'ERROR'; cMsgErrorContent = 'User:%cUserName% Process:%cThisProcName% ErrorMsg:%sMessage%'; # Uncomment for thread enabled processes #cMsgErrorContent = 'User:%cUserName% Process:%cThisProcName% (ThreadID: %pThreadID%) ErrorMsg:%sMessage%'; nErrors = 0; sMessage = ''; cCubMsg = '}APQ Process Response Message'; sMultiMsg = ''; nMultiMsgJSON = 0; sDetailMsg = '';