3 minute read BPS Version: 2023.1.3.202

Overview

After my previous Teams posts Start Teams chat with assigned users and Start Teams chat from user fields I was asked, whether we could add a button/icon to start the chat with the support. I really liked this idea and so I went ahead and put together a little solution for this.

Start a chat with the support team.
Start a chat with the support team.

Implementation

Overview

I think this solution will have a highly individual component how the support team should be defined. These are just a few questions which came to my mind:

  • Is this a fixed support team?
  • Should it be the process supervisor?
  • Should it be the application supervisor?
  • What should be done, if a custom application supervisor without a mail is defined?
  • How should the case be handled, if this mail cannot be used to start a chat?
  • Should there be a different support team per language?
  • Do we have to take care of different countries?

Since there are so many questions, I will provide just the basics, and you will have to ament it to your needs.

The basis consists of:

  1. Global business rule
  2. Global form rule
  3. HTML field

Global business rule

This rule returns the recipients of the message. The provided rule will return the recipients in the following priority:

  • Process supervisor
    You can define a dedicated process supervisor
  • Custom application supervisor or the BPS user
    Application supervisor definition
  • The fallback support team.

I’ve created the following global business rule with the provided SQL command.

Rule name: GetSupportCallRecipients
Description: Returns either: Process supervisor, application supervisor or default support team.

select isnull(ISNULL(ProcessSupervisor,ApplicationSupervisor),Fallback) as Recipients
from 
( select
	(
                  select case when DEF_Supervisor = '' then null else dbo.ClearWFElemId(DEF_Supervisor) end
   	  from WFDefinitions where DEF_ID = {DEF_ID}
	) ProcessSupervisor
	,(
   	  select 
                    case when APP_IsCustomSupervisor = 1 then (case when APP_CustomSupervisorMail = '' then null else APP_CustomSupervisorMail end)
                            else (case when APP_Supervisor = '' then null else dbo.ClearWFElemId(APP_Supervisor) end)
                     end 
	  from WFApplications where APP_ID = {APP_ID}
	) ApplicationSupervisor
	, 'support1@example.com;support2@example.com' Fallback
) support
Returns the support team for the current form context.
Returns the support team for the current form context.

Global form rule

You can download the JS for this form rule from the repository and paste it to the new form rule. Don’t forget to switch the type to JavaScript mode.

Rule name: AddTeamsSupportCall
Edit mode: JavaScript mode
A global form rule responsible for adding the Teams support link to the toolbar.
A global form rule responsible for adding the Teams support link to the toolbar.

HTML field

This is the code for the HTML field, which

  • invokes the created form rule,
  • gets the recipients from the business rule
  • and executes the logic to generate the button.
  • If no recipients are defined, no button will be added.
<script>
InvokeRule(#{BRUX:1004:ID}#)
dkr.teamsSupport.recipients = '#{BRD:1005}#'
dkr.teamsSupport.hoverInformation = 'Do you need support?';
dkr.teamsSupport.message = 'Hi, <br/>I have a question with:<br/>';
dkr.teamsSupport.prepareTeamsSupport(1,10)
</script>
The HTML field for adding the Teams support button to the toolbar.
The HTML field for adding the Teams support button to the toolbar.

While I hope that the property names / configuration parameters are self-explanatory, I will provide a short explanation:

  • recipients
    This can be a semicolon separated list of users with whom a chat should be started.
  • hoverInformation
    Will be displayed if the mouse cursor hovers above the icon.
  • message
    The message which will be added to the chat.

You can use a business rule with the Text function to make the texts multilingual.

You can also define the same parameters, as in the related post.

Of course, this field needs to be displayed in the field matrix. My recommendation is to add this field to the top panel.

Remark

I thought, the default Teams logo is not self explaining in this case, therefore I’ve used a different one. If you want to use the Teams logo, you can simply change this line in the form rule.

dkr.teamsSupport.icon = "ms-Icon--UnknownCall" //"ms-Icon--TeamsLogo"

You can check out other icons here, but not all of them are available in WEBCON BPS.

Why did I add the icon in the right toolbar

I’ve chosen this position, because I think it’s the most fitting. I also thought about adding it outside of the toolbar to make it more visible. In the end I decided against it, because it would be conflicting with this post Adding a help page.

Download

You can find the full and a minified JS version here.

If you are interested in the fact, that there’s a minified version at all, you can take a look at the post Bandwidth usage.

Comments