Wiki

Scale Your Enterprise

User Tools

Site Tools


bw2:bizweaver_trigger

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
bw2:bizweaver_trigger [2023/03/24 14:40]
mfoster [Creating Your First Trigger]
bw2:bizweaver_trigger [2024/09/09 13:27] (current)
dlee [Executing Workflows from SQL Using Direct Connection (Trigger)]
Line 1: Line 1:
-======Executing Workflows from SQL Using Direct Connection (Trigger)====== +======Called from SAP Business One (Trigger)====== 
-Bizweaver provides a method to trigger a workflow from a Post Execute SQL stored procedure (for example SAP SBO_SP_PostTransactionNotice) in an SAP database (SQL or Hana). From the SAP stored proc, trigger instructions are inserted into a Bizweaver staging table and then immediately into a queue via a 'listener' nodule as a trigger request. Based on the target workflow's availability, the listener processes the request, triggering the workflow via the Bizweaver Commander. +Bizweaver provides a method to trigger a workflow from a Post Execute SQL stored procedure (for example SAP SBO_SP_PostTransactionNotice) in an SAP database (SQL or Hana). From the SAP stored proc, trigger instructions are inserted into a Bizweaver staging table and then immediately into a queue via a 'listener' (installed with Bizweaver) as a trigger request. Based on the target workflow's availability, the listener processes the request, triggering the workflow via the Bizweaver Commander. 
  
-All trigger set-up, management, and monitoring can be done via the Bizweaver user interface without the need to manually add or change SQL code.+All trigger set-up, management, and monitoring can be done via the Bizweaver user interface without the need to manually add or change SQL code in SAP.
  
 =====Creating Your First Trigger===== =====Creating Your First Trigger=====
Line 16: Line 16:
 </WRAP> </WRAP>
 <WRAP center round important 80%> <WRAP center round important 80%>
-Once a Bizweaver user-defined variable has been assigned and saved as part of a trigger, it can not be deleted. To delete or change the variable (using the variable tool), the trigger must first be deleted.+Once a Bizweaver user-defined variable has been assigned and saved as part of a trigger, it can not be deleted. To delete or change the variable (using the variable tool), the trigger must first be deleted. Triggers are very disposable. Deletion simply removes the code for that trigger from the SAP proc and it's very easy to add a new trigger.
 </WRAP> </WRAP>
  
 {{:bw2:add_trigger_2.png?800|}} {{:bw2:add_trigger_2.png?800|}}
  
 +{{ :bw2:triggers.mp4 |}}
  
 === What's going on behind the scenes when a trigger is created? === === What's going on behind the scenes when a trigger is created? ===
 When the five required fields plus optional parameters are entered and the workflow is saved, Bizweaver: When the five required fields plus optional parameters are entered and the workflow is saved, Bizweaver:
-  - Creates a staging table in the SAP database (connection defined in the trigger setup)+  - Creates a staging table in the SAP database (connection assigned in the trigger setup)
   - Automatically inserts the SQL code that initiates the trigger into the SAP stored procedure.    - Automatically inserts the SQL code that initiates the trigger into the SAP stored procedure. 
  
 <WRAP center round info 80%>Bizweaver creates only one staging table per SAP database.</WRAP> <WRAP center round info 80%>Bizweaver creates only one staging table per SAP database.</WRAP>
  
-This code is surrounded by comments and is easy to identify by the trigger ID. It should not be tampered with. When the SAP stored procedure is called (ex. SAP SBO_SP_PostTransactionNotice), resulting from an action in SAP, then if the SAP document and action match those in the trigger SQL code, a record is inserted into the staging table. If trigger parameters were configured, then the values for those are also inserted with the record in the staging table. The parameter values are obtained from the SAP document SQL table using the SAP DocEntry key passed into the stored procedure by SAP+The code inserted into the SAP stored procedure is surrounded by comments and is easy to identify by the trigger ID. It should not be tampered with. When the SAP stored procedure is called (ex. SAP SBO_SP_PostTransactionNotice), resulting from an action in SAP, a record is inserted into the staging table including the SAP document SQL table name and DocEntry value.
  
 <WRAP center round important 80%>Do not tamper with the SQL code Bizweaver inserts into the SAP post-execute stored procs</WRAP> <WRAP center round important 80%>Do not tamper with the SQL code Bizweaver inserts into the SAP post-execute stored procs</WRAP>
Line 42: Line 43:
   * Clears trigger records (for both enabled and disabled triggers) from the staging table after enabled triggers are successfully copied to the request queue   * Clears trigger records (for both enabled and disabled triggers) from the staging table after enabled triggers are successfully copied to the request queue
   * Checks the status of the workflow the queued trigger is targeting   * Checks the status of the workflow the queued trigger is targeting
