module 2: interaction framework - collaborate.pega.com framework_0.pdf · interaction framework 1...

54
Pega Robotic Automation Essentials Version 8.0 Module 2: Interaction Framework Start

Upload: others

Post on 13-Apr-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Pega Robotic Automation Essentials

Version 8.0

Module 2: Interaction Framework

Start

Page 2: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Notice

© Copyright 2016Pegasystems Inc., Cambridge, MA

All rights reserved.

Trademarks

For Pegasystems Inc. trademarks and registered trademarks, all rights reserved. Other brand or product names are trademarks of their respective holders.For information about the third-party software that is delivered with the product, refer to the third-party license file on your installation media that is specific to your release.

Notices

This publication describes and/or represents products and services of Pegasystems Inc. It may contain trade secrets and proprietary information that are protected by various federal, state, and international laws, and distributed under licenses restricting their use, copying, modification, distribution, or transmittal in any form without prior written authorization of Pegasystems Inc.This publication is current as of the date of publication only. Changes to the publication may be made from time to time at the discretion of Pegasystems Inc. This publication remains the property of Pegasystems Inc. and must be returned to it upon request. This publication does not imply any commitment to offer or deliver the products or services described herein.This publication may include references to Pegasystems Inc. product features that have not been licensed by you or your company. If you have questions about whether a particular capability is included in your installation, please consult your Pegasystems Inc. services consultant.Although Pegasystems Inc. strives for accuracy in its publications, any publication may contain inaccuracies or typographical errors, as well as technical inaccuracies. Pegasystems Inc. may make improvements and/or changes to the publication at any time.Any references in this publication to non-Pegasystems websites are provided for convenience only and do not serve as an endorsement of these websites. The materials at these websites are not part of the material for Pegasystems products, and use of those websites is at your own risk.Information concerning non-Pegasystems products was obtained from the suppliers of those products, their publications, or other publicly available sources. Address questions about non-Pegasystems products to the suppliers of those products.This publication may contain examples used in daily business operations that include the names of people, companies, products, and other third-party publications. Such examples are fictitious and any similarity to the names or other data used by an actual business enterprise or individual is coincidental.This document is the property of:Pegasystems Inc.One Rogers StreetCambridge, MA 02142-1209USAPhone: (617) 374-9600Fax: (617) 374-9620www.pega.com

Updated: October 19, 2016

Page 3: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

iii

CONTENTS

1 Working with Interaction Framework

2 Overview

3 Working with the Interaction-Call.xml file

4 Working with the InteractionManager component

5 Project 1: Add the InteractionManager component

7 Project 2: New Automation to the CRM Project

10 Project 3: Adding a folder, activities, and an automation to the CRM project

15 Project 4: Getting customer account information in the CRM project

28 Project 5: New automation to the CRMAdapter project

39 Working with activities and active MDI windows

40 Project 1: Adding an automation to the CRMAdapter project

Page 4: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

iv

Page 5: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 1

Chapter 9: WORKING WITH INTERACTION FRAMEWORK

Interaction Framework is a systematic approach providing Pega Robotics Studio developers with a collection of tools that can be incorporated into the development of projects and solutions. You can launch concurrent customer interactions (or sessions) through the use of project-to-project references when implementing the framework. This simplifies development, improves reusability, and streamlines solutions for implementing new developer features.

The framework further provides you with increased visibility to reference a broad spectrum of customer information across multiple applications while performing unique activities and tasks across deployed Studio packages. When an end user loads one or more deployed packages, the framework allows for communicating information and events across the Runtime environment.

This chapter includes these topics:

• “Overview” on page 2• “Project 1: Add the InteractionManager component” on page 5

— “Group Exercise 1: Adding the InteractionManager component” on page 5• “Project 2: New Automation to the CRM Project” on page 7• “Project 3: Adding a folder, activities, and an automation to the CRM project” on page 10

— “Group Exercise 1: Working with activities” on page 10 — “Group Exercise 2: Adding the Interaction folder and StartActivityForKey component” on

page 11• “Project 4: Getting customer account information in the CRM project” on page 15

— “Group Exercise 1: Creating the Interaction Started Automation and setting the Account Combo Box automation within the Main-UI project” on page 15

— “Group Exercise 2: Working with Label > Jump To components” on page 20• “Project 5: New automation to the CRMAdapter project” on page 28

— “Group Exercise 1: Responding to the Activity Started event” on page 28

Building Blocks

When you finish this chapter, you will know how to:

• Locate the Interaction.xml file — Review the Interaction Manager component — Review activities

• Add the Interaction Manager component to a project• Review event links and properties• Create an automation: CRM_E_CRMChild_Created.os automation• Create a folder and set the StartActivityForKey property

Page 6: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Overview

Interaction Framework 2

OverviewOften with a new approach, the first thing to understand is its purpose and use. To start, let’s define the key building blocks used within the Interaction Framework. These include:

• Interaction• Interaction-Call.xml file• InteractionManager component• Activities

Context

Activities

Page 7: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 3

Working with Interaction Framework | Overview

Working with the Interaction-Call.xml fileThis configuration file defines the context values and activities used in the Interaction Framework.

This file is known as the binding contract that allows for communicating information and events across projects. You can place the Interaction-Call.xml file anywhere in the Solution folder;. For this class, however, you will place the file in the Main-UI folder.

For this exercise, a base Interaction.xml file is installed during the installation of Pega Robotics Studio. You will override the base file in training with the Interaction-Call.xml file that will be used throughout this training course. You will set and define the Interaction-Call.xml at the main project level of your TrainingCertification solution.

Group Exercise 1: Adding the Interaction-Call.xml File to the solution folder

First, you will add the Interaction-Call.xml file to the TrainingCertification solution folder. Adding the file to the solution folders will bring the process of building the Interaction Framework for the solution.

1. On your Desktop, locate the v8.0_Training_Files.zip file.

2. Right-click on the zip file, and select Open.

