Open popup pages in new tabs

Aug 23, 2010 at 9:45 AM

Hello Everyone,

I have a requirement that MSCRM should be fully contained within the customer care solution.

For example, if a user opens an open case from the contact records assosiated view then it should not open in a popup.

The best solution would be that any popup pages open in a new tab in the current call/session.

Is this possible without too much rewriting of the agent desktop? My guess would be that I may be able to catch the event of the window openning then start a new tab within a sequentail workflow but I am not sure what event, and how to open the new tab with the URL?

Thanks & kindest regards,
Johan

Aug 23, 2010 at 2:03 PM

You can do this a few ways.
1) Use HAT and register for one of the NewWindow Events via the RegisterForEvent shape. You can find more information on that in the UII Development guide… search for WEB DDA EVENTS

2) Use a web application adapter and override the “OnNewWindow” event… in my sample event I am capturing only a few types of windows from CRM and allowing others to pop up on their own.

/// <summary>
/// Handel window popup. 
/// </summary>
/// <param name="newURL">Requested URL</param>
/// <param name="fromURL">Orginating page</param>
/// <param name="flags">Options</param>
/// <returns>True to Navigate, false to block it</returns>
public override bool OnNewWindow(string newURL, string fromURL, long flags)
{
    // Diag adapter and event to Log. 
    System.Diagnostics.Trace.WriteLine(string.Format("{0} >> NEW WINDOW RAISED >> {1}", this.Name, string.IsNullOrEmpty(newURL) ? "No URL" : newURL));
    if (!string.IsNullOrEmpty(newURL))
    {
        // Do I care about this window?
        if (newURL.Contains("sfa/accts") || newURL.Contains("cs/cases")
                || newURL.Contains("sfa/conts") || newURL.Contains("ma/campaignresponse")
            || newURL.Contains("sfa/salesorder")
            || newURL.Contains("userdefined/")
            )
        {
            // If its this type I need to do something diffrent. 
            if (newURL.Contains("ma/campaignresponse"))
            {
                // Load a Dynamic App 
                if (!Desktop.AppExistsInUI("Campaign Response"))
                    Desktop.CreateDynamicApplication("Campaign Response");

                if (Desktop.AppExistsInUI("Campaign Response"))
                {
                    // Fire an Action at it. 
                    RequestActionEventArgs args = new RequestActionEventArgs("Campaign Response", "nav", newURL);
                    AdapterFireRequestAction(args);
                    Desktop.SetFocusOnApplication("Campaign Response");
                    return false;
                }
            }

            // Navigate the current window to the newURL
            Browser.Navigate(newURL);
            return false;
        }
    }
    // Allow the window to pop normaly. 
    return base.OnNewWindow(newURL, fromURL, flags);
}
MattB-msft. 

Aug 24, 2010 at 8:27 AM

Thanks Matt...

The second example is exactly what I am looking for.

 

Sep 1, 2010 at 4:32 PM

Hello Matt,

I've started implenting your code from example two, and i'm not sure how to get the DesktopService so I can execute the CreateDynamicApplication method.

Therefore I get the following errors when I build

The type or namespace name 'AppExistsInUI' does not exist in the namespace 'Microsoft.Uii.Desktop' (are you missing an assembly reference?) 

 The type or namespace name 'CreateDynamicApplication' does not exist in the namespace 'Microsoft.Uii.Desktop' (are you missing an assembly reference?) 

 The type or namespace name 'AppExistsInUI' does not exist in the namespace 'Microsoft.Uii.Desktop' (are you missing an assembly reference?) 

The type or namespace name 'SetFocusOnApplication' does not exist in the namespace 'Microsoft.Uii.Desktop' (are you missing an assembly reference?) 

The type 'System.Windows.Forms.UserControl' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Thanks for your help with my many questions over the last few weeks, I promise I'll stop asking soon!

Regards,

Johan

 

 

Sep 1, 2010 at 8:29 PM

You need to add a reference to your code for Microsoft.Uii.Desktop.Core, then add the interface IDesktopUserActionsConsumer to your class.
Right click on that and Implement the interface and you will get this :

Interface added to the class :

public class MyWebBrowserAdapter : WebApplicationAdapter, IDesktopUserActionsConsumer
{
-- Class Var to Hold the poiner..
/// <summary>
/// if wired, the pointer to the UII Desktop services. 
/// </summary>
public IDesktopUserActions Desktop;
-- Interface implementation : 
#region IDesktopUserActionsConsumer Members

public void DesktopLoadingComplete()
{}

public void SetDesktopUserActionsAccess(IDesktopUserActions desktopAccess)
{
    if (Desktop == null)
        Desktop = desktopAccess; 
}

#endregion
}
where "Desktop" now becomes your point to the desktop services in the local control. 
 
 MattB-MSFT. 