-  * Triggers the workflow if it is available (not running)+  * Triggers the workflow if it is available (not running), fetching parameters values for SAP using the SAP document table name and DocEntry value
   * Goes to the next trigger request in the queue   * Goes to the next trigger request in the queue
  
Line 50: Line 51:
  
 === From the Trigger Set-up Panel === === From the Trigger Set-up Panel ===
-  - With the set-up information populated in the fields, in the upper right corner click the lightbulb to enable/disable, or the trashcan to delete the set-up.+  - With the set-up information populated in the fields, in the upper right corner click the lightbulb to enable/disable, or the trashcan to delete the set-up. Saved triggers can be deleted this way too, but the deletion from the database will not happen until the workflow is saved.
  
 === From the Saved Trigger Listing Window for the Workflow === === From the Saved Trigger Listing Window for the Workflow ===
   - Click View Workflow Triggers at the bottom of the trigger set-up panel   - Click View Workflow Triggers at the bottom of the trigger set-up panel
   - Or, select Triggers from the workflow window View menu   - Or, select Triggers from the workflow window View menu
-  - Click the lightbulb to enable/disable, or the trashcan to delete the set-up+  - Click the lightbulb to enable/disable, or the trashcan to delete the trigger
  
 === From the Saved Trigger Listing Window for Bizweaver === === From the Saved Trigger Listing Window for Bizweaver ===
   - Select Triggers from the Bizweaver main View menu   - Select Triggers from the Bizweaver main View menu
-  - Click the lightbulb to enable/disable, or the trashcan to delete the set-up+  - Click the lightbulb to enable/disable, or the trashcan to delete the trigger
  
 <WRAP center round info 80%> <WRAP center round info 80%>
Line 75: Line 76:
   - Save the workflow   - Save the workflow
  
-<WRAP center round info 80%> +Saved and unsaved triggers (including those where the setup is incompleteare available in memory while designing the workflow. These can be accessed via the **...** icon in the upper right corner of the trigger set-up panel. However, the workflow cannot be saved with incomplete trigger set-ups. Bizweaver will require incomplete set-ups to be completed or removed before the workflow can be saved.
-Multiple complete **(all required fields entered)** or incomplete trigger set-ups can exist while designing the workflow, even if they have not been saved with the workflow yet. These can be accessed via the **...** icon in the upper right corner of the trigger set-up panel. However, the workflow cannot be saved with incomplete trigger set-ups. Bizweaver will require incomplete set-ups to be completed or removed before the workflow can be saved. +
-</WRAP>+
  
 +{{:bw2:modeless_window.png?800|}}
 =====Modifying One or More Unsaved Trigger Set-ups===== =====Modifying One or More Unsaved Trigger Set-ups=====
  
Line 86: Line 86:
   - Make any changes   - Make any changes
 <WRAP center round info 80%> <WRAP center round info 80%>
-Both saved and unsaved triggers are listed in this window and can also be enabled/disabled or deleted here as well.+Clicking the trashcan icon in this window does not delete saved triggers from the Bizweaver database or the SAP stored procs until the workflow is saved again.
 </WRAP> </WRAP>
  
Line 94: Line 94:
  
 =====Trigger Request Queue===== =====Trigger Request Queue=====
-A view to queued trigger requests is provided as a tab in the workflow and Bizwever Trigger listing windows.+A view to queued trigger requests is provided as a tab in the workflow and Bizwever main trigger listing windows.
  
 <WRAP center round info 80%> <WRAP center round info 80%>
 Typically requests are not in the queue long enough to be seen because of the speed of processing. However, if targeted workflows are not available (because they are running) you may see requests for those workflows queueing up. Typically requests are not in the queue long enough to be seen because of the speed of processing. However, if targeted workflows are not available (because they are running) you may see requests for those workflows queueing up.
 </WRAP> </WRAP>
 +{{:bw2:request_queue.png?800|}}
 +===Statuses of Queued Trigger Requests===
 +When you can see trigger requests in the request queue window, they will reflect one these statuses:
 +
 +  * Pending (status code = 0)
 +  * Sent (status code = 1)
 +  * Cancelled (status code = 3)
 +  * Completed (status code = 4)
 +  * Error (status code = 4)
  
 ====Holding Queued Trigger Requests==== ====Holding Queued Trigger Requests====
-You have the ability to put a Hold on processing queued requests. Clicking Hold allows trigger requests to que but prevents them from triggering workflows. +You have the ability to put a Hold (see the above screenshot) on processing queued requests. Clicking Hold allows trigger requests to queue but prevents them from triggering workflows until Resume is clicked
  
 <WRAP center round tip 80%> <WRAP center round tip 80%>
bw2/bizweaver_trigger.1679683229.txt.gz · Last modified: 2023/03/24 14:40 by mfoster