Author Topic: WDE Customization | Activate Mark Done Button Programmatically  (Read 1017 times)

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
I need to activate the Mark Done Button in the ToolbarInteractionBarRegion after a given time. For example, if the agent doesn't click on it in 20 seconds, it must "click itself".

I already know how to handle the timer elapsed event but I can't find any solutions for the button activation.

Anyone have any ideas?

Offline hsujdik

  • Sr. Member
  • ****
  • Posts: 351
  • Karma: 14
    • Genesys Brasil
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #1 on: August 23, 2019, 12:54:13 AM »
Try this (assuming you passed ICommandManager as argument, and assigned to commandManager):
Code: [Select]
commandManager.GetChainOfCommandByName("InteractionVoiceIfPossibleCloseInteraction").Execute();

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #2 on: August 23, 2019, 04:34:04 AM »
Try this (assuming you passed ICommandManager as argument, and assigned to commandManager):
Code: [Select]
commandManager.GetChainOfCommandByName("InteractionVoiceIfPossibleCloseInteraction").Execute();

Thank you, @hsujdik. It quite seems what I needed but it didn't really do the trick. When I run the command the interaction related views don't close the same way as when I push the MarkDone button manually.

I also tried :
Code: [Select]
commandManager.GetChainOfCommandByName("BundleClose").Execute();
But it didn't work as well.

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #3 on: August 23, 2019, 11:04:05 PM »
So, in case someone is wondering, I was able to come up with a solution for the "click itself" thing. There is a keyboard shortcut for pressing the MarkDone button, it's CTRL + E.

I found this NuGet package called InputSimulator v1.0.4 by Michael Noonan (https://archive.codeplex.com/?p=inputsimulator). Using it I managed to simulate this shortcut programmatically.

After installing the package, first you need to add these namespaces:
Code: [Select]
using WindowsInput.Native;
using WindowsInput;

Then, where or when you want to activate the keyboard shortcut you must insert this:
Code: [Select]
InputSimulator inputSimulator = new InputSimulator();
inputSimulator.Keyboard.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_E);

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7040
  • Karma: 56330
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #4 on: August 24, 2019, 01:08:13 AM »
Nice. Thanks for sharing. As long as it works is good. Just be care to keep that mapping at WDE options


Enviado de meu SM-G9650 usando o Tapatalk


Marked as best answer by vinicius.gaspar on October 23, 2019, 03:30:11 PM

Offline RobertH

  • Jr. Member
  • **
  • Posts: 68
  • Karma: 1
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #5 on: September 27, 2019, 04:55:13 PM »
Command chain must be working. you don't need to use workarounds and simulate click :-)

I did it like that:
private IInteractionManager ixnManager;

ixnManager = _container.Resolve<IInteractionManager>();

//if you are in interaction view just take current interaction from case
IInteraction ixn = ixnManager.GetInteractionByEntrepriseId(interactionId);

IDictionary<string, object> parameters = new Dictionary<string, object>();
//maybe bundle will be part of case depending from which view are you using
parameters.Add("CommandParameter", ixnManager.GetBundleById(ixn.BundleId));

//execute command chain with correct parameters and it will work
container.Resolve<ICommandManager>().GetChainOfCommandByName("BundleClose").Execute(parameters);
Robik

Offline vinicius.gaspar

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: WDE Customization | Activate Mark Done Button Programmatically
« Reply #6 on: October 23, 2019, 06:32:00 AM »
Command chain must be working. you don't need to use workarounds and simulate click :-)

I did it like that:
private IInteractionManager ixnManager;

ixnManager = _container.Resolve<IInteractionManager>();

//if you are in interaction view just take current interaction from case
IInteraction ixn = ixnManager.GetInteractionByEntrepriseId(interactionId);

IDictionary<string, object> parameters = new Dictionary<string, object>();
//maybe bundle will be part of case depending from which view are you using
parameters.Add("CommandParameter", ixnManager.GetBundleById(ixn.BundleId));

//execute command chain with correct parameters and it will work
container.Resolve<ICommandManager>().GetChainOfCommandByName("BundleClose").Execute(parameters);

Thanks for sharing! This method worked way better.  :)