Sep 2, 2010 at 12:16 PM

Hello Matt,

This worked...thanks.

Now the final part of this puzzle... I hope you can help me again!

I need all of the MSCRM forms to open in new windows, so I created 10 new hosted applicaitons. PopupApp1, PopupApp2, PopupApp3 etc.... (I am happy with the limitiation of 10 windows per session)

The problem is that the session become messy, because the labels on the application tabs and the corrosponding pages are not related. I thought about creating an hosteld application for each entity type, but then if you want to open two records at once of the same record type you cannot.

Do you have any suggestions?

Regards,

Johan

Sep 2, 2010 at 5:57 PM
Edited Sep 2, 2010 at 5:59 PM

That’s a hard one, ( bit of an book here.. )

There are a few ways to address it…

First is to ask yourself why you want to have the popup windows pop like that? That is normal dynamics behavior out of the box, and, in my experience, the first thing most centers want you to do is stop it. In most of the Dynamics CRM related controls I write, I generally work to keep all “similar” content in one tab in the UI.
To explain… with Dynamics CRM, I generally work down the path of creating a Trail, or using a Navigator control to move between views. For example,

If you open a contact and want to goto the account, You click the primary account link in the contact form. That will navigate the current window to the account, if you want to go back, you click the associated contact in the account form to go back. That usually works with things that have a logical path to them.. However things like orders, quotes, actives can be regarding all sorts of thing’s and not have a clear “line” of relationship within the forms. In that case I use an “Account Navigator” control which visually represents the structure of the current account and all its related items, similar to the details view on the left of any given form, however tailored in a tree view and targeted at the needs of the role. That allows the agent to get around the structure pretty quickly and lets me keep all of the navigating in one window.

Given all that.. and you still want to do new window per pop, there are really only 2 ways in UII to handle it. Both involve using Dynamic Applications as you mentioned, the difference is that you can target them at a floating panel vs the main panel.

There are 3 ‘special’ panels in Uii,

  • Hiddenpanel – is an off the view space panel that the user cannot see
  • FloatingTool – is a floating window with a tool frame
  • Floating – is a floating window with a “normal’ frame, IE it can be minimized and maximized.

In your case, if the user wants the “popup” effect and you need to manage all the popups to the session, the Floating window is your best bet, that will create a new floating window per application.

Hope that helps.

MattB-MSFT

Oct 6, 2010 at 3:10 PM

Hi Matt, I took you're advice in the story above and ended up making most of the windows act as popups, but a few import types such as activities get pinned into the case on new hosted applications.

 

Now another question.... that I hope someone can help me with.

To trigger the new hosted applications I used the code Matt provided me with for the OnNewWindow method earlier in this thread. In this code you use 'return false'. The false triggers the on window event to cancel the new window openning which is correct for my situation.

The problem however is that I get a messagebox from the CRM parent pages as it assumes that a popup blocker has performed this action and explains how to fix the popup blocker.

"A Microsoft Dynamics CRM window was unable to open, and may have been blocked by a pop-up blocker. Please add this Microsoft Dynamics CRM server to the list of sites your pop-up blocker allows to open new windows:crm"

I tried searching MSDN and googling for a solution, but each result is about how to disable popup blockers, not how to stop the message displaying in the case you want the window blocked.

Thanks,

Johan

Oct 11, 2010 at 1:54 PM

Hi,

I solved the problem above, but in an unsupported manner.

I edited global.js on the crm web server and removed the alert that was warning the user about popups

 

function handlePopupBlockerError()
{
    // Commented out this line so the message doesn't appear when
// CCA suppresses popups.

         //alert(LOCID_POPUP_BLOCKER_ERROR + window.location.hostname);

  }

 

 


Oct 11, 2010 at 5:31 PM

Modifying the CRM server side JS is highly unsupported right now.
You can "fix" this from the web application adapter rather than from CRM itself, which has the advantage of not impacting CRM's general use.

Set you a PM on the approach and will post it a bit later.

MattB-MSFT

Nov 18, 2010 at 3:29 PM

Hi Matt!

 

I also had to open new windows in tabs, and came along the problem with the pop blocker. The solution with the server side js is ok for me, but i would prefer the solution inside the web application adapter which you where talking about.

 