3. In the Explorer window, right-click on the Interaction-Call.xml file and select Copy.

4. In the Explorer window, browse to the following directory:

C:\Users\(userID)\Documents\Pega Robotics Studio\Projects\TrainingCertification\Main-UI

5. Right-click in the folder and select Paste. Your directory should look similar to this:

Note The base installed Interaction.xml is part of the normal install and can be located in the following directory:C:\Program Files\OpenSpan\OpenSpan Studio for Microsoft Visual Studio 2010\Application\AgileDesktop\Samples\Config

Note If you have not already done so, go to the Support site and download the v8.0_Training_Files.zip file in the Version 8.0 Training location and save it to your desktop.

Page 8: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Overview

Interaction Framework 4

Working with the InteractionManager componentThis component connects all customer interactions through the configuration of its properties, events, and methods. This component maintains a direct link to the contents of the interaction configuration file and stores the context values to share them across project and to complete interaction.

These context values appear as component properties. There can only be one Interaction Manager component per referenced project in a deployment package and its existence enables the connectivity of the framework’s activities.

Here is an example of an Interaction Manager component in automation logic:

Page 9: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 5

Working with Interaction Framework | Project 1: Add the InteractionManager component

Project 1: Add the InteractionManager componentThis component connects all customer interactions through the configuration of its properties, events and methods. This component maintains a direct link to the contexts of the Interaction-Call.xml and stores the context values defined for each interaction used throughout the Pega Robotics Studio Developer Certification

When you finish this project, you will know how to add the InteractionManager component to a project.

Group Exercise 1: Adding the InteractionManager component

In this part of the exercise you will add the additional components needed to complete the customer interactions used within the solution by identifying the CRM Global Interaction Manager and setting the appropriate properties to point to the contents of the Interaction.xml file.

From the Toolbox > Interaction Management section, add the following components to the _CRM_GC global container:

1. From Solution Explorer, open the global container in the CRMAdapter project called _CRM_GC.

2. Open the Toolbox window and click the General section.

3. Next, select InteractionManager and click and drag the component onto the _CRM_GC.os window.

4. In the Properties window, rename interactionManager1 to IntMgr in the Design (Name) field.

5. Next, define the Configuration File property for the IntMgr point to the Interaction-Call.xml file. With the IntMgr highlighted, in the Properties window click the Configuration File property and click the (…) ellipse button to display the Open File window.

6. Go to the Interaction-Call.xml file location and click Open.

Page 10: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 1: Add the InteractionManager component

Interaction Framework 6

7. Select File > Save All.

Page 11: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 7

Working with Interaction Framework | Project 2: New Automation to the CRM Project

Project 2: New Automation to the CRM ProjectNow that you have added the IntMgr component and set the configuration file property to point to the Interaction-Call.xml file that connects all customer interactions through the configuration of its properties, events, and methods, let’s create the CRM_E_CRMChild_Created automation to work with the Key property of the new call window (MDI child window) and start the interaction.

When you finish this project, you will know how to create the CRM_E_CRMChild_Created.os automation.

This automation starts a new interaction and sets the key value for our Training CRM MDI window. Once Studio has detected the creation of a new MDI window, its key value (Account Number) is set and a new interaction is started.

The CRM_E_CRMfrmLogin_Created automation automatically performed the Login and User 1 action when was matched, causing and immediate login to the Training CRM application.

Next, create the automation that responds to the CRMChild control event and sets the key value for the MDI window. The StartInteraction design block sets the same key value for the IntMgr interaction Key and will start the interaction.

The next automation in our exercise will be named: CRM_E_CRMChild_Created.os where:

Self-Paced Exercise 1: Creating the CRM_E_CRMChild_Created

Note Always set a key from a Create event for the control as it will create the context to set the correct key value.

Note Since there is only one Interaction.xml file per solution, once one interaction manager component is started in one project, all other projects in the solution can then start activities from that one interaction manager component.

This Indicates theCRM_E_CRMChild_Created Adapter within the automation.

CRM_E_CRMChild_Created Event within the automation.

CRM_E_CRMChild_Created Control Name within the automation.

CRM_E_CRMChild_Created Event being responded to in the automation.

Page 12: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 2: New Automation to the CRM Project

Interaction Framework 8

automation

Follow these steps to create the CRM_E_CRMChild_Created automation.

1. In Solution Explorer and within the CRMAdapter project, expand the Events folder, then right-click the Controls folder and select Add > New Automation.

2. The Automation template should be already highlighted. Type CRM_E_CRMChild_Created in the Name field and click Add.

3. Add these design blocks to the CRM_E_CRMChild_Created automation. Remember that if a property, event, or method does not exist for a control, you can create it by clicking the Configure Type icon.

4. Connect the design blocks as follows:

Source project item Component.Design block DescriptionCRM CRMChild.Created event This event triggers the execution logic. For

this solution, the automation logic is triggered any time a New Call window is created (opened).

CRM CRMlblAcctNum.WaitForCreate method

This method will wait for the Account Number field to create before assigning its value to the Key property of the CRMChild.

CRM CRMlblAcctNum.Text property The account number is sent to the Key property.

CRM CRMChild.Key property The Key property is assigned to the value from the account field.

_CRM_GC CRMIntMgr.StartInteraction (2 parameters).InteractionKey method

Click Activate and set the property to True.

Page 13: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 9

Working with Interaction Framework | Project 2: New Automation to the CRM Project

5. Select File > Save All.

Source component Connect to Target componentCRMChild.Created event output CRMlblAcctNum.WaitForCreate property

input

CRMlblAcctNum.WaitForCreate method True output

CRMlblAcctNumb.Properties input

CRMlblAcctNum.Properties property output

CRMChild.Key property input

CRMChild.Key property output CRMIntMgr.StartInteraction method input

CRMlblAcctNum.Text property CRMChild.Key property

