Author Topic: IWS Customization - Regions - do they always exist?  (Read 5515 times)

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
IWS Customization - Regions - do they always exist?
« on: August 09, 2014, 01:40:54 AM »
Hello,

In an outbound preview interaction I can register and display a custom view in the region named, "InteractionsBundleRegion". The view displays as expected. However during an inbound interaction (in my case if I call the agent extension directly - no routing involved), if I attempt to register and display a custom view in the same region, nothing ever appears.

It is almost as if that region does not exist in the IWS interaction window on inbound interactions. What further makes me think this is that I can register/display the custom view in different regions during inbound interactions, one I had success with was named "ConsultationBundlesRegion".

I guess my question is, does the InteractionsBundleRegion exist during inbound interactions?  If not, can I "make it" exist?

This is IWS 8.1.401.44.

Regards,
Andrew

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: IWS Customization - Regions - do they always exist?
« Reply #1 on: August 11, 2014, 05:38:07 PM »
After more research I am virtually certain that the regions do always exist on the various IWS windows.

What prompted me to question this was the fact I am having difficulty displaying a custom view in a particular region.

In the past, I have always displayed views very similar to how some of the sample customization's from Genesys show how to do this:

[code]
container.RegisterType<IMyCustomControlViewModel, MyCustomControlViewModel>();
container.RegisterType<IMyCustomControlView, MyCustomControlView>();     

viewManager.ViewsByRegionName["InteractionsBundleRegion"].Add(
  new ViewActivator()
  {
  ViewType = typeof(IMyCustomControlView),
  ViewName = "MyCustomControlView",
  ActivateView = true,
  Condition = MyCustomControlView.MyCustomControlViewCondition
});
[/code]

The above block of code gets executed as IWS starts.  Then whenever a new interaction window appears, the code in the defined Condition method is run.  If the method returns true, the view is activated, if the method returns false, the method is not activated.  This code works as expected and displays my view whenever a new interaction window appears and the condition is met.

I want to activate a view in a different way now.  I want to activate a view based on some action a user performs (like clicking a button while an interaction window is already present).  For example, imagine I am displaying a custom view with a button in the interaction window, user clicks the button, I want a new view to appear.  I guess I am not sure how to accomplish this and am looking for some help.

Here is what I have done so far:

I register my view when IWS is executed:

[code]
container.RegisterType<IMyOtherCustomControlViewModel, MyOtherCustomControlViewModel>();
container.RegisterType<IMyOtherCustomControlView, MyOtherCustomControlView>();
[/code]

I define the ViewActivator in the region I want to the to appear when IWS executes:

[code]
viewManager.ViewsByRegionName["InteractionsBundleRegion"].Add(
    new ViewActivator()
    {
    ViewType = typeof(IMyOtherCustomControlView),
    ViewName = "MyOtherCustomControlView",
    ActivateView = true,
    DynamicOnly = true 
    });
[/code]

Then, when the user performs the action I want performed in order to trigger the new view to be displayed, I execute the following code:

[code]
viewManager.InstantiateDynamicViewInRegion(caseView, "InteractionsBundleRegion", "MyOtherCustomControlView", "MyOtherCustomControlView");
[/code]

However my new view is never displayed.

Any feedback on what I might be doing incorrectly?

Regards,
Andrew

Offline abudwill

  • Full Member
  • ***
  • Posts: 157
  • Karma: 4
Re: IWS Customization - Regions - do they always exist?
« Reply #2 on: August 13, 2014, 10:02:23 PM »
I finally understand where I went wrong.  Wanted to post for anyone else who wants to dynamically display custom views after some action occurs (like a button click from an agent, or captured event).

First, it is imperative to understand the hierarchy of regions and views as listed on the Genesys documentation site.

Register your components:
[code]
container.RegisterType<IMyCustomControlViewModel, MyCustomControlViewModel>();
container.RegisterType<IMyCustomControlView, MyCustomControlView>();     
[/code]

Next, add a ViewActivator to the region you want your custom view to display in:

[code]
viewManager.ViewsByRegionName["InteractionsBundleRegion"].Add(
    new ViewActivator()
    {
    ViewType = typeof(IMyCustomControlView),
    ViewName = "MyCustomControlView",
    ActivateView = true,
    DynamicOnly = true
    });
[/code]

Where I was going wrong was - not paying attention to the hierarchy of regions/views as documented by Genesys.  The InteractionsBundleRegion is the immediate child of the view named BundleView.  As a result when I consume InstantiateDynamicViewInRegion, I need to provide the [b][i]appropriate[/i][/b] parent view (which I was not doing).

The proper way to do this in my case would be to get an instance of BundleView through the IViewManager interface, and provide it:

[code]
// pay attention to hierarchy here again, BundleView is an immediate child of region MainBundleRegion
IBundleView bundleView = (IBundleView)viewManager.GetViewInRegion(this, "MainBundleRegion", "BundleView");
viewManager.InstantiateDynamicViewInRegion(bundleView, "InteractionsBundleRegion", "MyCustomControlView", "some id", this.Context);
[/code]

I hope this helps someone at some point.

Regards,
Andrew

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: IWS Customization - Regions - do they always exist?
« Reply #3 on: August 14, 2014, 12:23:38 AM »
;D Thanks for sharing!

Offline ricardo.sosa

  • Newbie
  • *
  • Posts: 16
  • Karma: 2
Re: IWS Customization - Regions - do they always exist?
« Reply #4 on: October 20, 2014, 05:44:22 PM »
Hello abudwill,
I am trying to get to a new tab I added on ToolbarWorkplaceRegion. I have tried getting MyWorkplaceContainerView and passing it, but it can find it.
[code]
IMyWorkplaceContainerView workplaceView = _container.Resolve<IMyWorkplaceContainerView>();
ITabRecordsCLView TabRecordsCL = (ITabRecordsCLView)_viewManager.GetViewInRegion(workplaceView, "ToolbarWorkplaceRegion", "TabRecordsCL");
[/code]

I don't know if I am getting the IMyWorkplaceContainerView in the wrong way or if IMyWorkplaceContainerView is not the parent view.
Can anyone help me here?

Thank you in advance.