Can you please post it, I would appreciate that!

 

thx Manuel

Nov 22, 2010 at 4:25 PM

here you go :
http://blogs.msdn.com/b/mbarbour/archive/2010/11/22/how-to-override-the-crm-4-0-popup-alert-in-cca-when-redirecting-a-popup.aspx

MattB-MSFT

Nov 23, 2010 at 9:02 AM

Thank you Matt, this worked!

 

Now I have another question:

I like to create a new session out of the web application adapter, but I don't know where to start. I've tried to implement severall interfaces, but everytime I came to a point where something is missing.

thx Manuel

Nov 23, 2010 at 3:09 PM

In this case there are 2 ways to do this… the first way uses a customer object as the data payload, and is actually how I do Session Rehydration in the ICC Client. The second uses the CTI path.. as the CTI path’s base code is broken in the CCA Sample code ( Iv blogged how to fix this ) I will just use the Customer Object path here.

The Key to keep in mind is that all things in UII start with an ICustomerSearch.   The baseline CCA Desktop’s search control is in WpfCustomerSearch.xaml.cs.

Note though that the CCA Desktop’s control is not setup to do this out of the box so you need to do a bit of code to get it to work.

To get started, in your adapter, create an instance of your customer object. In the CCA Sample, this is called CustomerRecord and lives in Microsoft.Crm.Accelerator.Cca.SampleServices.Entities. Populate your customer record however you choose to be able to run a search or start a session. Next use the GeneralFunctions.Serialize <type>( object) method from Microsoft.Uii.Common to serialize your customer data…

string serCustData = GeneralFunctions.Serialize<CustomerRecord>(custObj);

Now you have the base to start your session.

Next you will need an to add an Action to the Customer Search control in UII Settings ( in CRM )..
Again there are 2 ways to handle that.. for this we will just do an on the fly register of an action in CCA.

In the WpfCustomerSearch.xaml.cs class, Find the UII constructor:

Looks like this :
public WpfCustomerSearch(Guid appID, string appName, string initString)
: base(appID, appName, initString)

After the Init() method call… add
AddAction(1200, "dosearch", string.Empty);

That will register the action “dosearch” with UII when the control initializes.

Next, you need to add a DoAction Override.. Add this :

protected override void DoAction(RequestActionEventArgs args)
{
   if (args.Action.Equals("doaction", StringComparison.CurrentCultureIgnoreCase))
       DoSearch(args.Data);
   base.DoAction(args);
}

That will catch the dosearch action and route it to the DoSearch(string data ) method…

In the DoSearch ( string data ), if Data is not null, use the GeneralFunctions.Deserialize method to get your customer object back.. then modify the lookup behavior accordingly, at the end calling CustomerSearchResult.

That will get you your new session from your adapter.

MattB-MSFT

Nov 24, 2010 at 8:20 AM

Thank you Matt for your quick reply.

 

That saved my day!

 

Manuel

Jan 12, 2011 at 6:51 PM

Hi,

We are trying to do the same in that opening pop-ups in a new tab and implementing the web adapter as described my Matt above. Unfortunately for us this code is not working.....

RequestActionEventArgs args = new RequestActionEventArgs("Campaign Response", "nav", newURL);
AdapterFireRequestAction(args);
Desktop.SetFocusOnApplication("Campaign Response");

So we are able to navigate to the Application fine and a new tab does open in IAD but the window comes up as blank and not being redirected to the new URL. I guess this has something to do with the way the action "nav" is setup. Any gotchas that we should be aware of here?

Cheers,

Aman

Jan 14, 2011 at 2:11 PM

It depends on your adapter for the Campaign Response application.
In my case, there is an action hander on that adapter that catches the ‘nav’ command and does a Browser.Navigate(data)

MattB-MSFT

Dec 26, 2011 at 8:26 AM
Edited Dec 26, 2011 at 10:49 AM
MattB_MSFT wrote:

You can do this a few ways.
1) Use HAT and register for one of the NewWindow Events via the RegisterForEvent shape. You can find more information on that in the UII Development guide… search for WEB DDA EVENTS

2) Use a web application adapter and override the “OnNewWindow” event… in my sample event I am capturing only a few types of windows from CRM and allowing others to pop up on their own.

 

 

 

