" /> WDE GetPreviewRecord Command - Genesys CTI User Forum

Author Topic: WDE GetPreviewRecord Command  (Read 6631 times)

Offline gzooby

  • Full Member
  • ***
  • Posts: 141
  • Karma: 0
  • Software Engineer at Telefax S.A.
WDE GetPreviewRecord Command
« on: March 23, 2015, 05:47:20 PM »
Advertisement
HI Everyone, Iīm having some difficulties modifying chain of commands in Workspace.
The thing is, in documentation there is a very large list of commands available. There ir one called "CampaignGetPreviewRecord".
The thing is when I use method CommandsByName, i have only a limited numbre of this commands, and the one I want to use is not available...

Iīm I missing some dll import? Why are this commands missing?

Regards

Z

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: WDE GetPreviewRecord Command
« Reply #1 on: March 24, 2015, 03:05:45 AM »
Are you looking to execute this command chain manually, or insert a custom command somewhere in this command chain? Let me know and I can advise further.

Regards,
Andrew

Offline gzooby

  • Full Member
  • ***
  • Posts: 141
  • Karma: 0
  • Software Engineer at Telefax S.A.
Re: WDE GetPreviewRecord Command
« Reply #2 on: March 24, 2015, 02:13:19 PM »
I want to do something when user get a preview record, so I wanted to add a command to commandchain "GetPreviewRecord", but this command is not in the list when I print CommandsByName.

I want to insert new command in this command chain, but I got an error because this chain doesnīt exist despite itīs in Genesys doc

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: WDE GetPreviewRecord Command
« Reply #3 on: March 26, 2015, 05:06:46 AM »
You noted the name of the CommandChain was "GetPreviewRecord".  I only looked quickly on the Genesys Doc site and didn't see this command chain.  I did see, "CampaignGetPreviewRecord" (http://docs.genesys.com/Documentation/IW/8.1.4/Developer/Outbound).

It looks like that CommandChain comes with one command, "GetOutboundPreviewRecord".

To add a command to this command chain you must:

1. Have a reference to ICommandManager

2. Define your custom command (follow the example CustomCommand.cs example at http://docs.genesys.com/Documentation/IW/8.1.4/Developer/UseCustomizableCommands) - note that when you return false in your custom command that is equivalent to saying "this command ran successfully, continue to command chain".  If you return true it is equivalent to saying, "this command failed, halt the command chain".

3. Insert your custom command in the command chain in your entry point class, you have to insert your command before or after an existing command in the chain.  Lets say you have a custom command in class MyCustomCommand.cs, to register it to run before command GetOutboundPreviewRecord in CommandChain CampaignGetPreviewRecord you would:

[code]
            commandManager.InsertCommandToChainOfCommandBefore("CampaignGetPreviewRecord ", "GetOutboundPreviewRecord ",
                new List<CommandActivator>() { new CommandActivator() {
                CommandType = typeof(MyCustomCommand), Name = "MyCustomCommand"
            }});
[/code]

You only have to worry about parameters if you want to execute a command or command chain manually.  If I ever have the need to do this, I usually insert a breakpoint and inspect what the parameters look like in order to form them properly.  Additionally, I have found sometimes CommandChains and Commands are not documented well.  This is especially true in 3rd party components like Agent Scripting.  IWS logs will be your friend - when set to the most verbose level you can run IWS/WDE, perform the action you want to tag your custom command on, then go reference logs and search for "Command" - you are bound to find the name of the CommandChain that ran along with all the Command names.

Regards,
Andrew

Offline gzooby

  • Full Member
  • ***
  • Posts: 141
  • Karma: 0
  • Software Engineer at Telefax S.A.
Re: WDE GetPreviewRecord Command
« Reply #4 on: March 26, 2015, 05:59:00 PM »
Hi Abudwill, thank you a lot for your response.
I have the following code, to print the commands I have available:

for (int i=0;i< commandManager.CommandsByName.Keys.Count;i++)
          {
                MessageBox.Show(commandManager.CommandsByName.Keys.ToArray()[i], "Custom Extension", MessageBoxButton.OK);
            }

Here I printed all the command chains available, and I donīt have anything related to Outbound. I tried the code you wrote:

commandManager.InsertCommandToChainOfCommandBefore("CampaignGetPreviewRecord ", "GetOutboundPreviewRecord ",
                    new List<CommandActivator>() { new CommandActivator() {
                CommandType = typeof(AfterGetRecordCommand), Name = "AfterGetRecordCommand"
                }});

But no effect, I attach my custom commando for you to see it:


class AfterGetRecordCommand : IElementOfCommand
    {
        public bool Execute(IDictionary<string, object> parameters, IProgressUpdater progressUpdater)
        {
            if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess())
            {
                MessageBox.Show("You got a record!", "Custom Command", MessageBoxButton.OK);
               
               
                object result = Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, new ExecuteDelegate(Execute), parameters, progressUpdater);
                return (bool)result;
            }
            else
            {
                MessageBox.Show("You got a record!", "Custom Command", MessageBoxButton.OK);
                return true;

            }
                   
        }

        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// This delegate allows to go to the main thread.
        /// </summary>
        delegate bool ExecuteDelegate(IDictionary<string, object> parameters, IProgressUpdater progressUpdater);




Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: WDE GetPreviewRecord Command
« Reply #5 on: March 26, 2015, 06:56:17 PM »
A couple of things:

