Sample: How to Post Top 5 Sales Employees to Slack

  • Updated

In this sample, we will show you how you can post last week's Top 5 sales employees on to Slack from B1 Print and Delivery. (also works for Microsoft Teams)

What you need:

  • B1 Usability Package 2019.04 or higher
  • A B1 Usability Package License
  • A B1 Print and Delivery License
  • A Slack account (you need to be owner/admin of the Channel you set it up in)
    • An incoming Webhook connector (See this video on how to make one)
  • An empty dummy crystal report

Step by Step Setup:

  1. Go to Administration > Add-ons > B1 Usability Package > Module Configuration > B1 Print and Delivery > Mass Delivery Configuration
    • Create the following Internal Configuration (remember to tick off the "Allow the user to select a different report configuration when running mass delivery" option)
  2. Go to Administration > Add-ons > B1 Usability Package > Module Configuration > B1 Print and Delivery > Crystal Report Definition
    • Create the following configuration (the path to the Crystal report need to be to your empty Crystal Report)
  3. Go to Administration > Add-ons > B1 Usability Package > Module Configuration > B1 Print and Delivery > Report Action
    • Create a new Report action of type "HTTP Trigger"
    • In URL enter the URL of you Slack Webhook
    • Set template to "Slack"
    • Enter the following message 

      *Top 5 Sales Employees of last week*

      SQLNUMBEREDLIST(
      SELECT
      TOP 5
      CONCAT(SlpName, ' (',FORMAT(SUM(T0.DocTotal),'N'),')') AS TopSalesEmployee
      FROM OINV T0
      JOIN OSLP T1 ON T0.SlpCode = T1.SlpCode
      WHERE T0.DocDate > '$[StartOfLastWeek_SQL]'
      GROUP BY T1.SlpName
      ORDER BY SUM(T0.DocTotal) DESC
      )

      • You can tweak the SQL as you please
  4. Go to Administration > Add-ons > B1 Usability Package > Module Configuration > B1 Print and Delivery > Report Configuration
    • Give the configuration a description
    • Choose Category "Other"
    • Choose "Internal" as type
    • Choose the Dummy Crystal Report you created in step 2 as Crystal Report
    • Choose the Report Action you created in step 3 as Report Action for "Email"
  5. It is now possible to test the feature using Mass Delivery
  6. Go to Administration > Add-ons > B1 Usability Package > Module Configuration > B1 Print and Delivery > Schedules
    • Set the feature to run on a schedule (in my case I've set it up to send out via the Server component every Monday at 8 o clock)

 

Was this article helpful?

1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.