/// <summary>
/// Handel window popup. 
/// </summary>
/// <param name="newURL">Requested URL</param>
/// <param name="fromURL">Orginating page</param>
/// <param name="flags">Options</param>
/// <returns>True to Navigate, false to block it</returns>
public override bool OnNewWindow(string newURL, string fromURL, long flags)
{
    // Diag adapter and event to Log. 
    System.Diagnostics.Trace.WriteLine(string.Format("{0} >> NEW WINDOW RAISED >> {1}", this.Name, string.IsNullOrEmpty(newURL) ? "No URL" : newURL));
    if (!string.IsNullOrEmpty(newURL))
    {
        // Do I care about this window?
        if (newURL.Contains("sfa/accts") || newURL.Contains("cs/cases")
                || newURL.Contains("sfa/conts") || newURL.Contains("ma/campaignresponse")
            || newURL.Contains("sfa/salesorder")
            || newURL.Contains("userdefined/")
            )
        {
            // If its this type I need to do something diffrent. 
            if (newURL.Contains("ma/campaignresponse"))
            {
                // Load a Dynamic App 
                if (!Desktop.AppExistsInUI("Campaign Response"))
                    Desktop.CreateDynamicApplication("Campaign Response");

                if (Desktop.AppExistsInUI("Campaign Response"))
                {
                    // Fire an Action at it. 
                    RequestActionEventArgs args = new RequestActionEventArgs("Campaign Response", "nav", newURL);
                    AdapterFireRequestAction(args);
                    Desktop.SetFocusOnApplication("Campaign Response");
                    return false;
                }
            }

            // Navigate the current window to the newURL
            Browser.Navigate(newURL);
            return false;
        }
    }
    // Allow the window to pop normaly. 
    return base.OnNewWindow(newURL, fromURL, flags);
}
 MattB-msft. 
 

 

Hi All,

I am new to CCA for Microsoft Dynamics CRM. I've devloped new web application adapter as mentined in option 2 by MattB. But I am not able to understand the next steps I need to follow in order to achieve the goal. Can anyone please explain me the step by step procedure to open popup window in new tab.

Please reply ASAP.

Thanks in advance.

JayshriP

Dec 30, 2011 at 7:44 AM

Hi All,

Finally I was able to achieve my goal i.e. open popup pages from CRM in new tab.

Now I need all CRM popup to open in new tab. What is the best possible way to achieve this?

Thank you.

JayshriP

Jan 3, 2012 at 10:14 PM
JayshriP wrote:

Hi All,

Finally I was able to achieve my goal i.e. open popup pages from CRM in new tab.

Now I need all CRM popup to open in new tab. What is the best possible way to achieve this?

Thank you.

JayshriP

Are you trying to dynamically create tabs based on popups from CRM ? or are you trying to selectively route popups to a given tab in CCA?

MattB.

Jan 18, 2012 at 6:23 AM

Hi Matt,

I need to create tabs dynamically based on popups from CRM instead of creating Hosted Applications for selected popups in advance and then routing only those popups using adapter.

Thank you.

JayshriP

Mar 26, 2012 at 4:48 PM

Hi all,

I got it successfully.

Refer My Post..

http://akilanaki.blogspot.in/2012/03/part-1-open-popup-pages-in-new-tabs-in.html

Apr 18, 2012 at 3:44 PM

Hi All,

I whant to use Matt's code, how do I register new Web Adapter for CRM ?

Apr 27, 2012 at 9:46 AM

Hi AKILAN,

It is possible to use your solution without having a button to open the url in new tab. I my example I need to open customer form record automatcly when the AgnetDesktop user answer the call. I got the CRM Guid of the caller customer and now I need to open the form on new web application tab in CCA (CRM 2011).

Thanks for help.

Apr 27, 2012 at 9:55 AM

Hi Matt,

How can I do it in the event of the Answer call button. I need to open the customer form in a new tab in CCA when the AgentUser answer the call.

Apr 27, 2012 at 11:18 AM
Edited Apr 27, 2012 at 11:27 AM

Hi balhino,

To open customer record,you can create a web application and in url field give the following url.

 

To open contact record:

http://<servername>/<orgname>/SFA/conts/edit.aspx?id={CustomerID}

To open account record:

http://<servername>/<orgname>/SFA/accts/edit.aspx?id={CustomerID}

To create new associated case record

http://<servername>/<orgname>/CS/cases/edit.aspx?_CreateFromType=2&_CreateFromId={CustomerID}

To open associated cases view

http://<servername>/<orgname>/userdefined/areas.aspx?oId={CustomerID}&oType=2&pagemode=iframe&security=852023&tabSet=areaService

for creating a new web hosted application refer this link

http://alpha-helices.blogspot.in/2012/01/creating-my-first-web-hosted.html

