CCA Hosted Controls and Focus

Scenario Link to heading

  • CCA R2 for Dynamics CRM 2011
  • A non global dynamic hosted control whose panel is the main panel
  • A workflow step that produce changes on that hosted control

Use case Link to heading

The user is in a session, start a workflow that activates the hosted application. The user choose other application from the main panel. The user start a workflow step that interacts with the hosted application and expects the application to get focus in the main panel.

The problem? Link to heading

CCA R2 seems to ignore the Focus Application on the action definition. Also ignores the GetFocus actions on the workflow, in the hosted control itself the the LocalDesktop object are null for non global dynamic applications and all the other available objects like session and parentwindow don’t have any success when it comes to give focus to the control.

My solution Link to heading

I ended up creating a new action on another application, this time a global, non dynamic control. This action calls

uiiDesktop.SetFocusOnApplication(args.Data);

And from my non global dynamic application I just call this action and that does the trick.