CRMChild.Key property CRMintMgr.StartInteraction interactionKey parameterClick the activate parameter and select True. This defines the last MDI window opened as the current active interaction.

Page 14: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 3: Adding a folder, activities, and an automation to the CRM project

Interaction Framework 10

Project 3: Adding a folder, activities, and an automation to the CRM projectThis component represents the various work items across an organization as defined in the Activities section of the Interaction-Call.xml. An organization may have zero or more activities defined in this section, and every activity defined will be represented by its own activity component.

When a method starts an activity in one deployed package, it may fire an event within the same deployed package or in a different deployed package. Activities are queued and run in sequence within the Interaction Framework.

In this part of the exercise, you will add two activity components to the project.

• GetCustomerInformation is an activity that is started when the CRM Interaction is started and is used to populate the context values of the Interaction Manager with values collected from the CRM application MDI window.

• UpdateDisplay is an activity that is used to read the context values from the Interaction Manager and display those values for the end user to see.

To follow our recommended practice for solution hierarchy building, a new folder will be created to hold all CRM Adapter interaction automations.

When you finish this project, you will know how to:

• Create a folder for your Studio project• Respond to interaction events• Add activity components to your project

Group Exercise 1: Working with activities

First, let’s add the additional Toolbox components needed for our automation. Two new activities are needed for the automation. Follow these steps:

1. Double-click _CRM_GC.os, then open the Toolbox window.

2. From the toolbox General section, select Activity and click and drag the component to the _CRM_GC.os window. Repeat and add an additional activity.

3. Highlight activity1 in the _CRM_GC.os and rename it to CRMactGetCustInfo in the Properties window. Highlight activity2 and rename it to CRMactUpdateDisplay.

4. Highlight CRMactGetCustInfo in the _CRM_GC.os container and the Misc > Activity Name drop-down select GetCustomerInformation.

Note Now that the CRMactGetCustInfo and CRMactUpdateDisplay activities have been added to the _CRM_GC global container, the next step is to point the activity to the Activity section of the Interaction-Call.xml file that lists the activities that get the customer information in the automation.

Page 15: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 11

Working with Interaction Framework | Project 3: Adding a folder, activities, and an automation to the CRM project

5. Highlight CRMactUpdateDisplay in the _CRM_GC.os container and in the Misc > Activity Name drop-down, select UpdateDisplay.

6. Select File > Save All.

Group Exercise 2: Adding the Interaction folder and StartActivityForKey component

Next, in keeping with our recommended practices, add a new folder to the CRMAdapter project that will hold all interaction automations. You will create a new automation that will respond to the InteractionManager.InteractionStarted event and then start two activities for the interaction.

Note Available activity names listed in the drop-down list have been configured within the Interaction-Call.xml > Activity section. This list describes the available activities that can be worked.

Page 16: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 3: Adding a folder, activities, and an automation to the CRM project

Interaction Framework 12

1. In Solution Explorer and within the CRMAdapter project, highlight the Events folder, right-click and select New Folder. Rename the folder to Interactions.

2. Highlight the Interaction folder, right-click and select New > Automation. Enter CRM_E_IntMgr_InteractionStarted in the Name field and click Add.

3. Add these design blocks to the CRM_E_IntMgr_InterationsStarted automation.

Types of methods for the Start Activity are:

Source project item Component.Design block Description_CRM_GC IntMgr.InteractionStarted event

Click the down arrow in the design block to expose the sender > Key options.

_CRM_GC CRMactGetCustInfo.Start method

_CRM_GC CRMactUpdateDisplay.Start method

Activity method DescriptionCancelActivity Use this method to stop an activity if the activity is being held up for a

WaitForCreate method within an automation.

Start Use this method to queue the activity for the current interaction.Note: This method replaces the StartActivity method used in prior versions. With the StartActivity method, when an activity was started, the item was added to the queue and the automation moved forward. If work was required once the activity was completed, you responded to a ActivityCompleted event. When you use this method, the automation waits until the activity finishes. Once the activity finishes, then the automation moves forward.

StartActivity Use this method to start an activity for the active interaction and put it at the end of the queue. The activity will be processed when all activities queued in front of this one have completed.

StartActivityForKey This method works just like the Start or StartActivity methods but it lets you specify the key of the Interaction that the activity will be started for. If your project will be making use of multiple interactions, this is the safest method for starting an interaction.

Page 17: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 13

Working with Interaction Framework | Project 3: Adding a folder, activities, and an automation to the CRM project

4. Connect the design blocks as shown here:

When finished, the CRM_E_IntMgr_InteractionStarted.os automation should look as follows:

StartNow Use this method to add the activity to the top of the queue.Note: This method replaces the StartActivityNow method used in prior versions. With the StartActivityNow method, when an activity was started, the item was added to the queue and the automation moved forward. If work was required once the activity was completed, you responded to a ActivityCompleted event. When you use this method, the automation waits until the activity finishes. Once the activity finishes, then the automation moves forward.

StartActivityNow Use this method to move the activity to the top of the queue. If an activity is currently being worked, it will not stop that activity from being worked. Instead it will place this activity to be next in line to be work in the queue.

StartActivityNowForKey This method works just like the Start Now or StartActivityNow methods but it lets you specify the key of the Interaction that the activity will be started for. If your project will be making use of multiple interactions, this is the safest method for starting an interaction.

StartAndWait Use this method to place an activity at the bottom of the activity queue and then block the automation from proceeding until the activity has reached the top of the queue and has executed completely.

StartNowAndWait Use this method to place an activity at the top of the activity queue and then block the automation from proceeding until the activity has executed completely.

Source component Connect to Target componentIntMgr.InteractionStarted event output

CRMactGetCustInfo.StartActivityForKey method input

CRMactGetCustInfo.Start. method output

CRMactUpdateDisplay.StartActivityForKey method input

IntMgr.InteractionStarted.Key event output

CRMactGetCustInfo.StartActivityForKeyinteractionKey method input Passes the data from the key to the interactionKey