for url addressable form and views in crm

http://msdn.microsoft.com/en-us/library/cc150850.aspx

Apr 27, 2012 at 11:25 AM

Hi AKILAN

How can I pass the {CustomerID} dynamically. In fact I want when the user agent click on Answer call button, the customer form will be opened in a new tab (webaplication).

So haw can I use your solution.

Apr 27, 2012 at 12:42 PM
Edited Apr 27, 2012 at 1:01 PM

Hi balhino,

refer UII development guide -> Using CTI framwork ->New Call Event and CtiLookupRequest

it may help to u..

or

get the cutomer record guid and set it as CustomerID(contextkey)  to context using setcontext and get it from context.

for more details about CTI

http://blogs.msdn.com/b/mbarbour/archive/2010/05/27/understanding-and-using-cti-in-uii-cca.aspx

Apr 27, 2012 at 1:06 PM

Hi AKILAN,

I follow you solution but in my case (opening automatically the customer form) I just create a workflow activity as the following:

<Activity mc:Ignorable="sap" x:Class="PopupActivities.Activity1" sap:VirtualizedContainerService.HintSize="335,514" mva:VisualBasic.Settings="Assembly references and imported namespaces for internal implementation" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:local="clr-namespace:PopupActivities" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:muha="clr-namespace:Microsoft.Uii.HostedApplicationToolkit.Activity;assembly=Microsoft.Uii.HostedApplicationToolkit.Activity" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:s4="clr-namespace:System;assembly=System.ServiceModel" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <Sequence sad:XamlDebuggerXmlReader.FileName="c:\users\administrateur\documents\visual studio 2010\Projects\PopupActivities\PopupActivities\Activity1.xaml" sap:VirtualizedContainerService.HintSize="295,474">
    <Sequence.Variables>
      <Variable x:TypeArguments="x:Boolean" Name="FoundOK" />
      <Variable x:TypeArguments="x:Object" Name="ActionData" />
      <Variable x:TypeArguments="x:Object" Name="UrlToNavigate" />
    </Sequence.Variables>
    <sap:WorkflowViewStateService.ViewState>
      <scg3:Dictionary x:TypeArguments="x:String, x:Object">
        <x:Boolean x:Key="IsExpanded">True</x:Boolean>
      </scg3:Dictionary>
    </sap:WorkflowViewStateService.ViewState>
    <muha:GetActionData ActionData="[ActionData]" sap:VirtualizedContainerService.HintSize="273,61" />
    <local:ParseActionData sap:VirtualizedContainerService.HintSize="273,22" NewUrl="[UrlToNavigate]" Text="[ActionData.ToString()]" />
    <muha:StartDynamicApp ApplicationName="WebApplication" sap:VirtualizedContainerService.HintSize="273,61" />
    <muha:Navigate AdditionalHeaders="{x:Null}" PostData="{x:Null}" TargetFrameName="{x:Null}" ApplicationName="WebApplication" sap:VirtualizedContainerService.HintSize="273,86" Url="[UrlToNavigate.ToString()]" />
  </Sequence>
</Activity>

And I deploy the DLL in Agent Desktop folder.I configured one hosted web application with a default action that point to the dll of the workflow.

About the CTI event , yes I know where is it , but my problem is:

1-      Am I correct what I have done?

2-      Haw the web application will be fired: Calling the workflow in answer event click of CTI control or it will be automatic.

Apr 27, 2012 at 1:37 PM

Hi balhino,

1.correct

2.may i know what happens now when u click answer button? .. after clicking answer button,check the context in Uii debugger whether it is set..?..frankly said, i dont know the exact solution..

Apr 27, 2012 at 1:57 PM

The CTI Subsystem is designed to work through a desktop manager and Search Control.  You will find one in the samples, and if you’re using the solution starters to build your own CTI adapter, you will see a project for it in the template the CTI Solution template builds.

When developing CTI enabled solutions, you first start with basic Search to work out your hosted application invoke’ s and contextual loading.  Once you have that, you add the CTI bits in to trigger Session create via the same search method you have been using up to that point.

Fundamentally, CTI supports/invokes the Search process in CCA.

CTI actions are not intended to directly invoke any hosted application. The sequence that should be followed is, and you will see this in the examples:

