CRM CCA OPEN Dynamic HAT into TAB

Aug 24, 2012 at 9:47 PM
Edited Aug 24, 2012 at 9:50 PM

Hi , i need to open a dynamic application (web hosted application ) into agentdesktop tab panel. (crm 4.0)

I  try to configure this application in different ways :

global + dynamic + use set parent + can close

non global  + dynamic + use set parent + can close

global / non global + dynamic + use dynamic position

ecc....

i can see the application into AppHost with the correct panel associated

but never into AppUI and so i think , application never display the hat into a new tab.

I use a simply code to try to open this hat ( if I configure it as "host outside" works correctly )

var IHosted = localSessionManager.ActiveSession.AppHost.GetApplication("myapp");

uiiDesktop.CreateDynamicApplication("myapp");

//always false
if (uiiDesktop.AppExistsInUI("myapp"))
            {
                 uiiDesktop.SetFocusOnApplication("myapp");          
             }

Can you tell me the way ?


Is it a bug or only i made a mistake somewhere ?


thank you

Sep 3, 2012 at 1:07 PM
Edited Sep 3, 2012 at 1:16 PM

Hi,

after navigating a while into cca code i found this entry :

DynamicApplicationCreated

DynamicApplicationClosed

overridable from  Microsoft.Uii.Desktop.UI.Wpf.WpfDesktop

in these two entry i add the code :

        public override void DynamicApplicationCreated(string appName, IHostedApplication hostedApp)
        {
            if (hostedApp.CanEmbed)
            {
             

                string applicationInitializationXml = this.AppHost.GetApplicationInitializationXml(hostedApp.ApplicationID);
   

                if (!this.AppHost.IsIsolatedApplication(hostedApp))
                {
                    bool closeButton = false;
                    if (this.AppHost.IsDynamicApplication(hostedApp) && this.AppHost.CanCloseDynamicApplication(hostedApp))
                    {
                        closeButton = true;
                    }

                   
                    if (this.AppsUI.AddApplication(hostedApp.DisplayGroup, hostedApp, applicationInitializationXml, closeButton) == null)
                    {
                        Microsoft.Uii.Common.Logging.Logging.Error("DynamicApplicationCreated", hostedApp.ApplicationName);
                        return;
                    }
                }
            }
            IHostedApplication3 application = hostedApp as IHostedApplication3;
            if (application != null)
            {
                application.AgentID = this.AgentId;
            }

       

            base.DynamicApplicationCreated(appName, hostedApp);

            RefreshUI();
           
        }

and

 public override void DynamicApplicationClosed(IHostedApplication iHostedApplication)
        {
            Desktop.LoadDynamicApps();
            
     
            if (iHostedApplication.CanEmbed)
            {

                if (!this.AppHost.IsIsolatedApplication(iHostedApplication))
                {

                    if(!this.AppsUI.RemoveApplication(iHostedApplication))
                    {
                        Microsoft.Uii.Common.Logging.Logging.Error("DynamicApplicationRemoving failed", iHostedApplication.ApplicationName);
                        return;
                    }
                    Microsoft.Uii.Common.Logging.Logging.Info("DynamicApplicationRemoving Succeded", iHostedApplication.ApplicationName);
                }
            }

        }

In this way , i can configure a dynamic application on crm4.0 server right this:

Application is global : checked

Is dynamic : true

user can close : no

Display group : <group>

adapter : use automation adapter

application hosting mode : use set parent

In this way you can call the application when necessary into the panel

I think that cca has a bug ( it is not register an event probably )  , but if someone can do this in another way , please tell me.

 

Thank you all

A