IntMgr.InteractionStarted.Key method output

CRMactUpdateDisplay.Start.interactionKey method input

Activity method Description

Page 18: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 3: Adding a folder, activities, and an automation to the CRM project

Interaction Framework 14

5. Select File > Save All.

Page 19: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 15

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Project 4: Getting customer account information in the CRM projectIn previous exercises, we determined that cloneable windows existed in the Training CRM application and you activated the use of keys for MDI windows. You also started interactions while setting the Key property and started activities for those interactions.

Next let’s create the logic to populate the Get Account combo box on the CustomerInformation form to hold the values of the account numbers each time a new call window is opened. To do this, you will be responding to the InteractionManager.InteractionStarted event within the Main-UI project.

Before you create the automation, let’s adhere to the recommended practice by creating:

• The Main-UI Global Container to hold global components, including our interaction and activities.• A new folder structure to group related items together that are used in the Main-UI project.• A new automation in the Interaction folder to contain the logic that populates the Get Account

combo box on the Customer Information form.

Group Exercise 1: Creating the Interaction Started Automation and setting the Account Combo Box automation within the Main-UI project

In this exercise, you will be...

• Creating the proper folders.• Adding the Interaction Manager component to the Main-UI project.• Loading the key of the newly-started interaction into the combo box that holds the keys for all

interactions that are currently managed by the Interaction Manager.

1. In Solution Explorer, right-click the Main-UI project and select Add > New Item.

The Add New Item – Main-UI dialog window appears.

2. Click the Global Container item, in the Name field enter _Main_GC and click Add.

3. Highlight the _Main_GC global container in Solution Explorer.

4. Open the Toolbox window and from the General section, select InteractionManager. Click and drag component onto the _Main_GC.os window.

5. In the Properties window, update the Design (Name) to IntMgr.

6. Confirm that the ConfigurationFile field is set to:

C:\Documents and Settings\Administrator\My Documents\Pega Robotics Studio\Projects\OpenSpan Developer Certification\Main-UI\Interaction-Call.xml

Note This is the second project that will be responding to this event. Both projects will process the InteractionStarted event at about the same time because the InteractionStarted event is broadcast to all projects that are a part of the loaded Interaction-Call.xml file.

Page 20: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Interaction Framework 16

7. In Solution Explorer, right-click the Main-UI project and select Add > New Folder. In the Properties window, rename the folder to Events.

8. In Solution Explorer and within the Main-UI > Events, right-click and select Add > New Folder. In the Properties window, rename the folder to Interactions.

9. Highlight the Interactions folder, right-click, and select Add > New Automation. In the Name field enter Main_E_IntMgr_InteractionStarted and click Add.

10. Next, add the design logic to populate the Get Account combo box on the Customer Information form window so the account number will help in selecting the proper interaction and is relative context data. Add these design blocks to the Main_E_IntMgt_InteractionStarted automation.

Note Complete Steps 8-11 as a self-paced exercise.

Source project item Component.Design block_Main_GC IntMgr.InteractionStarted event

Click the down arrow in the design block to expose the sender > Key options.

Page 21: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 17

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

11. Click and drag the Add method onto the Main_E_IntMgr_InteractionStarted automation.

12. Connect the design blocks as follows.

Customer Information CustomerInformation.MaincmbGetAcct.Items.Add methodTo add the MaincmbGetAcct.Items.Add method, follow these steps:1. Select the MaincmbGetAcct control in Object Explorer.2. Select Explore Component Properties in the upper right corner of Object Explorer.

3. Scroll down the list of components to Items and then highlight it.

4. Select the Methods icon in Object Inspector. If the Add method does not appear, click the Configure Type button, select the Add (1 parameter) method from the Object Collection Configuration dialog and click OK.

Source project item Component.Design block

Page 22: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Interaction Framework 18

Your automation should look as follows:

Testing your automation logic

Follow these steps to make sure the Interaction Started and the Customer Account Number is added to the combo box list on the Customer Information window:

1. Click the Start Debugging (F5) icon on the toolbar to build the solution.

2. Verify that New Call 1 window displays for John Smith.

3. Click User 2 to open a New Call 2 window for Alan Brock.

4. On the Customer Information window, click the Get Account drop-down arrow to display the account numbers for both John Smith (23453) and Alan Brock (23454).

Source component Connect to Target componentIntMgr.InteractionStarted event output

cmbGetAcct.Items.Add method input

IntMgr.InteractionStarted.Key event output

cmbGetAcct.Items.item method inputPasses the data from the key (Account Number) to the combo drop-down list.

Page 23: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 19

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

5. Select Stop Debugging (Shift+F5) from the toolbar.

6. Select File > Save All.

Page 24: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Interaction Framework 20

Group Exercise 2: Working with Label > Jump To components

Label - Jump To functionality lets you connect one part of an automation to another. For example, if you have a very large automation in which you need to connect a variable and method, instead of a long execution line or data path, you can connect them with a Label-Jump pair.

Before we connect the logic in the automation, let’s add a Label and Jump To functionality that will exit the automation if the designated Interaction Key does not exist. If the Interaction Exists (True) then the logic will continue in the Main_P_LoadCustInfoValue automation. If the Interaction Exists returns a False, the automation will exit.

New automation: Main_P_LoadCustInfoValue

In keeping with our recommended practices, use a private folder in a project to store project items that are needed within the current adapter project only. Automations and other files defined in this folder will only be available and viewable with the project for which the folder is created.

The Main_P_LoadCustInfoValues automation will accept a parameter and execute the string key that identifies what properties from the Interaction Manager will be populated on the Customer Information form.

1. In Solution Explorer, right-click the Main-UI project and select Add > New Folder. Rename the new folder to Private.

2. Right-click the Private folder and select Add > New Automation. In the Name field, enter Main_P_LoadCustInfoValues and click Add. Set the ShowDesignCompNames to True.