CTI Inbound call >

  1. CTI Root control accepts and decomposes the event and raises an New Call event to Call State manager.
  2. Call State Manager accepts the new call event and breaks down the event information into the UII CTI Objects, creating a UII Call Tracking object, then raised a New Call event to the desktop manager.
  3. Desktop manager Does any parsing on the event necessary, creates any desktop level tracking info necessary, Creates the CTI Lookup Request Payload , Seralizes it to a string and sends it as the data payload in an Action Call to * ( all apps) , using the message CtiLookupRequest.CTILOOKUPACTIONNAME.
  4. The Search control catch’s the CtiLookupRequest.CTILOOKUPACTIONNAME action request and processes that to the DoSearchFromCTIRequest method.
  5. Search control breaks down the CTI Lookup Request and runs the search process, invoking session create as necessary, and associating the UII CTI Call Object to the session.

In short: Get Session creation and Hosted Application bits working BEFORE you bring CTI into the picture.

Hope that clarify the process, Does this make sense?

Mattb-msft.

Apr 27, 2012 at 3:11 PM

Hi AKILAN,

do you know haw to fire the web application?

Apr 28, 2012 at 1:35 PM
Edited Apr 28, 2012 at 1:40 PM

Hi balhino,

1.create the workflow with startdynamicapp to launch the webapp and fire this workflow with  RegisterActionforevent or DoAction   to fire that workflow

or 

2.use customer search control  to fire non global app (webapp) by creating a new session.

or 

3.in button click event use the following code

   RequestActionEventArgs args = new RequestActionEventArgs(appName, actionName, incidentId);
   FireRequestAction(args);

 

try This.. 

Aug 1, 2012 at 6:59 AM

Hi AKILAN,

I followed your posts (Part 1 and Part 2) :

http://akilanaki.blogspot.in/2012/03/part-1-open-popup-pages-in-new-tabs-in.html?showComment=1343663398126#c3186100611383483526


When I am trying to navigate to case from contact , I get following error message in UII debugger :-

 

2012-08-01 10:59:44: AutomationAdapter (session=713a6dbf-b6be-45d2-b1e9-7e6589352fa4, app=WebPopup): Closed
2012-08-01 10:59:53: AutomationAdapter (session=713a6dbf-b6be-45d2-b1e9-7e6589352fa4, app=WebPopup): Initialized
2012-08-01 11:00:06: Application Host: APPLICATION_HOST_ERR_IN_DO_ACTION: An error has occurred while performing action on the hosted application WebPopup.: System.ArgumentException: Failed to navigate to the new URL of the Hosted Web Application: WebPopup
Parameter name: initialization string ---> System.ArgumentException: Value does not fall within the expected range.
   at Microsoft.Uii.Csr.Browser.Web.IWebBrowser2.Navigate(String URL, Object& Flags, Object& TargetFrameName, Object& PostData, Object& Headers)
   at Microsoft.Uii.Csr.Browser.Web.WebBrowserExtended.PerformNavigate(String urlString, Boolean newWindow, String targetFrameName, Byte[] postData, String headers)
   at Microsoft.Uii.Csr.Browser.Web.WebBrowserExtended.Navigate(String urlString)
   at Microsoft.Uii.Csr.HostedWebApplication.DoDefaultAction()
   --- End of inner exception stack trace ---
   at Microsoft.Uii.Csr.HostedWebApplication.DoDefaultAction()
   at Microsoft.Uii.Csr.ApplicationHost.ExecuteDefaultActions(IHostedApplication app)
2012-08-01 11:00:06: AutomationAdapter (session=713a6dbf-b6be-45d2-b1e9-7e6589352fa4, app=WebPopup): ContextChange():

Mar 14, 2013 at 10:55 AM
Edited Mar 14, 2013 at 10:56 AM
Hi Matt,

The workaround for popup blocker message, its working like a champ till today.

But, today, we have updated our CRM to UR 12. From there onwards, we are getting this error again. I have checked the Global.JS file now after UR 12 and found that the method is very much there, but the conditions in side the method are changing.

Can you please suggest? FYI, below is the code im using to block popup error.
private void Browser_DocumentComplete(object sender, Microsoft.Uii.Csr.Browser.Web.DocumentCompleteEventArgs e)
    {
        try
        {
            Microsoft.Uii.Csr.Browser.Web.IWebBrowser2 browserFrame = e.pDisp as Microsoft.Uii.Csr.Browser.Web.IWebBrowser2;

            if (browserFrame != null && browserFrame.Document != null )
            {
                ((mshtml.HTMLDocumentClass)browserFrame.Document).parentWindow.execScript("handlePopupBlockerError=function(url) {}", "javascript");
            }
        }
        catch
        {
        }
    }