Get "current" applicationname from workflow

Aug 31, 2012 at 3:22 PM

Hi all,

I have created a "generic" sign-in workflow which can be used by several dynamic web-applications. The WF sets values into the textboxes (username, password) and "press" the submit button. Username/password is fetched from my own SSO-service which I have created. Everything works fine - so I have no problems with the implementation this far.

The "problem" is that the HAT activities requires the name of the application (FindControl, SetControlValue etc.). This is somewhat annoying since this is the ONLY value that differs between the different actions (one sign-in-action for each app). 

My current solution to this is to either:

1) Create a application-specific workflow where I call the generic workflow. I pass the application name to the generic workflow as a parameter and use the value in a variable of the generic workflow,

2) Paste the Workflow XAML into the action configuration of the application and manually edit the parameter value of the generic workflow.

Instead of this - with the purpose to make the code more maintainable - I would like to implement a codeactivity where I can retreive the "current" application name. This activity would then be called first in my "generic" sign-in workflow and the return value of the activity will be used in the following activities...  

Problem is that I cannot figure out a nice way how to retreive the value (i.e. name of the application).

I was thinking of setting the value while initializing the adapter (the adapter.Name property is the value I want to pass) but I don't know the "correct" way to pass the value to the workflow application. I've seen examples of this in the CCA application (using the Workflow.Extensions.Add() method) but this is somewhat different since the action isn't initiated by a (UII) workflow. And I cannot find a way to get access to the workflow application object from the adapter.

Another workaround I was thinking of was to pass the application name to the RequestActionEventArgs.Data property (and then call AutomationAdapter.DoAction method). Retreival can then be done using GetActionData() activity from the workflow. But I really don't know if this is the correct way of doing it.

Suggestions? Comments?

Best regards,





Sep 12, 2012 at 3:01 PM

Hello again,

After some search using Reflector I found out that the AutomationAdapter inserts an extension of the type AutomationBridgeService.

Even if I'm not very fond of using reflection, I created a custom code activity that looks like the following:

public sealed class GetCallingApplication : CodeActivity
        // Return value
        public OutArgument<string> ApplicationName { get; set; }

        protected override void Execute(CodeActivityContext context)
            // Obtain the runtime value of the Text input argument
            AutomationBridgeService serv;

            serv = context.GetExtension<AutomationBridgeService>();

            AutomationAdapter adapter = null;

            PropertyInfo fi = typeof(AutomationBridgeService).GetProperty("AutomationAdapter", BindingFlags.NonPublic | BindingFlags.Instance);

            adapter = (AutomationAdapter)fi.GetValue(serv, null);

            string appName = adapter.Name;

            context.SetValue(this.ApplicationName, appName);

Calling this activity within my generic workflow gives me the application name.

I guess the adapter is declared as private in the AutomationBridgeService class by some reason... But I think it at least could expose some properties of the calling application and/or the action that initiated the workflow. Next version maybe? ;-)

Best regards,


Jun 19, 2013 at 3:27 PM
Edited Jun 19, 2013 at 3:30 PM

Can we use UII Automation to navigate to other page of the same web application.

For e.g :- I have a login page which will take the username and password from the CRM through automation and then the next page should read the details as required on the page form from the CRM using Automation.How the inspection of the another page can be done which will be available after login. As after login i want to compose mail which will take the subject and etc... from CRM.

Can you help me out on this.