3. Next, let’s add the design block components for the automation logic.

Note This functionality can only be used within the same automation.

Source project item Component.Design blockExecute (entry point) Right-click in the Designer window and select Add Entry Point to add the

Execute entry point.Click the + sign to display the String param1.Select param1 and enter strKey in the field.

Page 25: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 21

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

_Main_GC IntMgr.Key.InteractionExists method• If InteractionExists is True, it will pass the strKey in the automation.• If InteractionExits is False, it will exit the automation.Click the + Result to expose the True > False.

Add Label Right-click on an open area inside the Main_P_LoadCustInfoValues automation. Then select Add Label.Rename the label to Exit.

Add Jump To > Exit Right-click a second time on an open area inside the automation. Choose the Jump To > Exit option.Repeat this step to add an additional Jump To > Exit.

Source project item Component.Design block

Page 26: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Interaction Framework 22

Add Exit Point Right-click a third time on an open area inside the automation, you can choose the Add Exit Point option.

Rename Exit1 to Exit.

Source project item Component.Design block

Page 27: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 23

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

_Main_GC IntMgr.Key propertyHighlight the IntMgr control in the Object HierarchySelect the follow properties in the Object Inspector window by pressing the Ctrl key while clicking each property with the mouse:• AcctNum• Address• City• Name• State• ZipcodeDrag the highlighted properties into the Designer window.

Customer Information MaintxtCurrentAcct.Text property

Customer Information MaintxtAddress.Text property

Customer Information MaintxtCity.Text property

Customer Information MaintxtName.Text property

Customer Information MaintxtState.Text property

Source project item Component.Design block

Page 28: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Interaction Framework 24

4. Connect the design blocks as shown here:

Customer Information MaintxtZip.Text property

Customer Information MaincmbGetAcct.SelectedItem property

Source component Connect to Target componentExecute output _Main_GC.IntMgr.InteractionExists input

Execute.String strKey output _Main_GC.IntMgr.key input

_Main_GC.IntMgr.InteractionExists. Resuts.True output

_Main_GC.IntMgr.Properties inputChange the None property to Key in the drop-down list.

Execute.String strkey output _Main_GC.IntMgr.Value input

_Main_GC.IntMgr.Results.False output Jump To > Exit input

_Main_GC.IntMgr.Properties output CustomerInformation.MaintxtCurrentAcct.Properties input

_Main_GC.IntMgr.Properties AcctNum output

CustomerInformation.MaintxtCurrentAccct.Text input

_Main_GC.IntMgr.Properties Address output

CustomerInformation.MaintxtAddress.Text input

_Main_GC.IntMgr.City output CustomerInformation.MaintxtCity.Text input

_Main_GC.MainInt.Name.Properties output

CustomerInformation.MaintxtName.Text input

_Main_GC.IntMgr.Properties State output

CustomerInformation.MaintxtState.Text input

_Main_GC.IntMgr.Properties Zip output

CustomerInformation.MaintxtZipCode.Text input

CustomerInformation.MaintxtCurrentAcct.Properties output

CustomerInformation.MaincmbGetAcct.Properties input

CustomerInformation.MaintxtCurrentAcct.Properties.Text output

CustomerInformation.MaincmbGetAcct.SelectedItem input

Source project item Component.Design block

Page 29: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 25

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

When finished, the Main_P_LoadCustInfoValues.os automation should look as follows:

Self-Paced Exercise 1: Responding to the Update Display Activity Started event

Follow these steps to create the Main_E_UpdateDisplay_ActivityStarted automation.

1. Add an activity to the global container in the Main-UI project. Double-click the _Main_GC.os container in Solution Explorer.

2. Next, select Toolbox > Interaction Management and drag and drop the activity onto the _Main_GC.os window.

3. Highlight activity1 in the _Main_GC.os window. In the Design (Name) field on the Properties window, enter MainActUpdateDisplay. From the Misc > Activity Name menu, select Update Display.

4. In the Main-UI project, right-click Events and select Add > New Folder. Rename the new folder to Activities.

5. Right-click the Activities folder and select Add > New Automation. In the Name field enter Main_E_UpdateDisplay_ActivityStarted and click Add.

6. Add these design block components for the automation logic:

CustomerInformation.MaincmbGetAcct.Properties output

Jump To > Exit input

Exit output Exit input

Source component Connect to Target component

Page 30: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

Interaction Framework 26

7. Connect the design blocks as follows:

Testing your automation logic

Follow these steps to make sure the Activity Started and Customer Information is populated on the Customer Information window:

1. Click the Start Debugging (F5) icon on the toolbar to build the solution.

2. Verify that New Call 1 window displays for John Smith.

3. On the Customer Information window, notice that only the default values are displayed on the Customer Information window.

Source project item Component.Design block_Main_GC MainActUpdateDisplay.ActivityStarted event

Click the down arrow in the design block to expose the sender > WorkItemId > InteractionKey options.

Main_P_LoadCust InfoValues

Main_P_LoadCustInfoValues.Execute method

Page 31: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 27

Working with Interaction Framework | Project 4: Getting customer account information in the CRM project

4. Select Stop Debugging (Shift+F5) from the toolbar.

5. Select File > Save All.

Page 32: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Interaction Framework 28

Project 5: New automation to the CRMAdapter projectTo resolve the issue of having the default values for the interaction displayed on the Customer Information window, create an automation to respond to the interaction and activity, starting with the CRMAdapter project. This automation will update the window with the customer values.

Group Exercise 1: Responding to the Activity Started event

Follow these steps:

1. In Solution Explorer and within the CRMAdapter project, right-click the Events folder and select Add > New Folder. Rename the new folder to Activities.

2. Right-click the Activities folder and select Add > New Automation. In the Name field enter CRM_E_GetCustomerInfo_ActivityStarted and click Add.

3. Next, let’s add the design block components for the automation logic.

Source project item Component.Design block_CRM_GC CRMactGetCustInfo.ActivityStarted event

