Skip to main content

Button to trigger Stored Procedure - Notification that it is complete

Answered

Comments

4 comments

  • Best answer
    Ben Bauer

    Hey Joe,

    The best way to get feedback in the UI from a background event is through the Messages system in the SST/DSP product. I will admit that the Messages system is not well documented in the framework. While many of the delivered apps use the system via plugin code you can also access the system from workflow Events in your custom apps. Messages are those things that pop up in the top-right corner from time to time AND also accumulate underneath the red envelope icon in the quick panel on the right-hand side.

    You can click the 'test' button in the toolbar of the Admin > Configuration > Setup > Message Types page to see what the various Message pop-ups look like. These previews will also accumulate underneath your red envelope icon on the right if you want to check out how you can interact with them there. Of course, you can play around with adding your own custom Message Type as well.

    So how do you get one of these bad boys to fire off from an Event? It's actually pretty simple, especially if you've ever designed an Event that sends an email.

    1. Add a Business Rule to your Event that has the "Workflow" Procedure Type. If you want your Message to act as a PostMessage, then it just needs to have a higher Priority than the rest of the Rules registered to the Event.
    2. In the Business Rule vertical, set the Alternate View and the Message Type ID. Please note that email may also be sent depending on the Workflow Send Email setting on the Admin > Configuration > Setup > Message Types > {vertical} page.
    3. Click 'Workflow Fields' and configure the To, Subject, and Body values. Example screens below.
    4. The trickiest part of this setup is ensuring that you use #boaUserID# in the view that you register as the Alternate View. Again, an example is below.

    1
  • John Danos

    Background tasks go to a job queue, so they are, by design, not happening with messaging on the front end.  However, I believe the status Icon for the task record should reflect where that process is completed, so if you are invoking the process in multiple rows concurrently, you do not have to wait for it to finish before doing anything else.  

    If you are single threading the process and it MUST be completed prior to another activity, then you will need to leave it in the foreground, OR you can create a control field to disable further action until the process is completed (you can get the completion status from the status field, OR add a data update to your process to set the process as 'complete' for the current record.

    -1
  • Joseph Flesche

    Ben Bauer,

    I will admit that the Messages system is not well documented in the framework. 

    And that's why I can find it! But this is exactly what I was looking for.

    This is all great information. A few notes to add to your comment above from my testing.

    When creating a message record, Archive needs to be checked for the popup message to be displayed. Require Action will keep the popup message displayed until the end user clicks on it.

    The popup message title displays at the top of the popup.

    The popup message text comes from the Body of the WorkFlow view.

     

    Since #boaUserID# is used to capture the user name for the popup notification (and the email if so desired), it appears that other variables can be passed from the selected row to the Workflow view. This allows for creating links to the associated object (using HTML) and then reminding the user if needed. Are there other variables that can be passed from the session

    0
  • Ben Bauer

    Hey Joe,

    I finally got back to this one.

    First of all, any column name from the page's horizontal view can be placed in #hashtags# and passed to a view or procedure used in the page's design. The same is true for the hidden "session variables" such as boaUserID.

    The simplest list I could find for these "session variables" was by querying the CranSoft.dbo.ReservedColumn table. Now, many of these are just hidden bits/flags that control whether or not a framework button (such as 'Edit') appears. There are also some old entries that won't work any longer. You can play around with any on the list to see if they work, but these are the ones I have seen used succesfully (and hold a value other than a bit/flag):

    • boaLanguage | English | found in CranSoft.dbo.Language
    • boaPageID | b58562bb-50f8-4ce5-9292-018eb3ecd953 | found in CranSoft.dbo.Page
    • boaSessionID | 176cdf88-1ea6-4207-b386-8cc93937d2a3 | found in CranSoft.dbo.Setting
    • boaUserID | BenB | found in CranSoft.dbo.User

    Finally, you can also reference columns on a page known as "criteria". These are generally accumulated by the path a user follows to navigate to a page. Try scrolling to the bottom of the Technical Help on various pages to see the "criteria" they have. In this example, from one of my custom pages, I could reference #HeaderKey# and #LinkKey# even though they don't exist in the page's horizontal view.

    0

Please sign in to leave a comment.