Monday, March 26, 2012

Open popup pages in new tabs in CCA R2 for CRM 2011


1. Open visual studio 2010 and click file -> new -> project -> workflow -> Activity Library
Change project name to “PopupActivities” and click “OK”
2. In solution explorer, Right click the project -> properties and change target framework to “.NET Framework 4.0 “ & Click yes if any popup opens.
3. In solution explorer, Right click the project->Add Reference. In .NET tab select System.Drawing and click OK.
4. In Activity1.xaml designer create the workflow activity as follows;Give your web application name instead of “WebApplication”



5. In solution explorer, Right click the project->Add-> new item ->workflow -> Code Activity and change the name to “ParseActionData.cs” click ok.
Copy the following code and paste it in “ParseActionData.cs”
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.Xml;
using System.Collections.Specialized;
using System.Web;

namespace PopupActivities
{

    public sealed class ParseActionData : CodeActivity
    {
        public InArgument<string> Text { get; set; }

        public OutArgument<Object> NewUrl { get; set; }
        protected override void Execute(CodeActivityContext context)
        {

            // Obtain the runtime value of the Text input argument
            string actionData = context.GetValue(this.Text);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(actionData);
            string url = doc.DocumentElement.GetAttribute("url");

            context.SetValue(this.NewUrl, (Object)url);
        }

    }
}


Right click the project and click rebuild; now you can see the ParseActionData code activity in toolbox of Activity1.xaml designer page.

6. Create the variables:


Add another wokflow activity and in that designer page(Activity.xaml),Create the activity as follows;


Click the ParseActionData and in the Properties explorer set the value for “NewUrl” and “Text” as flowing picture


Build the solution;Now copy the “PopupActivities.dll” from project output location to the AgentDesktop application folder

No comments:

Post a Comment