Click the down arrow in the design block to expose the sender > WorkItemId > InteractionKey options.

CRM CRMlblAcctNum.Text property

CRMactGetCustInfo.ActivityStarted event output

CRMlblAcctNum.Text. Property inputChange Active to Key.

CRMactGetCustInfo.ActivityStarted InteractionKey output

CRMlblAcctNum.Value input

Page 33: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 29

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Toolbox > Expression BooleanExpressionHighlight the ?<?booleanExpression1 in the Properties window, enter a==b in the Expression field.

Highlight the Identifiers property in the Properties window and click the (…) ellipses button. Highlight a in the Member section and change the Expression > Data Type from Double to String in the list.Repeat for member b.Click OK to save the changes.

Source project item Component.Design block

Page 34: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Interaction Framework 30

Right-click the BooleanExpression result output data path and choose Make decision.

Toolbox > Advanced CRM_E_GetCustomInfo_ActivityStarted.messageDialog1Select (String message): DialogResult.Click the message and enter Key/Acct Number mismatch.

CRM CRMlblAcctNum.Text property

CRM CRMtxtName.Text property

CRM CRMtxtStreetAdd.Text property

CRM CRMtxtCity.Text property

CRM CRMtxtState.Text property

CRM CRMtxtZip.Text property

Source project item Component.Design block

Page 35: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 31

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

When finished, the CRM_E_GetCustomInfo_ActivityStarted.os automation should look as follows:

_CRM_GC IntMgr.Key propertyNote: Here is an additional way to add properties to an automation:Click and drag the IntMgr control to the automation. The Select InteractionManager Member window appears.Select the follow properties:• AcctNum• Address• City• Name• State• ZipcodeClick OK.

Tip: You can also highlight each method property in the Object Inspector and drag and drop onto the automation.

Source project item Component.Design block

Page 36: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Interaction Framework 32

4. Select File > Save All.

5. Finish connecting the remaining components in the CRM_E_GetCustomerInfo_ActivityStarted automation as follows:

Source component Connect to Target componentCRMactGetCustInfo.ActivityStarted InteractionKey output

a booleanExpression1 data input

CRMlblAcctNum.Properties output a booleanExpression1 execution input

CRMlblAcctNum.Text output b booleanExpression1 data input

Decision.False output messageDialog1.Show input

Page 37: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 33

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

6. Finish connecting the remaining components in the CRM_E_GetCustomerInfoStarted automation as follows:

Source component Connect to Target componentBoolean Decision Block True output CRMlblAcctNum.Properties input

CRMlblAcctNum.Text output IntMgr.Properties inputChange the None value to Key.

CRMlblAcctNum.Text output IntMgr.Key.Value input

CRMlblAcctNum.Text output IntMgr.AcctNum input

CRMtxtStreetAdd.Text output IntMgr.Address input

CRMtxtCity.Text output IntMgr.City input

CRMtxtName.Text output IntMgr.Name input

CRMtxtState.Text output IntMgr.State input

CRMtxtZip.Text output IntMgr.Zipcode input

Page 38: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Interaction Framework 34

7. Select File > Save All.

8. When finished, the CRM_E_GetCustInfo_ActivityStarted.os automation should look as follows:

Testing your automation logic

Follow these steps to make sure the Activity Started and Customer Information is now populated on the Customer Information window:

1. Click the Start Debugging (F5) icon on the toolbar to build the solution.

2. Verify that the New Call 1 window displays for John Smith.

Page 39: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 35

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

3. Select Stop Debugging (Shift+F5) from the toolbar.

4. Select File > Save All.

In the following self-paced exercises, you will create the logic to remove the Account Numbers from the Combo Box on the Customer Information window and remove the account number from the interaction.

Self-Paced Exercise 1: Stopping the interaction and removing the account number from the interaction

Now that you have populated the customer values and account numbers in the combo box on the Customer Information window, add the logic to clear the account numbers from the combo box when the Training CRM New Call (MDI child) window is closed from the Interaction Manager.

Since the Main UI project is handling the combo box that maintains the list of interactions, we will respond to the InteractionManager.InteractionClosed event in a separate exercise.

Follow these steps to create the CRM_E_CRMChild_Closing automation.

1. In Solution Explorer and within the CRMAdapter project, right-click the Controls folder and select Add > New Automation. In the Name field enter CRM_E_CRMChild_Closing and click Add.

Page 40: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Interaction Framework 36

2. Next, let’s add the design block components for the automation logic.

3. Connect the components as follows:

4. The CRM_E_CRMChild_Closing automation should look as follows:

Self-Paced Exercise 2: Removing account numbers from a combo

Source project item Component.Design blockCRM CRMChild.Closing event

CRM CRMlblAcctNum.Text property

_CRM_GC IntMgr.CloseInteraction method

Source component Connect to Target componentCRMChild.Closing event output CRMlblAcctNum.Text property input

CRMlblAcctNum.Text property output intMgr.CloseInteraction inputClick None and select Key.

CRMlblAcctNum.Text property output CRMintMgr.CloseInteraction key value input

Page 41: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 37

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

box automation

Now that you have closed the interaction in the CRM Interaction Manager, you will also need to respond to the InteractionClosed event in the Main-UI project to remove the interaction key from the combo box on the Main-UI form that shows all interaction keys.

Follow these steps to create the Main_E_IntMgr_InteractionClosed automation:

1. In Solution Explorer and within the Main-UI project, right-click the Interactions folder and select Add > New Automation. In the Name field, enter Main_E_IntMgr_InteractionClosed and click Add.

2. Next, let’s add the design block components for the automation logic.

3. Connect the components as follows:

4. The Main_E_MainIntMgr_InteractionClosed automation should look as follows:

5. Click the Save All icon on the main toolbar.

Source project item Component.Design block_Main_GC IntMgr.InteractionClosed event

Customer Information MaincmbGetAcct.Items.Remove method

