Account Bulk Action Workflow Rule

 

Typically when workflow rules are setup they are individual updates or inserts for a single account. They can be run in bulk when made available for a specific saved search. When run in bulk it would run the single SQL statement for each row in selected in the saved search results.  This can take a while if there are alot of items and sometimes if the logic is to create a log for all items or a note for all items the SQL can be simplified. 

 

Here is an example of simple workflow rule that will insert a specific account note. If run in bulk it will insert all at once instead of looping through each item.

 

The user should have prior knowledge of SQL language and understand the structure of the existing database before attempting to construct a SQL statement.

 

 

  1. Setup Workflow Rule

 

  1. From Settings, Click Client/Debtor
  2. Click Debtor Account Workflow Rules
  3. Click Add
  4. Name Workflow rule - this is what displays to the user
  5. Enter SQL Select
  6. Enter SQL Update
  7. Enter the current date for Schedule Start Date and Last Time Run
  8. Check Active
  9. Check Can Be Applied As Bulk Action
  10. Click Save
  11. Switch to User Interface
  12. Click Saved Searches - Workflow Rules
  13. Select the Saved Search for Accounts
  14. Pick the workflow created previously

 

Example SQL Select:

select {ClientCredID}

Example SQL Update:

INSERT INTO IssueNotes(CreatedUserID, NoteDate, Notes, NoteType, ClientID, ClientCredID)
SELECT '{UserID}', GETDATE(), 'Test bulk insert for list ', 'QuickNote', cc.ClientID, cc.ClientCredID
FROM dbo.IDListToTable({SavedSearch_RecordIDs} ) t
    INNER JOIN clientcred cc ON t.ListID = cc.ClientCredID

 

 

Note the use of the bookmark {SavedSearch_RecordIDs}. That will be replaced with the list of ClientCredIDs from the selected rows on in the saved search.  Example  100,101, 102.   We use the function IDListToTable to turn that string of IDs into a table of IDs that we can join to ClientCred.