Your custom logic only needs to exist in the else part of your if/else block:
[code]
  if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess())
{
...
}
else
{
// your custom logic
}
[/code]

I am still not entirely certain what CommandChain you are trying to attach your logic to.  What I suggest you do next is increase your IWS logging and then without customization perform whatever action it is that you want to tag your custom code to (for example, received a pull preview record).  After this, you can go look at your IWS logs and actually see what command chains / commands ran.  Then you can properly tag your command onto whatever you actually see that ran.

On your IWS/WDE application object, add or modify these values:

[code]
log.All=C:\Logs\InteractionWorkspace\$Agent.UserName$
log.default-filter-type=Copy
log.ESDK=All
log.expire=10
log.filter-data.<keyName>=Copy
log.max-age=10
log.PSDK=Standard
log.PSDK.ChannelService=All
log.segment=10MB
log.Trace=$Application.RootApplicationData$\log\InteractionWorkspace
log.verbose=All
[/code]

This will cause logs to appear at C:\logs\InteractionWorkspace\<IWS_USERNAME>.

You will want to search the logs for strings like:
"Start Execution of Chain of Command"
"Execute of Chain of Command"

For example here is an expert from some of my logs when I log on:
[code]
15-03-16 22:22:17.143 [            1] DEBUG cture.ChainOfCommand - Start Execution of Chain of Command MediaOpenMediaLogOnPlace EnterpriseAgent
Channel

15-03-16 22:22:17.144 [            1] DEBUG cture.ChainOfCommand - Execute of Chain of Command MediaOpenMediaLogOnPlace -> Name:UpdateInteractionSignature Type:Genesyslab.Desktop.Modules.LRMSupport.Model.Login.InxUpdateSignature
15-03-16 22:22:17.145 [            1] INFO  upport.Ixn Signature - Insert Signature disabled by option
15-03-16 22:22:17.147 [            1] DEBUG cture.ChainOfCommand - Execute of Chain of Command MediaOpenMediaLogOnPlace -> Name:LogOnPlace Type:Genesyslab.Desktop.Modules.OpenMedia.Model.Agents.LogOnPlaceOpenMediaCommand
15-03-16 22:22:17.149 [            1] INFO  ediaOpenMediaCommand - LogOnPlaceOpenMediaCommand
[/code]

Now that I see this CommandChain and what Commands in it are run - I would know how/where to register my custom command.

If you are still having trouble please post an excerpt from your IWS logs showing what Command Chain / Comman you are trying to attach to and code snippets of your Command registration and complete custom command class.

Regards,
Andrew

Offline gzooby

  • Full Member
  • ***
  • Posts: 141
  • Karma: 0
  • Software Engineer at Telefax S.A.
Re: WDE GetPreviewRecord Command
« Reply #6 on: March 26, 2015, 08:51:05 PM »
Here is an extract of WDE log (without customization)