For more information, refer to step 11 in “Group Exercise 1: Creating the Interaction Started Automation and setting the Account Combo Box automation within the Main-UI project” on page 15.

Source component Connect to Target componentMainIntMgr.InteractionClosed event output

MaincmbGetAcct.Items.Remove method input

MainIntMgr.InteractionClosed.Key output

MaincmbGetAcct.Items.Value input

Page 42: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with Interaction Framework | Project 5: New automation to the CRMAdapter project

Interaction Framework 38

Testing your automation logic

Follow these steps to remove the Get Account Items from the combo box:

1. Click the Start Debugging (F5) icon on the toolbar to build the solution.

2. Verify that the New Call 1 window displays for John Smith.

3. Click User 2 to open a New Call 2 window for Alan Brock.

4. On the Customer Information window, click the Get Account drop-down to display the account numbers for both John Smith (23453) and Alan Brock (23454).

5. Close the New Call 1 and New Call 2 windows for John Smith and Alan Brock.

6. Verify that the Get Account drop-down list is now empty.

7. Click Stop Debugging (Shift+F5) from the toolbar.

Page 43: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 39

Chapter 10: WORKING WITH ACTIVITIES AND ACTIVE MDI WINDOWS

In the previous exercises, you created automations to populate the combo box and data fields on the Customer Information form with the data from the CRM applications’ MDI windows. You handled opening new MDI windows and responded to their closing events.

Next let’s create the logic to respond to CRMChild activated events to change the active interaction, while ensuring that the Customer Information form is always showing the active interaction.

This chapter includes these topics:

• “Project 1: Adding an automation to the CRMAdapter project” on page 40 — “Group Exercise 1: Adding an activity to the Interaction-Call.xml file” on page 40 — “Group Exercise 2: Adding activities and automations to the CRM adapter project” on page 47

- “Self-Paced Exercise 1: Activating the interaction when CRMChild is activated” on page 41- “Self-Paced Exercise 2: Loading the customer information data onto the Customer

Information window” on page 42- “Self-Paced Exercise 3: Activating a window based on the key value” on page 45

Building Blocks

When you finish this chapter, you will know how to:

• Add activities to the Interaction-Call.XML file• Work with active MDI windows• Respond to an ActivityStarted event

Page 44: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Interaction Framework 40

Project 1: Adding an automation to the CRMAdapter projectIn previous exercises, you responded to the activity that will get the customer information copied into the Interaction Manager context values.

Group Exercise 1: Adding an activity to the Interaction-Call.xml file

In this exercise, you will add an activity to the Interaction-Call.xml file that will change the active interaction when a new or different MDI window is activated. This forces the active interaction to always coincide with the active MDI window.

1. Highlight _Main_GC.os in Solution Explorer.

2. Right-click the IntMgr icon in the _Main_GC window and select Modify Configuration.

The Interaction_Call.xml file opens in the Designer window.

3. Locate the Activities section in the Interaction-Call.xml file.

4. Next add the following new activity and value to the Activities section. You can place it after the last activity item in the Activities section:

Page 45: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 41

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

<Activity Name=”ActivateMDIWindow”><Value Name=”AcctNumber” Type=”String” /></Activity>

5. From the Build menu, select Build > Clean Solution. When finished, select Build > Rebuild Solution. This ensures that the new XML entry is available to use in the solution and removes the old XML stored in the memory cache.

6. Click File > Save All.

When finished, the Interaction-Call.xml should look as follows:

Now that you have added the new activity to the Interaction-Call.xml file. Next, let’s add a new activity to the _CRM_GC container to respond to the ActivateMDIWindow.

Self-Paced Exercise 1: Activating the interaction when CRMChild is activated

Follow these steps to create the CRM_E_CRMChild_Activated automation. This automation will verify that when a new CRMChild MDI window is selected (activated) by the user, the interaction key for the newly-activated MDI window is captured.

1. In Solution Explorer under the CRMAdapter project, right-click the Events > Controls folder and select Add > New Automation. In the Name field, enter CRM_E_CRMChild_Activated and click Add.

2. Add the design block components for the automation logic:

Source project item Component.Design blockCRM CRMChild.Activated event

Page 46: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Interaction Framework 42

Connect the design blocks as shown here:

Self-Paced Exercise 2: Loading the customer information data onto the Customer Information window

Now that a new interaction has been activated, the context values from the newly-activated interaction need to be displayed on the Customer Information form.

Follow these steps to create the Main_E_IntMgr_InteractionActivated automation:

1. In Solution Explorer under the Main-UI project, right-click the Events > Interaction folder and select Add > New Automation.

2. In the Name field, enter Main_E_IntMgr_InteractionActivated and click Add.

3. Add the design block components for the automation logic:

CRM CRMlblAcctNum.Text property

_CRM_GC IntMgr.ActivateInteraction method

Source project item Component.Design block

Page 47: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 43

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Connect the design blocks as shown here:

4. Select File >Save All.

Source project item Component.Design block_Main_GC IntMgr.InteractionActivated event

Click the down arrow in the design block to expose the sender > Key options.

Main_P_LoadCustInfo Values automation

Main_P_LoadCustInfoValues.Execute methodYou may need to save and close the Main_P_LoadCustInfoValues automation tab to access the automation's Execute method.

Page 48: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Interaction Framework 44

Testing your automation logic

Follow these steps to check the automation logic:

1. Click the Start Debugging (F5) icon on the toolbar to build the solution. The Customer Information and Training CRM application should load.

2. Verify that New Call 1 window displays for John Smith and verify that the customer information John Smith displays on the Customer Information window.

3. Click User 2 to open the New Call 2 window for Alan Brock and verify that the Customer Information window has updated with the customer information for Alan Brock.

4. Click User 3 to open the New Call 3 window for Pete Garner and verify that the Customer Information window has updated with the customer information for Pete Garner.

5. On the Training CRM application select New Call 1 window for John Smith to bring the MDI window into focus. Verify that the Customer Information window updates to reflect account number 23453 and the customer information for John Smith.

Page 49: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 45

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Self-Paced Exercise 3: Activating a window based on the key value

In our final solution, you will be able to change the active Interaction by:

• Selecting a MDI window in the CRM application• Changing the selection of the combo box in the Customer Information window

The combo box in the Customer Information window and the selected MDI window in the CRM application will always be in sync. Above, we handled changing the ActiveInteraction when the CRMChild.Activated event occurs. To finish handling this and not get in a loop of activity, the Main-UI project will send an activity to the CRM application that will activate the CRMChild window. This will trigger the CRMChild.Activated event, which results in the Activate Interaction call.

Follow these steps to create the Main_E_cmbGetAcct_SelectedIndexChanged automation.

1. Add an activity to the _Main_GC container. Double-click the _Main_GC.os container in Solution Explorer.

2. Next, select Toolbox > Interaction Management and drag and drop the Activity to the _Main_GC.os window.

3. Highlight activity1 in the _Main_GC.os window. In the Design (Name) field, on the Properties window enter MainactActivateMDIWin.

4. From the Misc > ActivityName drop-down, select ActivateMDIWindow.

5. In Solution Explorer under Main-UI > Events, right-click Events and select Add > New Folder. Rename the new folder to Controls.

6. Right-click the Controls folder and select Add > New Automation. In the Name field, enter Main_E_cmbGetAcct_SelectedIndexChanged and click Add.

7. Set the ShowDesignCompNames field to True.

8. Add the design block components for the automation logic.

Source project item Component.Design blockCustomerInformation MaincmbGetAcct.SelectedIndexChanged Events|Behavior

_Main_GC IntMgr.IsKeyActive methodClick the + Result to expose the True | False.

Page 50: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Interaction Framework 46

9. Select File > Save All.

10. Connect the design blocks as shown here:

When finished, the Main_E_GetAcct_SelectedIndexChanged.os automation should look as follows:

CustomerInformation MaincmbGetAcct.Properties text

_Main_GC MainactActivateMDIWin.Start method

Source component Connect to Target componentCustomerInformation.MaincmbGetAcct SelectedIndexChanged output

Main GC.IntMgr.IsKeyActive input

Customer Information.MaincmbGetAcctProperties.Text output

_Main_GC.IntMgr.IsKeyActive key input

Customer Information.MaincmbGetAcctProperties output

_Main_GC.MainActActivateMDIWinStart.Interactionkey input

Customer Information.MaincmbGetAcctProperties.Text output

_Main_GC.MainActActivateMDIWinStart.AcctNumber input

_Main_GC.IntMgr.IsKeyActive False output

_Main_GC.MainActActivateMDIWinStart input

Source project item Component.Design block

Page 51: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 47

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

11. Select File > Save All.

Group Exercise 2: Adding activities and automations to the CRM adapter project

Follow these steps:

1. Add an activity to the _CRM_GC container. Double-click the _CRM_GC.os container in Solution Explorer.

2. Next, select Toolbox > Interaction Management and drag and drop the activity onto the _CRM_GC.os window.

3. Highlight activity1 in the _CRM_GC.os window. On the Properties window in the Design (Name) field, enter CRMactActivateMDIWin. From the Misc > ActivityName drop-down, select ActivateMDIWindow.

4. In Solution Explorer under the CRMAdapter project, right-click the Activities folder and select Add > New Automation. In the Name field, enter CRM_E_ActivateMDIWin_ActivityStarted and click Add.

5. Next, let’s add the design block components for the automation logic.

Source project item Component.Design block_CRM_GC CRMactActivateMDIWin.ActivityStarted event

Click the down arrow in the design block to expose the sender > WorkItemId > InteractionKey options.

CRM CRMChild.IsKeyAssigned method

CRM CRMChild.Activate method (no parameters)

Page 52: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Interaction Framework 48

6. Select File > Save All.

7. Connect the design blocks as shown here:

When finished, the CRM_E_ActivateMDIWin_Started.os automation should look as follows:

Testing your automation logic

Follow these steps to test that the New Call MDI window opens and the customer information updates on the Customer Information window.

When the end user selects a new account number from the drop-down list on the Customer Information window, the CRM application activates the correct MDI window.

1. Click the Start Debugging (F5) icon on the toolbar to build the solution. The Customer Information and Training CRM application should load.

2. Verify that New Call 1 window displays for John Smith and verify that the customer information for John Smith displays on the Customer Information window.

Source component Connect to Target componentCRMactActivateMDIWin.ActivityStarted output CRMChild.IsKeyAssigned

input

CRMChild.IsKeyAssigned.True outputTypically, the False would have a diagnostic log for handling the logic execution flow. For training we will omit this logic.

CRMChild.Activate inputChange Active to Key.

CRMactActivateMDIWin.ActivityStarted.InteractionKey output

CRMChild.Key input

CRMActivateMDIWin.ActivityStarted.InteractionKey output

CRMChild.Activate.Key.Value input

Page 53: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Interaction Framework 49

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

3. Click User 2 to open the New Call 2 window for Alan Brock and verify that the Customer Information window has updated with the customer information for Alan Brock.

4. Click User 3 to open the New Call 3 window for Pete Garner and verify that the Customer Information window has updated with the customer information for Pete Garner.

5. On the Customer Information window, click the Get Account drop-down arrow to display the account numbers for John Smith (23453), Alan Brock (23454), and Pete Garner (23455).

6. Select any account number from the list. Notice the Training CRM window updates with the selected value change.

Page 54: Module 2: Interaction Framework - collaborate.pega.com Framework_0.pdf · Interaction Framework 1 Chapter 9: WORKING WITH INTERACTION FRAMEWORK Interaction Framework is a systematic

Working with activities and active MDI windows | Project 1: Adding an automation to the CRMAdapter project

Interaction Framework 50