15-03-26 17:22:21.924 [            27] INFO  ound.CampaignCommand - GetPreviewRecordCampaignCommand
15-03-26 17:22:21.928 [            27] INFO  cture.ChainOfCommand - End of Execution of Chain of Command CampaignGetPreviewRecord (  11,001 ms)
15-03-26 17:22:22.131 [.PCT.Invoker#6] INFO                  ESDK - Voice strategy 'VoiceProtocolEventStrategy' [Dn] 2301 Processing msg [Name] EventACK [EndPoint] TServerA4400 - tcp://ss10370:7007
15-03-26 17:22:22.158 [.PCT.Invoker#6] WARN                  ESDK - Strategy 'MultimediaErrorUserEventStrategy' not used
15-03-26 17:22:22.158 [.PCT.Invoker#6] WARN                  ESDK - Multimedia strategy 'MultimediaUserEventInteractionStrategy' not used
15-03-26 17:22:22.159 [.PCT.Invoker#6] INFO                  ESDK - Voice strategy 'VoiceProtocolEventStrategy' [Dn] 2301 Processing msg [Name] EventUserEvent [EndPoint] TServerA4400 - tcp://ss10370:7007 Asynchronous message. No switch policy applies
15-03-26 17:22:22.170 [.PCT.Invoker#6] WARN                  ESDK - Strategy 'MultimediaErrorUserEventStrategy' not used
15-03-26 17:22:22.171 [.PCT.Invoker#6] WARN                  ESDK - Multimedia strategy 'MultimediaUserEventInteractionStrategy' not used
15-03-26 17:22:22.200 [            21] INFO  ound.OutboundCommand - StartPreviewRecordOutboundCommand
15-03-26 17:22:22.851 [            1] INFO  tructure.ViewManager - Cannot find the region 'CaseViewButtonRegion'
15-03-26 17:22:22.902 [            1] INFO  ws.CaseDataViewModel - CaseDataFormatBusinessAttribute (IsToast:False): 'Interaction Attribute' [InteractionPullPreview: Id000/]


In the initialize of my implmentation of IModule interface class, this is my code:

commandManager.CommandsByName["CampaignGetPreviewRecord"].Insert(0, new CommandActivator() { CommandType = typeof(AfterGetRecordCommand) });


My custom command class is this:


class AfterGetRecordCommand : IElementOfCommand
    {
        public bool Execute(IDictionary<string, object> parameters, IProgressUpdater progressUpdater)
        {
            if (Application.Current.Dispatcher != null && !Application.Current.Dispatcher.CheckAccess())
            {
                MessageBox.Show("You got a record!", "Custom Command", MessageBoxButton.OK);
               
             
                object result = Application.Current.Dispatcher.Invoke(DispatcherPriority.Send, new ExecuteDelegate(Execute), parameters, progressUpdater);
                return (bool)result;
            }
            else
            {
                MessageBox.Show("You got a record!", "Custom Command", MessageBoxButton.OK);
               
               
                return true;

            }
                   
        }

        public string Name
        {
            get;
            set;
        }

        /// <summary>
        /// This delegate allows to go to the main thread.
        /// </summary>
        delegate bool ExecuteDelegate(IDictionary<string, object> parameters, IProgressUpdater progressUpdater);

    }
}


But I receive an excepetion as this commandchain doesnīt exist. Is it probable that at that point in which I call initialize method this outbound commands hadnt  been added yet??

Regards

Z

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: WDE GetPreviewRecord Command
« Reply #7 on: March 26, 2015, 09:04:05 PM »
Not sure I can answer your question about why you are receiving the exception.

I have never added commands to command chains in that fashion before.

What if you try to add the command to the chain like this:
[code]
      commandManager.InsertCommandToChainOfCommandBefore("CampaignGetPreviewRecord ", "GetOutboundPreviewRecord ",
                new List<CommandActivator>() { new CommandActivator() {
                CommandType = typeof(AfterGetRecordCommand), Name = "AfterGetRecordCommand"
            }});
[/code]

Instead of:

[code]
commandManager.CommandsByName["CampaignGetPreviewRecord"].Insert(0, new CommandActivator() { CommandType = typeof(AfterGetRecordCommand) });
[/code]

Do you have any better luck?

Regards,
Andrew

Offline gzooby

  • Full Member
  • ***
  • Posts: 141
  • Karma: 0
  • Software Engineer at Telefax S.A.
Re: WDE GetPreviewRecord Command
« Reply #8 on: March 27, 2015, 12:51:54 PM »
If I use this method:

commandManager.CommandsByName["CampaignGetPreviewRecord"].Insert(0, new CommandActivator() { CommandType = typeof(AfterGetRecordCommand) });

I got an exception telling me the command chain with the name "CampaignGetPreviewRecord" doesnīt exist.

If I use this method:

commandManager.InsertCommandToChainOfCommandBefore("CampaignGetPreviewRecord ", "GetOutboundPreviewRecord ",
                new List<CommandActivator>() { new CommandActivator() {
                CommandType = typeof(AfterGetRecordCommand), Name = "AfterGetRecordCommand"
            }});

I donīt get an exception, but nothing happens, the command isnīt inserted, because, when i ask por a record, nothing happens!

Any ideas? Thank you for your help!

Regards

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: WDE GetPreviewRecord Command
« Reply #9 on: March 30, 2015, 07:00:22 AM »
This wouldn't be contributing to your problem, but - you would want to return false to indicate the command was successful and the chain of commands should be continued.  You only return true when the command failed / you don't want any further commands in the chain to run.

If you insert break points in your custom command, do you see it trigger at all?

Regardless, run another test with the command registration as I suggested, then paste IWS logs from the first mention of the command chain to the last mention of the command chain.  Alternatively feel free to PM me a zip file of the entire log.

Whenever I have experienced what you are experiencing - it is because I am attaching to the wrong command chain.  Although it seems you have chosen the correct one.

Regards,
Andrew