Sei sulla pagina 1di 128

Pivotal Education

Services

530 Business Server


Customization
Fundamentals

Student Workbook
International
Version 2.0

The Pivotal name and logo and all related product and service names, design marks, and slogans are
the trademarks, service marks, or registered trademarks of CDC Software Corporation.
Microsoft is a registered trademark of Microsoft Corporation. All other company or product names
appear in this guide are for identification only and may or may not be trademarks or registered
trademarks of their respective holders.
Pivotal 360o eBusiness Relationship Management Software is licensed and subject to the conditions
and limitations of the Pivotal License.
The information herein is the property of Pivotal and any misuse or abuse will result in economic
loss. DO NOT COPY UNLESS YOU HAVE BEEN GIVEN SPECIFIC WRITTEN AUTHORIZATION
FROM PIVOTAL.
CONFIDENTIAL INFORMATION
This document is provided for limited and restricted purposes in accordance with a binding contract
with Pivotal. The information herein includes trade-secrets and should all be considered confidential.
DISCLAIMER
THE INFORMATION IN THIS DOCUMENT WILL BE SUBJECT TO PERIODIC CHANGE AND
UPDATING. PLEASE CONFIRM THAT YOU HAVE THE MOST CURRENT DOCUMENTATION.
THERE ARE NO WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, PROVIDED IN THIS
DOCUMENTATION, OTHER THAN THOSE EXPRESSLY AGREED UPON IN THE APPLICABLE
PIVOTAL CONTRACT. ERRORS AND OMISSIONS EXCEPTED.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 2 of 128
Copyright CDC Software Corporation

Contents
Module 1: Rich Client Review ...............................................................................................................................5
Module 2: Installation.............................................................................................................................................7
Exercise 2.1: Install and Test Rich Client ..........................................................................................................8
Exercise 2.2 Configure a Customization System..............................................................................................13
Module 3: Customization Process ........................................................................................................................19
Exercise 3-1: Optimizing the LCS....................................................................................................................20
Exercise 3-2: Shut down the MTS....................................................................................................................21
Module 4: Customizing the Presentation Layer ...................................................................................................22
Exercise 4-1: Customizing the Logo ................................................................................................................23
Exercise 4-2: Setting Security for the Rich Client............................................................................................24
Exercise 4-3: Global Quick Search ..................................................................................................................26
Exercise 4-4: Table eTab Menu Items..............................................................................................................27
Exercise 4-5: Parent eTab menu items .............................................................................................................29
Exercise 4-6: Editing Active Forms .................................................................................................................30
Exercise 4-7: Adding Secondary Segments to an Active Form........................................................................34
Exercise 4-8: Adding Automation to an Active Form......................................................................................36
Exercise 4-9: Create an Active Search and an Active Search Result ...............................................................37
Exercise 4-10: Refining the Search Result .......................................................................................................39
Exercise 4-11: Customizing the iTab ...............................................................................................................41
Exercise 4-12: Customizing the Home Page ....................................................................................................43
Module 5: Data Flow Client ..............................................................................................................................45
Module 6: Debugging Client Scripts ....................................................................................................................47
Exercise 6-1: Using Debug Tools.....................................................................................................................47
Module 7: Client Libraries ...................................................................................................................................48
Module 8: Developing Client Scripts ...................................................................................................................50
Exercise 8-1: Creating a Field Script................................................................................................................51
Exercise 8-2: Creating Form Script Functions .................................................................................................53
Exercise 8-3: Adding business logic to a Form Script .....................................................................................55
Exercise 8-4: Calling a Global Script Function................................................................................................56
Exercise 8-5: Add Transition Points from Client to Server - Part 1 .................................................................57
Exercise 8-6: Add Pre-Processing to a Transition Point ..................................................................................58
Module 9: Data Flow - Server ..............................................................................................................................59
Module 10: .net Assemblies and Interops ............................................................................................................61
Module 11: Developing AppServer Rules............................................................................................................63
Exercise 11-1: Create a new AppServer Rule ..................................................................................................64
Exercise 11-2: Update and Debug Transition Point .........................................................................................69
Challenge Exercise Module 11: Updating Active Form Behavour ..................................................................71
Module 12: Coding the Execute Transition Point ................................................................................................72
Exercise 12-1: Coding the Execute Transition Point.......................................................................................73
Module 13: Error Handling ..................................................................................................................................75
Module 14: Using the Language Dictionary ........................................................................................................77
14-1: Using the Language Dictionary ..............................................................................................................78
Challenge Exercise Module 14: Extending Language Translation Facilities ...................................................80
Module 15: Various Coding Exercises.................................................................................................................82
Exercise 15-1: Adding automation to a form ...................................................................................................83
Exercise 15-2: Cancelling Record Deletion .....................................................................................................86
Exercise 15-3: Cascading Record Deletion ......................................................................................................87
Exercise 15-4: Running a report from Code.....................................................................................................88
Exercise 15-5: Handling Other Platform Events ..............................................................................................90
Appendix: Script and Code Samples ....................................................................................................................92
Exercise 8-1 ......................................................................................................................................................93
Exercise 8-2 ......................................................................................................................................................94
Exercise 8-3 ......................................................................................................................................................96
Exercise 8-4 ......................................................................................................................................................99
Exercise 8-5 ....................................................................................................................................................101
Exercise 8-6 ....................................................................................................................................................102
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 3 of 128
Copyright CDC Software Corporation

Exercise 11-1 ..................................................................................................................................................104


Exercise 11-2 ..................................................................................................................................................108
Challenge Exercise Module 11.......................................................................................................................109
Exercise 12-1 ..................................................................................................................................................110
Exercise 14-1 ..................................................................................................................................................113
Challenge Exercise Module 14.......................................................................................................................117
Exercise 15-1 ..................................................................................................................................................119
Exercise 15-2 ..................................................................................................................................................122
Exercise 15-3 ..................................................................................................................................................124
Exercise 15-4 ..................................................................................................................................................126
Exercise 15-5 ..................................................................................................................................................128

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 4 of 128
Copyright CDC Software Corporation

Module 1: Rich Client Review

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 5 of 128
Copyright CDC Software Corporation

The are no exercises for module 1

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 6 of 128
Copyright CDC Software Corporation

Module 2: Installation

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 7 of 128
Copyright CDC Software Corporation

Exercise 2.1: Install and Test Rich Client


Objective
To install and test Rich Client.

Completed Steps
The local NT account PRAC (Pivotal Relationship Account) has been created for you so that that it can be used
to run the MTS service. Note that this account has been created with the following properties.
Username
Password
NT local group membership:
SQL Permissions

Local Security Policy:

PRAC
universe
Users, Administrators
Login created with access to
the ProductionBM and
ProductionED databases.
Grated Local Logon and Log
On As a Service rights

Tasks - Part 1 Configuration of Lifecycle Server


Specifying a User Account for Lifecycle Server
1. Access the Component Services via the menu path Start->Settings->Control Panel. Open
Administrative Tools and then select Component Services.
2. Within the Component Services Console, expand the path Component Services->Computers->My
Computer->COM+ Application, as shown below.

3. Right mouse click on the applet Lifecycle Engine AppServer, and select properties. Expose the
Identity Tab. Select the radio button This User and the login detail for the user PRAC. As shown
below.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 8 of 128
Copyright CDC Software Corporation

4. Click on OK
5. Close the Component Services console

Tasks - Part 2 - Installation of Rich Client


Stop Lifecycle Server
1. Tools and then select Component Services.
2. Within the Component Services Console, expand the path Component Services->Computers->My
Computer->COM+ Application, as shown below.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 9 of 128
Copyright CDC Software Corporation

3. Right mouse click on the applet Lifecycle Engine AppServer,

4. Select the option Shut down


5. Close the Component Services console

Installing Rich Client


1. Locate the Rich Client source files. This is located on C:\Source\Version 5.9\Rich
Client\Product.
2. Run the file Setup.exe
3. Ensure that you select the optional component downloaded component as shown below
4. Click Next
5. Select the radio button I accept the terms of the license agreement, click Next
6. Click Next
7. Ensure that you select Active Access Components Download, as shown below

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 10 of 128
Copyright CDC Software Corporation

8. Click Next
9. Click Install
10. When the installation is complete, click Finish.

Install Service Pack


1. Locate the Rich Client service pack. This is available on C:\Source\Version 5.9\Rich
Client\Fixes\SP1.
2. Run the file AA59SP01.exe
3. Click on Next
4. Wait for the Finished message to be displayed and click on Close.

Download Rich Client Components


1. It is useful to download and register all the necessary ActiveX dlls required by the Rich Client.
This is achieved by completing the following steps.
2. Start Internet Explorer and type in the URL
http://localhost/ePower/install.htm.
3. When prompted click on Continue.

Setting Permissions for Rich Client Users


Make sure you are logged in as s PRAC.
2. Start the Windows Client, login to the system Production and add PRAC to the Base CMS Features
1.

group.
3.

Close the Windows client

Connecting Using the Rich Client


1.

Start Internet Explorer and type in the


http://localhost/ePower/rdaui.htm?Production&http://localhost

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 11 of 128
Copyright CDC Software Corporation

2.

For ease of use place a shortcut to this URL on your windows desktop

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 12 of 128
Copyright CDC Software Corporation

Exercise 2.2 Configure a Customization


System
Objective
A Customization System is required in order to customize the Rich Client interface. In this
exercise you will configure the Customization System.

Tasks
Install Pivotal Toolkit
1.
2.
3.
4.
5.
6.
7.

Locate the Toolkit source files. This is located on C:\Source\Version 5.9\Toolkit\Product.


Run the file Setup.exe
Click Next
Select the radio button I accept the terms of the license agreement, click Next
Click Next
Click Next (you should have complete installation selected)
Click Install

Build and Configure The Toolkit


The steps below do not describe how to achieve the tasks in detail. You should be able to complete
these steps using the skills you learned in the 200 Customisation Fundamentals course.

Step
1. Ensure you are logged in as PRAC,

Tool Required
Windows Server 2003

2. Create a new SQL database for the Customization BM.


Pleases see Using SQL Server Management Studio below

SQL Server Management Studio

2. Ensure that the PRAC account has dbo rights on the


Customization BM. Please see Using SQL Server
Management Studio below

SQL Server Management Studio

3. Configure the Customization System for your Rich


Client by pairing the Customization BM with the
ProductionBM.

Pivotal System Manager

4. Create a File Path for the Customization System.

Windows Server 2003

5. Set the File Path for the Customization system

eRelationship Enterprise Manager

6. Restore the Customization BM from the folder.


C:\Program Files\Pivotal\Toolkit
Ensure you select the file

eRelationship Enterprise Manager

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 13 of 128
Copyright CDC Software Corporation

Hints and Tips


Using SQL Server Management Studio
This tool is similar to the SQL Enterprise Manager in SQL 2000. Outline steps are shown below

6. Start the application. The menu path to this application is Start->Programs->Microsoft SQL
Server 2005-> SQL Server Management Studio.
7. When prompted to confirm connection lick on the Connect button
8. To create a new database, right mouse click on the Databases folder and select new database.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 14 of 128
Copyright CDC Software Corporation

9. To check permissions for a specific user. Use the Object Explorer window open Security and
Login folders. Right-click on the relevant user and select properties.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 15 of 128
Copyright CDC Software Corporation

10. In the new dialogue you must select User Mapping and ensure that the user (PRAC) has dbo
access to the customisation (toolkit) module and also dbo access to ProductionBM

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 16 of 128
Copyright CDC Software Corporation

Setting the License Server


11. Using eRelationship Enterprise Manager you should access the system properties you will see
that the license server field is empty. You should type the License Server URL and port number
into this field (http://localhost:80)

2. Now, click on the Connect button, the properties dialogue will be updated as shown below

3. Ensure the license file Pivotal Customisation is selected and click on the Set License File button

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 17 of 128
Copyright CDC Software Corporation

Assigning Licenses
12. Using eRelationship Enterprise Manager you should connect to the systems so that you can see all
the users for that system. Right-mouse click on the PRAC user and select Assign License as
shown below.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 18 of 128
Copyright CDC Software Corporation

Module 3: Customization Process

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 19 of 128
Copyright CDC Software Corporation

Exercise 3-1: Optimizing the LCS


Objective
To optimize the starting of the LCS and to pre-set features that will be useful in later scripting
exercises.

Tasks
13. Start the LCS Customization Assistant.
14. On the Development Settings tab, within the Lifecycle Server Initialization Options dialog, check
Disable AppServer Rule Synchronization and Disable Full-Text Search.
15. Still on the tab, check the options for Automatic Client Script Reload and Enable Script
Debugging. This option will be useful in later exercises.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 20 of 128
Copyright CDC Software Corporation

Exercise 3-2: Shut down the MTS


Objective
To discover methods of shutting down the MTS in order for your customization changes to
appear in the Rich Client interface.

Tasks
Add a new item to the Rich Client eTab
1. Within the Customization System, open Security.
Note We will cover security in detail in an upcoming exercise.
2. Expand the Base CMS Features security group and select the Active Access connection.
3. On the Tables tab, make the Telemarketer table readable.
4. On the Business Object tab, make the Telemarketers object visible.
5. Save your security changes.

Shutting down MTS via Component Services


1. Start Component Services from the Administrative Tools folder off the Start Menu.
2. Expand the windows as follows:

Component Services
Computers
My Computer
COM + Applications

3. Right click on the Lifecycle Engine AppServer and select Shut down.
4. Re-start the Rich Client. Search the eTab for the Telemarketer item.

Reset Security
1. Re-set the security, removing the permissions you previously granted on the Telemarketer table
and Business Object.

Shutting down the MTS via VB program


1. From the code disk folder (C:\Code Disk), copy the files in the Module 3 directory onto your
computer.
2. Run the eRelDataLayerShutDown.exe.
3. Again, re-start the Rich Client. Determine if the Telemarketer option still appears on the eTab.

Create Shortcuts to eRelDataLayerShutDown.exe and Rich Client


Since you will be re-starting the MTS and the Rich Client quite regularly, you will create
shortcuts to these tasks in your Customization workspace.
1. Within the Customization System, hit the My Shortcuts button located on the top right of the
window.
2. Within the opened Shortcuts Bar, drag the Windows shortcuts for your Rich Client URL and the
eRelDataLayerShutDown.exe.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 21 of 128
Copyright CDC Software Corporation

Module 4: Customizing the


Presentation Layer

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 22 of 128
Copyright CDC Software Corporation

Exercise 4-1: Customizing the Logo


Objective
Replace the existing corporate logo with the Pivotal logo.

Tasks
Change the Corporate Logo
1. Start the Rich Client
2. On the Home Page, right-click the Company Logo and select Properties.
3. Look at the Address: (URL) to determine which scheme you are using.

In the folder ...\ePower\www\gfx\<your scheme>, rename the Company.gif to


CompanyOld.gif.
4. From the code disk folder (C:\Code Disk\Module 4), copy and rename the file Pivotal Logo.gif
to <relationship install path>\ePower\www\gfx\Company.gif
5. Within your browser, select Tools -> Internet Options.
6. Under the Temporary Internet files area, hit the Delete Files button.
7. On the Delete Files window, ensure that there is a check beside the Delete all offline content
option.
8. Click OK.
9. Click OK to close the Internet Options window.
10. Close and reopen your browser to view the results.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 23 of 128
Copyright CDC Software Corporation

Exercise 4-2: Setting Security for the Rich


Client
Objective
To create a new security group, establish the group permissions, and add users to the group.

Tasks
Create a New Security Group
1. In the Customization System, click the Security tab on the eTab.
2. Create a new group by right-clicking in the white space and selecting New Group. Name the
group "Rich Client Group".

Set Table Permissions


3. Expand the Rich Client Group folder and click Active Access.
4. Select 'Yes' when prompted to save.
5. For the following objects, Set All on the Tables tab.

Company
Contact
Employee
Reports
Saved_List_Items
Saved_Lists
Saved_Lookups

Set Business Object Permissions


1. For the following objects, select Visible on the Business Object tab.

Companies
Contacts
Employees
Queries
Reports
Static Lists

Set Permissions for Searches


1. For each of the tables identified below, make the specified Searches visible:
Table

Search Visible

Company

My Companies
Companies of Account Manager?

Contact

Contacts with Company ?

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 24 of 128
Copyright CDC Software Corporation

Contacts with Type ?


Contacts in City ?
Contacts with State ?
Employee

Active Employees

Set Permissions for Active Forms


2. For each of the database tables identified below, make the specified Active Form scriptable and/or
default
Table

Active Form

Active Forms - Scriptable

Active Forms - Default

Company

Company

Yes

Yes

Contact

Contact

Yes

No

Employee

Employee

Yes

Yes

Saved_Lis
t

Saved Lists

Yes

No

3. Save the security settings.

Set PRAC into new Security Group


1. Login to the AC Production system, using the Windows Client.
2. Via the Security object, remove PRAC from all security groups, then add PRAC to your new
group, Rich Client Group.
3. Save the settings.

Test Security Settings


1. Restart LCS and the Rich Client to see the effect of your security settings.
2. Notice the following:

What has happened to your Home Page main window? Why?


Which objects have an option of New on the eTab? What setting caused this?
Which objects do not work on the eTab? Why is that?
Are you able to open a Contact form? Why or why not?

3. Close the Rich Client.


4. Within the AC Production, re-add PRAC into the Base CMS Features group, and remove PRAC
from the Rich Client Group.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 25 of 128
Copyright CDC Software Corporation

Exercise 4-3: Global Quick Search


Objective
To make the Country field in the Company table Desktop findable.

Tasks
Make a field desktop findable
1. Within Rich Client, do a Global Quick Search for Canada. What are the results? [Answer - no
Companies, Contacts, Opportunities, Competitors, Groups, Order Capture, or News]
2. Within your Customization System, open the Company table and open the Country field.
3. In the table field form, click the option Desktop Findable.
4. Save the changes.
5. Re-start the MTS and Rich Client.
6. Test the functionality by doing a Global Quick Search for Canada. How many companies are
returned? [Answer: 5]

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 26 of 128
Copyright CDC Software Corporation

Exercise 4-4: Table eTab Menu Items


Objectives
To add an eTab menu item that enables users to access the Suggestion table, then customize to
enable/disable the various submenu items.

Tasks
Add a table eTab menu item
Within the Customization System, transport in the file Suggestion Table.rtr from the code disk
directory (C:\Course Files\Module 4). This .rtr contains the definition for the Suggestion table.
Do not forget to Apply Customization Changes.
1.
2.
3.
4.
5.
6.

Create a Business Object Suggestion that connects to the Suggestion table.


For the Base CMS Features security group, display the Active Access permissions.
Click the Tables tab and set Read, Create and Modify permissions for the Suggestion table.
Click the Business Objects tab and make the Suggestion Business Object Visible.
Apply your changes, and re-start the Rich Client.
Examine the eTab.

Is the Suggestion menu item displayed?


If not, why not
_________________________________________________
_________________________________________________
Create an Active Form
You need to create an active form so that you can enter data into the system. The simplest way
to do this is to automatically build a windows form first and save it as an active form.
1. In customisation system, select Forms->New Form, and fill in the form as shown below, an click
on OK

2. In the windows form editor, click the button Save As Active Form. When prompted for a form
name change the name to Suggestion.
3. If you wish, you can review the form in the active form editor. Select Active Forms->Active
Forms by Table. Open the suggestion branch and click on the form Suggestion.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 27 of 128
Copyright CDC Software Corporation

What submenu items are listed for the Suggestion menu item? Why is it that there are no records
for each submenu item?
Set Permissions for Active Form
1. In the customisation system access the Base CMS Feature security group
2. Open the Active Access Permissions
3. Make the active form scriptable and default as summarised below
Table

Active Form

Active Forms - Scriptable

Active Forms - Default

Suggestio
n

Suggestion

Yes

Yes

4. Save the changes and close the security editor


5. Apply your changes, and re-start the Rich Client.
6. Examine the eTab.
Is the Suggestion menu item displayed?

There are two ways you can make the Suggestions item appear higher up the menu, how do
you do this
Answer 1
_________________________________________________________
_________________________________________________________
Answer 2
_________________________________________________________
_________________________________________________________
Test the Form
1. Use this new active form to enter some suggestion records into the system

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 28 of 128
Copyright CDC Software Corporation

Exercise 4-5: Parent eTab menu items


Objective
To create a parent eTab menu item called Entertainment and a child URL submenu item called
Sports Results.

Tasks
Create a parent eTab menu item
1. Within the Customization System, click the Business Objects tab and choose New Business
Objects.
2. Create and save a Business Object using the following parameters:
Parameter

Value

Name

Entertainment

Ordinal

<Next Ordinal>

Icon

<Your Choice>

NOTE: Icon not used in Rich Client but is required as it is used in the Windows Client.
3. Save your changes.

Create a child eTab submenu item URL


1. Create a new Business Object that is a child of the previous Business Object using the following
parameters:
Paramete
r

Value

Name

Sports Results

Ordinal

<Next Ordinal>

Icon

<Your choice>

Parent

Entertainment

URL Tab

http://sports.yahoo.com/

Open Link
in
Separate
Window

<Checked>

2. Save your changes.


3. Within Security, open the Active Access connection for the Base CMS Features group.
4. Click the Business Objects tab, and then make the Entertainment Business Object visible. Notice
that Sports Results is also made visible by default.
5. Apply your changes and view the results.
6. What must be changed to have the Entertainment menu item display at the top of the eTab?

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 29 of 128
Copyright CDC Software Corporation

_________________________________________________________________________
_________________________________________________________________________

Exercise 4-6: Editing Active Forms


Objective
To learn how to edit an Active Form in order to improve the layout.

Tasks
Add new tabs to the form
The suggestion active form has already been created with a single anchored tab that holds a
single primary segment. We need to introduce additional tab that appear underneath the
contents of the anchored tab.
1. Select Active Forms->Active Forms by Table. Open the suggestion branch and click on the form
Suggestion.
2. Within the form editor right-click on the form element in the left hand navigation pane and select
the option. New.->Tab

3. Browse to the new tab in the left hand navigation pane right-click on the tab [New Tab] select
properties. Update the properties as shown below.

4. Click on OK
5. Repeat steps 1-4 for another tab ; Name; Review, Title: Review
These tabs now sit underneath the segment in the anchored tab.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 30 of 128
Copyright CDC Software Corporation

Tab Details: Add primary segment and move fields


1. Right-click on the tab [Details] item in the left-pane and choose New->Primary Segment. A
Primary segment group item is added to the tab.
2. Select the segment properties and update as follows
Name: Details
Title: Details,
Column Count: 1
Hide Title; Checked
3. In the left-pane expand the segment [Suggestion] and drag the fields Type and Description into
the primary segment [Details].

Tab Review : Add primary segments and move fields


1. Right-click on the tab [Review] item in the left-pane and choose New->Primary Segment. A
Primary segment group item is added to the tab
2. Select the segment properties and update as follows
Name: Review
Title: Review
Column Count: 1
Hide Title; Checked
3. In the left-pane expand the segment Suggestion and drag the fields Assigned_To, Severity and
Reviewed_By into the primary segment [Review]
4. Repeat steps 1-3 but this time add a primary segment Review_Comments (Title:
Review_Comments) Column Count 1, and move the field Comments

The left pane should look like the sample shown below.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 31 of 128
Copyright CDC Software Corporation

Make fields Required


1.
2.
3.
4.

Right-click on the field Date field and choose properties.


Set the Required property.
Click OK to save your changes.
Repeat steps 1-3 for the field Subject

Improve Layout
1. Browse to the anchored tab; add new segments to this tab, with the following properties and move
fields from the segment suggestions into these new segments as shown below.

Segment

Properties

Fields

Suggested_by_Contact

Name: Suggested_by_Contact
Suggested_By_Contact
Title: Suggested_by_Contact
Column Count: 3
Hide Title; Checked
Employee_Details
Name: Employee_Details
Employee_Id
Title: Employee_Details
Department
Column Count: 2
Hide Title; Checked
Contact_Details
Name: Contact_Details
Contact_Id
Title: Contact_Details
Company_Id
Column Count: 2
Hide Title; Checked
2. In the left-pane, browse to the primary segment suggestion, right click and separator.
A new separator is added to the segment move this up the segment until it is immediately below
the field Date.
3. Repeat step 2 until the left pane looks like the sample shown below

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 32 of 128
Copyright CDC Software Corporation

4. Right-mouse click on the field Subject and change the properties as follows
Col Span: 3
Width (EM): 40

Enable and View Changes for the Active Access system


1. Apply your changes and re-start the Rich Client to view the results.
2. Click the eTab.
3. Click the Suggestion menu item and choose New My Suggestion Form.

You should see your new Suggestion Active form in the SmartPortal main window.
4. Add a few Suggestions.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 33 of 128
Copyright CDC Software Corporation

Exercise 4-7: Adding Secondary Segments to


an Active Form
Objective
To create a Secondary segment in the Suggestion Active form that links to the Rn_Appointements
table.

Tasks
Add the foreign key fied Suggestion_Id to the Rn_Appintments table.
1. In the toolkit edit the table Rn_Appointments
2. Add a new field Suggestion_Id. Ensure this field uses the Reference Id 40+5 and is a foreign key
to the Suggestion_Id primary key in the Suggestion table.
3. What other steps should you complete before you test your customisations?

______________________________________________
______________________________________________
Add a Secondary Segment
1. Within the Customization System, open the Suggestion active form for modification.
2. Right-click the Active Form [Suggestion] item in the left-pane, and choose New -> Tab. A new
Tab is added with the Suggestion [Primary] segment on the Tab.
3. Right-click on the new tan, select Properties and set the name and title Activates
4. Right-click the Activities tab in the left-pane, and choose New ->Secondary Segment.
5. Right-click the New Segment [Secondary] item and choose Properties. Change the Name and
Title to Activities, Click the Link Field and select the Rn_Appointments[Suggestion_Id] field.
6. Click OK to save your changes.
7. Notice what is entered in the Activities[Secondary] segment. Without looking ahead to the next
set of steps, how do you think we can add fields to this segment?

______________________________________________
______________________________________________
Adding Secondary Fields
1. Right-click the Contacts [Secondary] segment and choose New Field->Rn_Appintement_Id.
2. Change the Title of the Rn_Appintement_Id field to Activity.
3. View the Activities [Secondary] properties and ensure the segment can be collapsed and that
users are prohibited from being able to delete any records.
4. Click OK to save your changes to the secondary segment.
5. Save and close the form.
6. Enable and View Changes
7. Apply your changes and re-start the Active Access to view the results.
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 34 of 128
Copyright CDC Software Corporation

8. Are you able to add Contacts to the Suggestions? Why or why not?

______________________________________________

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 35 of 128
Copyright CDC Software Corporation

Exercise 4-8: Adding Automation to an Active


Form
Objective
To create a form button and link to an existing client script to demonstrate the capability of
adding automation to the Suggestion form.

Tasks
Transport in a Script
1. Using the Pivotal Transporter, transport into the Customization System the Suggestion Script.rtr
file.

Add a Button
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.

Edit the Suggestion form.


Expand the items in the left-pane until the Suggestion [Primary] segment is visible.
Right-click the Suggestion [Primary] segment and choose New Button.
Right-click the New Button [Button] item and choose Properties.
Change the Name and Title to Message Box.
Right-click the Message Box [Button] item and choose New Event Hook 4->OnClick.
Open the properties for the Event Hook and specify the following properties:
- Event Name: OnClick
- Client Script: Suggestion_OnClick_Button
Click OK to save your changes to the OnClick event.
Save and close the form.
Enable and View Changes
Apply your changes and re-start the Rich Client to view the results.

What happens when you click the button?


______________________________________________

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 36 of 128
Copyright CDC Software Corporation

Exercise 4-9: Create an Active Search and an


Active Search Result
Objective
To create an Active Search and Search Result that returns for Suggestions.

Tasks
Create a Target Query
1. Within the Customization System, create a Target query that returns all Suggestions with a
severity of Medium.
2. Save the Target Query as Medium Suggestions.
3. Close the Query window.

Create a Search
1. Click the Active Searches Business Object and choose New Search.
2. Fill in the parameters using the following table:

Parameter
Name

Value
Medium Suggestions

Title

Medium Suggestions (defaults)

Table

Suggestion

Query

Medium Suggestions

3. Click Save to save your changes and close the Search form.

Create a Search Result


1. Click the Active Search Results Lists Business Object and choose New Search Results.
2. Use the following parameters to fill in the form:

Parameter
Name

Value
Suggestion Results

Tables

Suggestion

Fields on Associated Fields


tab

Suggestion_Id
Severity
Type
Contact_Id
Date_
Assigned
Note For all the associated fields, mark as Default, Visible, and Unsorted.
3. Re-open the Date_ field and set its Sort Order to Descending and its Sort Priority to 1.
4. Click Save to save your changes and close the form.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 37 of 128
Copyright CDC Software Corporation

Make the Search Visible


1.
2.
3.
4.
1.

Within Security, open the Active Access connection for the Base CMS Features group.
On the Search Results List tab, set the Suggestion Results Search Display to Default.
Click the Searches tab.
Make the Medium Suggestions search visible.
Save your security changes.

Enable and View Changes


1. Apply your changes and re-start the Rich Client to view the results.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 38 of 128
Copyright CDC Software Corporation

Exercise 4-10: Refining the Search Result


Objective
To add refinements to the Suggestion Search Result list, via a query and a field refinement.

Tasks
Create a Parameter-less Query
2. Create a new Target Query based on the Suggestion table that returns all Suggestions of type
Request.
3. Save the Query as Request Suggestions and close the Query Definition window.

Refine the Search Results


1.
2.
3.
4.
5.

Open the Suggestion Results Search Result.


Click the Refinement tab.
Click the plus icon to add a new refinement.
Set the Label to Requests, and the Query to the Request Suggestions query.
Save the refinement.

Add further Refinement Capabilities


1. Click the plus icon to add another refinement.
2. Enter the following values to the indicated fields:

Field

Value

Label

Questions

Query

<leave blank>

Field

Type

Operator

Refinement Question
Value
Click Save to save the changes to the Search Result and close the form.
Enable and View Changes
1. Apply your changes and re-start the Rich Client to view the results.
2. Why are the refinements available for all Suggestion searches?

_____________________________________________
_____________________________________________
_____________________________________________
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 39 of 128
Copyright CDC Software Corporation

3. What happens when you choose the Request Suggestions search and click Questions? Why?

_____________________________________________
_____________________________________________
_____________________________________________

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 40 of 128
Copyright CDC Software Corporation

Exercise 4-11: Customizing the iTab


Objective
To create an In-Context Tab URL, and Plug-in.

Tasks
Create an In-Context Tab URL
Create an In-Context Tab URL that displays a Yahoo map for the current company.
Note: This will only work for companies in the US
1. In a new In-Context Tab URL form, specify the parameters using the following table:

Parameter Value
Table

Company

Label

Create an expression in the Label field that looks like this

Content
URL

Define the Link URL so that the search can be used by any record in the
Company table. Your expression should look like the one below

Internal
Name

City_Map

Active
Forms

Company

2. Save your changes.


3. Apply your changes and re-start the Active Access to view the results.

Verify your iTab customization


1. Click the eTab in your browser then proceed to select a company.
2. Once the company form opens, click the iTab.

Note The iTab menu item will have a label Map of and then the city name (e.g. Map of New
York). The menu item that you created is not labelled Local Map.
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 41 of 128
Copyright CDC Software Corporation

3. Click the iTab item.


4. If you are not connected to the Internet, the page cannot be displayed. However, look at the URL
that was constructed.

Create an In-Context Tab Plug-in


Create an In-Context Plug-in so that the entertainment events for the current city can be
displayed by the eRelationship users.
1. Create a new In-Context Tab Plug-in.
2. Fill in the form details:

Parameter

Value

Type

Singular

Table

Company

Label

Entertainment in <City>

Plug-in

TicketMaster

Internal Name

Entertainment in the City

Active Forms

Company

Click the Parameters tab, and then click the button. Enter the following parameters.
Input Name

Input Value

City

[City]

Country

[Country]

State

[State_]

3. Save the In-Context Tab Plug-in.


4. Apply your changes and re-start the Rich Client to view the results.

Note As this plug-in is for American cities, check the location of the company that you
select for testing.
Verify your iTab customization
1. Display a Company record form. Click the iTab.
2. Click on your Entertainment in <CityName> menu item to verify that your plug-in is successful.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 42 of 128
Copyright CDC Software Corporation

Exercise 4-12: Customizing the Home Page


Objectives
Add the following content items to your Rich Client system:

SmartPortal Category

SmartPortal Content Query

Tasks
SmartPortal Category
1. Right-click the SmartPortal Categories object and choose New 4 SmartPortal Category.
2. Specify the category name as Suggestion.
3. Save the category

Create a non-aggregating Suggestion query


1. Create a new target query for Suggestions that returns all Suggestions without any aggregation.
2. Save the query as All Suggestions.

SmartPortal Content Query


1. Create a new SmartPortal Content Query.
2. Complete the SmartPortal Content Items and Properties field groups using the following
parameters:

Field

Value

Name

Types of Suggestions

Description

Graph different types of suggestions.

Language String

<leave default>

Item Type

<leave default>

Category

Suggestion

SmartPortal Title

Types of Suggestions

3. In the Query tab and Items sub-tab, choose the Suggestion table and specify the All Suggestions
query.
4. Click the Graph tab.

Create a Graph
1. You need to create a Graph before you can select it. Keep the New SmartPortal Content item
open and right-click the Graph Business Object then choose New Graph.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 43 of 128
Copyright CDC Software Corporation

2. Fill in the parameters using the following table:

Fields

Value

Name

Types of Suggestions

Type

Bar

Table

Suggestion

Title

Types of Suggestions

Language String

<leave default>

X-axis: Axis Field

Type

X-axis: Aggregation

None

X-axis: Axis Label

Type

X-axis: Language String

<leave default>

Y-axis: Axis Field

Suggestion_Id

Y-axis: Aggregation

Count

Y-axis: Axis Label

Number of Suggestions

Y-axis: Language String

<leave default>

3. Click Save to save the graph and close the form.


4. Return to the SmartPortal Content Item.
5. The Table field should already be defined as Suggestion. Set the Graph field to the graph created
in the previous task, Types of Suggestions
6. Click Save to save the Content Query and close the form.
7. Make the SmartPortal Content Query item Visible via security.
8. Apply your changes and re-start the Rich Client.
9. Click Personalize.
10. Choose Suggestion and Types of Suggestion channel and use the add icon to add the channel to
your home page. Move the content item to an appropriate column.
11. Click Save to save the changes and return to the home page.

A graph of all your Suggestions grouped by Type appears in your home page.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 44 of 128
Copyright CDC Software Corporation

Module 5: Data Flow Client

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 45 of 128
Copyright CDC Software Corporation

No exercises are defined for Module 5

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 46 of 128
Copyright CDC Software Corporation

Module 6: Debugging Client


Scripts
Exercise 6-1: Using Debug Tools
Objectives
Upon completion of this exercise, you will be able to:
use the &debug, DbgAlert and DbgTrace tools

Tasks
Add DbgAlert and DbgTrace statements
1. Open the Client Form Script for Company (Company_Form).
2. In the LoadFormData function, prior to the DoLoadFormData call, add a DbgAlert step that
indicates that the form is about to be opened.
3. After the form is opened, add a DbgTrace step that indicates that the form is loaded.
4. Here is an example of how your code should look:

.......
DbgAlert About to open form
vntRecordsets=rfrmForm.DoLoadFormData(vntRecordId,vntParameters)
DbgTrace Form is loaded

......
5. Add the &debug flag to your Rich Client shortcut
6. Right-click on your Rich Client shortcut and add &debug after the system name.

Enable and test your customization


Perform the standard steps to enable your customization changes.
1. Open a Company record and note the message box.
2. Once the record is open, located the pvtltrace.txt file.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 47 of 128
Copyright CDC Software Corporation

Module 7: Client Libraries

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 48 of 128
Copyright CDC Software Corporation

No exercises are defined for Module 7

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 49 of 128
Copyright CDC Software Corporation

Module 8: Developing Client


Scripts

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 50 of 128
Copyright CDC Software Corporation

Exercise 8-1: Creating a Field Script


Objective
To create a field script that fires after updating the field From_Contact

Tasks
Add new segments to the Suggestion From
In this exercise we are going to change the visibility of certain fields. The easiest way to manage this is to
move the relevant fields into their own segments, using the Active Form editor

1. Open the Active Form Suggestion


2. Right click on the anchored tab and select New ->Primary Segment.
3. Select the segment properties and update as follows
Name: Employee_Details
Title: Employee_Details
Column Count: 3
Hide Title; Checked
4. In the left-pane expand the segment Suggestion and drag the fields Employee and Department into
the primary segment Employee_Details
5. Repeat steps 1-3 but this time add a primary segment Contact_Details (Title: Employee_Details
Review_Comments) Column Count 1, and move the fields Contact and Company

The left pane should look like the sample shown below.

Create a new Client Script


1.
2.
3.
4.

Click the Client Script object and select New.


Name the script Suggestion_OnClickFromConact.
Set the language to VBScript.
In the script body, write a script that does the following:

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 51 of 128
Copyright CDC Software Corporation

Locate the primary recordset of the form


Use the value of the field From_Contact to decide to how to show/hide the company and contact
details
Also use this value to show/hide the employee/department details
Note: Your appendix contains a sample of a script that will accomplish the desired results - use this script as a
reference.

Attach the script to the Field Event Hook


1. Open the Active Form Suggestion
2. Right click on the field Suggested_By Contact and select New ->Event Hook ->OnAfterUpdate.
3. Within the left pane listing the fields and segments, expand the field Suggested_By Contact to
reveal the OnAfterUpdate event hook.
Note the field label is Suggested By Contact, but the field name From_Contact
4. Right click the event hook and select Properties.
5. From the drop list, select the Suggestion_OnClickFromConact client script.
6. Apply your changes.
7. Test your customization.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 52 of 128
Copyright CDC Software Corporation

Exercise 8-2: Creating Form Script Functions


Objective
To consolidate your functionality into a form script where it can be called from more than one
place.

Tasks
To create a form script for the suggestuion from
1. Create a new Client Script, filling the parameters as follows:
Parameter
Name
Language

Value
Suggestion_Form
VBScript

2. In the script add the following:

Provide a new subroutine DisplaySuggByDetails that shows/hides to show/hide the segments


Employee_Details and Contact_Details. To do this you can copy the code from the script you
implemented in Exercise 8-1.
Provide another subroutine to handle the platform event OnFormLoaded. Call the subroutine
DisplaySuggByDetails to do the necessary showing/hiding of fields

Note: The appendix contains a sample of a script that will accomplish the desired results - use
this script as a reference.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 53 of 128
Copyright CDC Software Corporation

Connect Client Script to Form


1. Open the suggestions Active form, and attach the new form script Suggestion_Form by updating
the forms properties. As shown below

2.

Save the changes to the active form.

Update event hook script to call form script function


1. Edit the client script Suggestion_OnClickFromContact
2. Update the code to call the form script function Form.DisplaySuggByDetails
Note: Your appendix contains a sample of a script that will accomplish the desired results - use this script
as a reference.

3. Save the client script


4. Apply your changes.
5. Test your customization.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 54 of 128
Copyright CDC Software Corporation

Exercise 8-3: Adding business logic to a Form


Script
Objective
To add behaviour to the form that improves accuracy and integrity of the data.

Tasks
In this exercise, you will update the Suggestion form script to extend the behaviour of the script to
handle the OnFormLoaded event.
Update the form script
1. Edit the form script Suggestion Form
2. Add a new subroutine SetRequired. Use the fields values as summarised below to dynamically
change the attributes of the field in the form

Field: Assigned
Vales
Action
True
Field Assigned_To is Required
Field Severity is Required
False
Field Assigned_To is not Required
Field Severity is not Required
Field: Reviewed
Vales
Action
True
Field Reviewed_By is Required
False
Field Reviewed_By is not Required

3. In the subroutine to handle the platform event OnFormLoaded. Add a call the subroutine
SetRequired to set the necessary field attributes

Note: The appendix contains a sample of a script that will accomplish the desired results - use
this as a reference.
Add new event hook scripts
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.

Create a new client script with the name Suggestion_OnClickAssigned


Update this script to call the sub routine Form.SetRequired.
Open the Active Form Suggestion
Right click on the field Assigned and select New ->Event Hook ->OnAfterUpdate.
Within the left pane listing the fields and segments, expand the field From_Contact
(Suggested_By_Contact) to reveal the OnAfterUpdate event hook.
Right click the event hook and select Properties.
From the drop down list, select the Suggestion_OnClickAssigned client script.
Repeat steps 1-7 for the script Suggestion_OnClickedReviewed and the field Reviewed
Apply your changes.
Test your customization.

Note: The appendix contains sample scripts that will accomplish the desired results - use this as a
reference.
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 55 of 128
Copyright CDC Software Corporation

Exercise 8-4: Calling a Global Script Function


Objective
To call the Global.CMSMsgBox function from your client script.

Tasks
Add call to Global.CMSMsgBox
1.
2.

Edit your event hook script Suggestion_OnClickFromContact .


Update the script so that it tests the values of the relevant fields as shown below.
Vales
Action
True
Check Value of field Employee_Id
Vales
Action
Null
Continue
Not Null Warn user that Employee_Id will be cleared, wit for
response.
- If OK clear field
- Otherwise reset From_Contact and exit

False

Check Value of field Contact_Id


Vales
Action
Null
Continue
Not
Warn user that Contact_Id and Company_Id will be c
Null
cleared, wit for response.
- If OK clear fields
- Otherwise reset From_Contact and exit

3. Apply your changes.


4. Test your customization.

Note: The appendix contains sample scripts that will accomplish the desired results - use this as a
reference.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 56 of 128
Copyright CDC Software Corporation

Exercise 8-5: Add Transition Points from Client


to Server - Part 1
Objective
In this exercise, you will update the Suggestion form script to handle some of the Transition
Points to call the AppServer Rule for the Suggestion form. In a following exercise, you will build
the AppServer Rule that will respond to the Client calls.

Tasks
Edit the client script Suggestion_Form
1. Implement the following transition points

NewFormData

DeleteForm Data

NewSecondaryData
2. Apply your changes.
3. Test your customization
Note: The appendix contains scripts templates that will show you how to code these transition points.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 57 of 128
Copyright CDC Software Corporation

Exercise 8-6: Add Pre-Processing to a


Transition Point
Objective
In this exercise, you will modify the Suggestion form script for the NewFormData transition point.
In a following exercise, you will build the AppServer Rule that will process this transition pint in
the Business Server.

Tasks
Update client Script
1. Edit the client script Suggestion_Form
2. Add the following functionality to the transition point NewFormData

Using the global method CMSDialigRadio, prompt the user what classification of
suggestion they want to create.

Using the global transition point parameter handling script set up the default value for the
field Classification

Call the AppServer,


3. Apply your changes.
4. Test your customization

Note: The appendix contains scripts templates that will show you how to code these transition
points.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 58 of 128
Copyright CDC Software Corporation

Module 9: Data Flow - Server

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 59 of 128
Copyright CDC Software Corporation

No exercises are defined for Module 9.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 60 of 128
Copyright CDC Software Corporation

Module 10: .net Assemblies and


Interops

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 61 of 128
Copyright CDC Software Corporation

No exercises are defined for module 10

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 62 of 128
Copyright CDC Software Corporation

Module 11: Developing


AppServer Rules

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 63 of 128
Copyright CDC Software Corporation

Exercise 11-1: Create a new AppServer Rule


Objective
This exercise will create a new C# class that implements all the methods (transition points) of
the IRFORMSCRIPT interface.

Tasks
Create a new ASR as a C# class library
1. Start the Visual Studio 2005, menu path Start->Programs->Microsoft Visual Studio 2005->
Microsoft Visual Studio 2005
2. In Visual Studio, create a new project menu path File->New. Ensure you have selected a C# class
library as shown below.

Specify the name: Suggestion

Specify the location as: C:\Program Files\Pivotal\CMS\CMS 5.9\AppServer Rules .NET


Starter Kit\Sample Application Source Code\Pivotal.Application.Cms.EF
The checkbox Create directory for solution should be ticked

3. In the Solution Explorer window, right click on class1.cs and select Delete

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 64 of 128
Copyright CDC Software Corporation

4. In the Solution Explorer window, right click on References and select Add. Click on the browse
tab and browse to the folder C:\Program Files\Pivotal\ePower. Using the control key select the
libraries shown below.

5. Click on OK, you have now added the Interop Libraries


6. Add reference again and browse to the folder C:\Program Files\Pivotal\CMS\CMS 5.9\AppServer
Rules .NET Starter Kit\Sample Application Source Code\Assemblies. Using the control key select
the libraries shown below.

7. Click on OK; you have now added the Foundation Libraries

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 65 of 128
Copyright CDC Software Corporation

8. In Solution Explorer Window right click on the project Suggestion and select Add, from the
dialogue ensure s Class is selected and fill in t he class name Suggestion

9. You can now edit the class library itself ; in the window Suggestion.cs, update the class so that it
looks like the example shown below

10. In the window Suggestion.cs right click on the class name


and select the option
Implement Interface->Implement Interface. This will add all the transition points for the ASR.
11. Using the sample Company ASR (C:\Program Files\Pivotal\CMS\CMS 5.9\AppServer Rules
.NET Starter Kit\Sample Application Source Code\Pivotal.Application.Cms.EF\Company\
Pivotal.Application.Cms.EF.Company.csproj ) as a guide, you should update the ASR to call the
default AppServer services behaviour.

Note A sample template is provided in the appendix to show you how the resulting code should
look

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 66 of 128
Copyright CDC Software Corporation

Compile the ASR


1. From Windows browse to C:\Program Files\Pivotal\ePower\Production. Create a sub-folder in
this folder call Assemblies.
2. In Microsoft Visual Studio 2005, access the project properties, menu path Project->Suggestion
Properties.
3. From the left navigation pane select Build. Specify the output path to the sub-folder you have just
created as shown below

4. You should now build the ASR; in the Microsoft Visual Studio 2005, click on Build->Build
Suggestion.
5. Once you have successfully compiled this code, save the project, menu path: File->Save All

Create a new AppServer Rule reference in the Customization System


1. In the customisation system, create a new AppServer Rules (Menu Path: Appserver Rule
References->New Appserver Rule), filling in the forms as follows:

Link ASR to form


1. In the toolkit, use the active form editor to associate your new AppServer rules to the suggestion
form. You so this by viewing the forms properties and selecting the ASR created above.

Verify your ASR in the LCS Customization Assistant


1. Start the LCS Customization Assistant.
2. Click on the Systems tab and ensure Production is selected form the dropdown field. Click in on
the button System Info

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 67 of 128
Copyright CDC Software Corporation

3. Find the entry for the ASR Suggestions. You should see and entry similar to the one below.

Test your Code


1. Restart the MTS in order for your DLL to be loaded when accessing the suggestion form
2. Test your customization by viewing, editing and creating suggestion records.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 68 of 128
Copyright CDC Software Corporation

Exercise 11-2: Update and Debug Transition


Point
Objective
This exercise will add some pre-processing code to the transition point NewFormData.

Tasks
Import Foundation Library ASRs
The .net foundation libraries have their own set of generic Appserver rules that perform various
functions. It is necessary to install these ASRs so that they can be instantiated from the code
that we will write.
1. Open the toolkit
2. Load elements from a transporter file. Menu path Transporter->Import Elements from File.
Browse to the file C:\Program Files\Pivotal\CMS\CMS 5.9\AppServer Rules .NET Starter
Kit\RTR and CSV\CMS r5.9 .NET Foundation Libraries.rtr and click Open
3. Click Continue
4. Click Close

Update a Transition Point


5. In Microsoft Visual Studio 2005 edit the Suggestion Appserver rule
6. Locate the transition point NewFormData.
7. Add post-processing that extracts the uses default values defined in the parameters loist to
initalise the data set for the form. To do this you will need these elements

A Recordset variable to hold the form data

A TransitionPointParameter object so that you manipulate the transit point parameter


array. This will also provide the method (SetDefaultFields) to initialise the form date

Note: If you want to see all the methods for the TransitionPointParameter class you can see these
in the Object Browser (Menu Path: View->Object Browser). Browse to the library
Pivotal.Application.Foundation.Utility and click on the class TransitionPointParameter
Note: The appendix contains a sample of the changes to the transition point that will accomplish
the desired results - use this as a reference.
Setup Debugging
1. In Microsoft Visual Studio 2005, view the properties for the class suggestion, menu path Project>Suggestion Properties
2. Select the build properties and ensure the output path for Debug and Release configurations is as
shown below is set to

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 69 of 128
Copyright CDC Software Corporation

3. Leave the properties tab in Microsoft Visual Studio 2005 open and use the component services
Applet (in eth control panel) to identify the Application ID for the LCS component is on the
general tab as shown below.

4. Copy this Id
5. Return to Microsoft Visual Studio 2005
6. Click on the Debug section and, and click on the radio button Start external program. Choose the
path C:\WINDOWS\system32\dllhost.exe
7. Update the command line parameter to specify the application id you have copied in step 4, ie
/ProcessID:<your copied text>. The properties page for debug section should be similar to one
below.

8. Save these settings

Debug Appserver Rule


1. Set a breakpoint for the transition point NewFormData
2. Stop LCS
3. Press the Run
button
4. Start your application and attempt to create a new suggestion, your code should now pause in the
debugging too

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 70 of 128
Copyright CDC Software Corporation

Challenge Exercise Module 11: Updating Active


Form Behavour
Objective
You should now use the skills you have leant to update the form to behave more consistently with new
functionality that has been added

Tasks
Update Form
1. Edit the active form to make the field Classification read-only

Update Form Script


1. Update the subroutine OnFormLoaded to set the field Object_ to required if the classification is
CMS System

Update User Choices


1. Add some entries to the user choice list 'Object Choices'

Note: The appendix contains a sample of the changes to the transition point that will accomplish
the desired results - use this as a reference.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 71 of 128
Copyright CDC Software Corporation

Module 12: Coding the Execute


Transition Point

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 72 of 128
Copyright CDC Software Corporation

Exercise 12-1: Coding the Execute Transition


Point
Objective
This exercise with add business logic to automatically set the severity of the suggestion depending on the type
of contact.

Tasks
Add New Event hook Script
1.
2.
3.
4.

Click the Client Script object and select New.


Name the script Suggestion_OnAfterUpdateCont.
Set the language to VBScript.
In the script body, write a script that does the following:

Using the primary recordset of the form identify if the Contact_Id fieldis defined.
If it is defined call the Execute transition pount and specify the method name GetSeverity
After the execute transition point has returned extract the first use defined parameter and assign
this to the field Severity
Note: Your appendix contains a sample of a script that will accomplish the desired results - use this script as a
reference.

Add Event Hook to the form


1. Open the Active Form Suggestion
2. Right click on the field i and select New ->Event Hook ->OnAfterUpdate.
3. Within the left pane listing the fields and segments, expand the field Contact[Id] to reveal the
OnAfterUpdate event hook.
4. Right click the event hook and select Properties.
5. From the drop down list, select the Suggestion_OnAfterUpdateCont client script

Implement Execute Method


1.
2.
3.
4.
5.
6.
7.

In Microsoft Visual Studio 2005 edit the Suggestion Appserver rule


Locate the method for the transition point Execute, this should be empty.
Add the try/catch construct so that you are handling exceptions correctly
Declare and create an instance of a transition point parameter handling object
Using the switch language construct, use the parameter MethodName for the switch.
Add a case statement for the method name GetSeverity.
In this case you should

Check the existence of at least 1 parameters (transition point parameter method


CheckUserDefinedParameterNumber)

Access the first user defined parameter (the contact record id) in the transition point
parameter array.

Use this value to locate the type of the contact

If the contact is of type Customer or Partner set the returned value to 2 (Severity = High)

Using the contact record id again find the record id of the contacts company

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 73 of 128
Copyright CDC Software Corporation

Declare and create a Pivotal dataset object

Run a query to find all the active opportunities for a specific this company

If there are opportunities retuned, set the returned value to 1 (Severity = Medium)

Otherwise, set the returned value to 0 (Severity =Low)

Pass back the returned value as user defined parameter 1in the transition point parameter
array.

Note: If you want to see all the methods for the TransitionPointParameter class, you can see these
in the Object Browser (Menu Path: View->Object Browser). Browse to the library
Pivotal.Application.Foundation.Utility and click on the class TransitionPointParameter
Note: The appendix contains a sample of the changes to the transition point that will accomplish
the desired results - use this as a reference.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 74 of 128
Copyright CDC Software Corporation

Module 13: Error Handling

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 75 of 128
Copyright CDC Software Corporation

No exercises are defined for module 13

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 76 of 128
Copyright CDC Software Corporation

Module 14: Using the Language


Dictionary

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 77 of 128
Copyright CDC Software Corporation

14-1: Using the Language Dictionary


Objective
This exercise will allow you to add translations into the language dictionary and utilize these from both .net
Appserver rules and client scripts

Tasks
Create a new Language.
Note - If you are intending to complete the challeng exercise for this module you will save time by starting the
Populate task of the Language agent see the first task of the challenge exercise for details

1. In the Toolkit create a new LD Language, for Spanish. Fill in the fields as shown below

2. Click on OK to save the record

Create new Language Group


We will use one group for all language strings related to Suggestions.
1. In the Toolkit, create a new LD Group called Suggestions.
2. In the language group form, click the + to add a new language string SeveritySetTo, as shown
below

3. By clicking the + on the language string form, add the following translations.
Note: your will be prompted to save the language string first
Language

Text

English (United States)

The severity has been set to %1 for this suggestion.

Spanish

La severidad se ha fijado al '%1' para esta sugerencia.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 78 of 128
Copyright CDC Software Corporation

Update AppServer rule - Add and initialise objects


1. Declare and then initialise a language dictionary object m_suggestionLangDict . To correctly
initialise this and translate strings, you will need privately declared constants to identify the
language group and string names.

Update AppServer rule - Add private method


In the code you have already implemented the returned severity is set up in several places. You will
also need to set the informational string in several please. To make this easier you should implement a
private method that builds a translated information string.
2. Declare a new method severityMessage, similar to the one shown below
private string severityMessage(int Severity)
{
}

3. Add code to the above that retrieves the choices for the field Severity.
4. Use this return value in the GetTextSub method of the language dictionary object to get the
translated text for Suggestion Severity string.

Update AppServer rule Call private method


1. In you ASR locate the transition point Execute
2. Update the code for the case GetSeverty to update the information string (via property
transitionPointParameter.InfoMessage) whenever the user defined parameter 0 is set.
Note: Your appendix contains a set of changes that will accomplish the desired results - use this as a
reference

Update client Script


You have now updated the ASR code to return and imfoamtoinal strung. You now need to update the
client script to display
3. In the toolkut open the client script Suggestion_OnAfterUpdateCont.
4. Before the subroutine exits add code that will get the informational string returned by the ASR,
using the method GetInfoStrinng
5. Pass this returned value into the global subroutine CMSMsgBox
Note: Your appendix contains a sample of a script that will accomplish the desired results - use this
script as a reference

Test your changes


In order to observe the effects of your changes you will need to set you language preferences as
Spanish
1. Open eRelationship Enterpirse Manager (eREM)
2. In eREM connect to Production
3. In the right-hand pane right-click on the user PRAC, and select Properties
4. Set the users language to Spanish
5. Restart LCS
6. Start your Rich Client system; your messages for changes to severity should now be in Spanish.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 79 of 128
Copyright CDC Software Corporation

Challenge Exercise Module 14: Extending


Language Translation Facilities
Objective
The informational message that has been produced in the ASR does not contain fully translated strings. This
exercise adds string translation for choice fields values and also translates stings in client script.

Tasks
Populate UI Strings and Labels
1. If you have not already done so, open the toolkit and via the personal assistant start the Pivotal
Agent Langauge.
2. Select the option Populate Language and click on OK
3. When prompted again click on Continue and select the langrage English (United States). This will
take approximately 45 minutes to complete

Update AppServer rule enhance private method


4. In Visual Studio 2005, locate the private method severityMesssage you implemented in the
exercise above.
5. Add code that will locate the choices for the field Severity (you will need to refer to the
IRChoices interface)
6. Use the value parameter Severity to index the choices collection and use the method Translate to
get the translated value for the selected choice index.
7. Ensue the translated string value is passed into returned value for the method.
Note: Your appendix contains a set of changes that will accomplish the desired results - use this as a
reference

Update the client script


1. Define constants to identify the language group and the language string Suggestion Severity
2. Declare a language dictionary object and initialise buy using UIMaster
3. Use the language dictionary object to get the translation for the string Suggestion Severity
Note: Your appendix contains a sample of a script that will accomplish the desired results - use this script as
a reference

Update the language dictionary


You have implemented functionality that assumes language strings have been defined for a fields choice values
and a dialogue title these need to the created.

1. In the toolkit open the LD Language Group Suggestions


2. Click on + to add a new language string, and enter details string name: Suggestion Severity. You
should also add the following translations
Language

Text

English (United States)

Suggestion Severity.

Spanish

Severidad de la sugerencia

3. Save these changes

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 80 of 128
Copyright CDC Software Corporation

4. In the toolkit open the Suggestion table and then open the field Severity. If the language agent has
completed correctly, the choice values for this fields populated with language strings, the field
form should be similar to the one shown below.

5. Make a note of the language strings for each choice.


6. Find the language strings. Using the the Quickfind option under LD Strings, find each language
string and add the Spanish translation as summarized below
Choice Value

String Name

Text

0 - Low

As defined in your system

Punto bajo

1 Medium

As defined in your system

Medio

2 High

As defined in your system

Colmo

Test your changes


1. Restart LCS
2. Start your end user system; your messages for changes to severity should now be completely in
Spanish.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 81 of 128
Copyright CDC Software Corporation

Module 15: Various Coding


Exercises

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 82 of 128
Copyright CDC Software Corporation

Exercise 15-1: Adding automation to a form


Objective
In this exercise you will add button groups to the form and provide functionality for these button groups to
allow the user to add activities to the form. However, first you must add a new relationship into the database
and update the form so that we have secondary records on the form.

Tasks
Create a new database relationship
1. In the toolkit, edit the suggestion table
2. Add a new field, the should be a foriehn key (field type reference) to the suggestion table, name:
Suggestion_Id.
3. Save the changes
4. In eREM connect to the production system and Apply Customisation Changes (ACC). When the
proposed changes are displayed click on OK to accept them.

Update activity forms


In order for this database relationship to be utilised we must add the new foreign key field in the
Rn_Appointments table into the relevant activity forms. To save time not all activity forms will me
updated.
1. Edit each of the following active forms for the Rn_Appointments table, go to the links tab and
add the field Suggestion_Id to the relevant primary segment

2. Save your changes

Update the suggestion form


1. In the toolkit edit the form Suggestion
2. Add a new tab to the form called Related
3. Add a new secondary segment to this tab called Activities. In the properties for this tick the flag
Prohibit Add.
4. Add the field Rn_Descriptor to the Activities secondary.

Add bar button group to Suggestion form


Hierarchical menu buttons are added here to allow the addition of different types of activity to a
suggestion
1. In the toolkit edit the form Suggestion
2. Choose a primary segment e.g. the segment Suggestion and right click on this segment and select
New Button Set
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 83 of 128
Copyright CDC Software Corporation

3. Set the properties for this button set as shown below

4. Right click on the Actions button set and add New Button Set again. Set the properties; name: New
Activity, title: New Activity.
5. Right click the New Activity s button set and add New Button. Set the buttons properties; name
and title: Call
6. Repeat step 5 for the buttons Meeting, ToDo and Note.
7. Save you changes.
Note - event hooks script will be associated with these buttons later in the exercise once they have
been implemented.

Add new subroutine to client script Suggestion_Form


1. In the toolkit edit the new client script; name: Suggestion_Form
2. Create a new subroutine: NewActivity(intActivityType)
3. In the code for this subroutine, use a case statement to assign the names of the form that will be
used to edit the activity records as shown below.
Value of intActivityType
Form Name
0
Meeting
1
To-Do
2
Call
5
Note
4. Obtain the record id (field Suggestion_Id) from the primary recordset
5. Using a transition point parameter object add default values for the following fields (in the
Rn_Appointments table ) as shown below
Field Name
Field Value
Activity_Type
intActovityType
Suggestion_Id
Suggestion.Suggestion_I
d
6. Construct the parameter array
7. Using the method UIMaster.ShowFormModal open the relevant activity form passing the
parameter array constructed above.
Note:

Your appendix contains a sample script that will accomplish the desired results - use this as a reference

Create new event hook scripts


1. In the toolkit create a new client script; name: Suggestion_NewCall, language VBScript
2. In the code, call the subroutine NewActivity in the form script Suggeston_Form with the
parameter value 2, i.e. Form.NewActivity(2)
3. Repeat steps 1-2 for the remaining buttons, using the table below as a reference
Event Hook Script Name
Subroutine Call
Suggestion_NewMeeting
Form.NewActivity(0)

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 84 of 128
Copyright CDC Software Corporation

Suggestion_NewToDo
Suggestion_NewNote
4. Save your changes

Form.NewActivity(1)
Form.NewActivity(5)

Note: Your appendix contains a sample scripts that will accomplish the desired results - use these as a
reference

Update form
The menu buttons added earlier are now associated with event hook scripts implemented above
5. In the toolkit edit the form Suggestion
6. Locate the buttons Call, Meeting, Todo and Note a associate with an event hook script using the
following table as a reference.
Button
Event
Event Hook Script Name
Call
OnClick
Suggestion_NewCall
Meeting
OnClick
Suggestion_NewMeeting
ToDo
OnClick
Suggestion_NewToDo
Note
OnClick
Suggestion_NewNote
7. Save your changes.
8. Restart LCS and test your changes
9. Add a few activities to a suggestion - will you need the data to test your code in the next exercise.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 85 of 128
Copyright CDC Software Corporation

Exercise 15-2: Cancelling Record Deletion


Objective
In this exercise you will write a new subroutine that will examine the dataset(s) associated with the suggestion
form and determine whether the record can be deleted.

Tasks
Edit the form Suggestion
Later in this exercise the client script will need to examine the activities associated with a suggestion, in
particular to find the value of the field Activity_Complete in the table Rn_Appointments. This field needs to be
added to the form.

1. In the toolkit edit the form Suggestion.


2. Locate the secondary segment Activities, right- click and select the option New Field, and select
the field Activity_Complete.
3. Edit the properties for this field and click on the tickbox Hidden
4. Save your changes
5. Close the form editor

Add new transition point subroutine


1.
2.
3.
4.
5.
6.

7.
8.

In the toolkit edit the client script Suggestion_Form


Create a new subroutine for the transition point DeleteFormData
Using the primary recordset get the value of the Boolean field Resolved
If Resolved is not true, print a message (using CMSMsgBox), set the DeleteCancelled flag to true
and exit the subroutine.
Next, obtain the secondary recordset for the segment Activities.
Loop through this recordset and count the number of activities that are not complete. The value of
the boolean field Activity_Complete (added to the form above) can be used to decide whether to
increment the count.
If the incomplete activity count is not zero, print a message (using CMSMsgBox), set the
DeleteCancelled flag to true and exit the subroutine.
Next, call the business server to perform the transition point using DoDeleteFormData.

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 86 of 128
Copyright CDC Software Corporation

Exercise 15-3: Cascading Record Deletion


Objective
In this exercise you will update the Appserver rule to delete linked secondary records together with the
suggestion records itself

Tasks
Edit the Appserver rule
1. In Visual Studio 2005, locate the transition point method DeleteFormData.
2. In DeleteFormData, declare and instantiate two instances of the Appserver rule Deletion Relation
Item, returning DeletionRelationItem objects. The first will be for the suggestion record itself and
the second will be for the linked appointments.
3. For each object, use the method Construct(<Table Name>, <FK Field Name>), to define the
table relationships
4. Add the deletion object for the appointments to the deletion object for the suggestion by using the
method SecondaryDeletionRelationItemCollection.Add.
5. Now, declare and instantiate an instance of the Appserver rule Data Access, returning DataAccess
object.
6. Use The method CascaseDelete of the DataAccess object to delete the secondary data.
7. The final code statement should call the ASS transition point handling code.
8. Compile and save your changes
9. Restart LCS
10. Test your changes by creating a resolved suggestion and add at least one completed activity, and
then delete the suggestion.
Note: Your appendix contains a set of changes that will accomplish the desired results - use this as a
reference

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 87 of 128
Copyright CDC Software Corporation

Exercise 15-4: Running a report from Code


Objective
In this exercise you will write a script that will download the report component also causing a platform event.
You will add a new subroutine to handle this platform event and run the report.

Tasks
Create a new event hook script.
1. In the toolkit create a new client script; name: Suggestion_PrintForm, language VBScript
2. In the code, obtain the record id (field Suggestion_Id) from the primary recordset
3. Using a transition point parameter object set up the following user parameters
Parameter
Value
Comment
Number
1
Suggestion
This is the name of the report
Summary
2
1
The destination of the report, 1= Screen
3
4
The recordset to be used by th report, 4=
Individual Record
4
Suggestion Record Id
This is the value obtained from the primary
recordset
4. Call the method UImaster.LoadRecordComponent and pass the vntParameters array.
5. Save your changes
Note: Your appendix contains a sample of a script that will accomplish the desired results - use this script as
a reference

Attach the script to the Field Event Hook


1. Open the Active Form Suggestion
2. Right click on the segment where you want to add the button and select New Button
3. Fill the properties as shown below

4. Fight click on the Print Form button and select New Event Hook->OnClick.
5. Right click the event hook and select Properties.
6. From the drop list, select the Suggestion_PrintForm client script.

Update the suggestion form script.


1. In the toolkit edit client script : Suggestion_Form.
2. Add a new subroutine OnReportComponentLoaded(vntParameters)
3. Using the a transition point parameter object get the report name from user parameter 1
530: Business Server Customization Fundamentals
Student Workbook International Version 2.0

Page: 88 of 128
Copyright CDC Software Corporation

4. Call the method UImaster.GetStealthReport(<report_name>) to create a new report object.


5. Set up the other report parameters using the remaining user defined parameters.
6. Run the report using method objReport.Run

Install Suggestion Summary report


7. In the toolkit, Suggestion Summary Report.rtr from the code disk directory (C:\Course
Files\Module 15).
8. Check that members the Base CMS Features security group have permissions to run this report
9. Restart LCS
10. Test your changes

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 89 of 128
Copyright CDC Software Corporation

Exercise 15-5: Handling Other Platform Events


Objective
In this exercises you will build a SmartPorttal contend query and associated this with a client script. The client
script will prompt for the type of form to be opened

Tasks
Create a New Active form
1. In the toolkit create a new active form; menu route: Active Forms->New Active Form
2. You should now be in the active form editor. A a new Anchroed Tab
3. Add the segments and fields shown below to the form
Segment
Segment Properies
Field
Field Properties
Suggestion
Type: Primary
Date
Readonly
Columns: 3
Severity
Read only
Separatr
N/A
Subject
Readonly
Colspan: 40
Comments

Assignment

Type: Primary
Columns: 1
Hide Title: Yes
Type: Primary
Columns: 3

Desription

LineCount 5

Assigned
Assigned_To

4. Save this form as Assign_Suggestion

Create a New Query


1.
2.
3.
4.

In the toolkit create a new system query; menu route: Queries->Target Queries: New
Return records from the suggestion table
Add a condition that will only returned suggestions if the boolean fields Assigned is True.
Save this query as Sys: Unassigned Suggestions.

Create a new client script SmartPortal_Suggestion


1. In the toolkit add a new client script SmartPortal_Suggestion
2. In this script implement a subroutine OnClick to handle this portal item event
3. In this subroutines use the global function CMSDialogRadio to prompt for the next action an use
the returned value to implement the functionality described below
Choice (Value)
Action
No Choice(-1)
Exit the function
Assign Suggestion (1)
Open form Assign_Suggestion
Edit Suggestuion(2)
Open form Suggestion
4. Save the client script

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 90 of 128
Copyright CDC Software Corporation

Create a new SmartPortal Content Query


5. In the toolkit, create a new SmartPortal Content category; menu route: SmartPortal Content
Categories ->New SmartPortal Content Category.
6. Set the category name to Suggestions
7. Save these changes
8. Now, create create a new SmartPortal Content query; menu route: SmartPortal Content Items >New SmartPortal Content Query.
9. Set the name of the item to Unresolved Suggestions
10. Set the other properties as shown below

Set permissions
11.
12.
13.
14.

In the toolkit, edit the security group Base CMS Features


Edit the permissions for the connection type Active Access
Click on the Active Forms tab, set the form Assign_Suggestion to be scriptable
Click on the SmartPortal Content Items Tab, and set the item Unassigned Suggestions to be
visible.
15. Save your changes

Test Your Changes


1. Restart LCS
2. Restart the browser
3. Add the new SmartPortal content query to your home page using the Personalize button (My
Portal tab).
4. Click on an item in the SmartPortal Content query (you may have to enter some data for items to
appear).

530: Business Server Customization Fundamentals


Student Workbook International Version 2.0

Page: 91 of 128
Copyright CDC Software Corporation

Appendix: Script and Code Samples

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 92 of 128
Copyright CDC Software Corporation

Exercise 8-1
Client Script: Suggestion_OnClickFromContact

Script Exercise 8-1


Event Hook Script: Suggestion_OnClickFromContact

Option Explicit
OnClick_FromContact()
Sub OnClick_FromContact()
Const strfFROM_CONTACT
Const strsEmployee_Details
Const strsContact_Details

= "From_Contact"
= "Employee_Details"
= "Contact_Details"

Dim rstPrimaryRecordset
Set rstPrimaryRecordset = UIMaster.RUICenter.PrimaryRecordset
If rstPrimaryRecordset.Fields(strfFROM_CONTACT).Value = True Then
UIMaster.RUICenter.ShowSegment 0, strsContact_Details
UIMaster.RUICenter.HideSegment 0, strsEmployee_Details
Else
UIMaster.RUICenter.ShowSegment 0, strsEmployee_Details
UIMaster.RUICenter.HideSegment 0, strsContact_Details
End If
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 93 of 128
Copyright CDC Software Corporation

Exercise 8-2
Form Script: Suggestion_Form

Script Exercise 8-2


Form Script: Suggestion_Form

Sub OnFormLoaded(vntParameters)
DisplaySuggByDetails()
End Sub
Sub DisplaySuggByDetails()
Const strfFROM_CONTACT
Const strsEmployee_Details
Const strsContact_Details

= "From_Contact"
= "Employee_Details"
= "Contact_Details"

Dim rstPrimaryRecordset
Set rstPrimaryRecordset = UIMaster.RUICenter.PrimaryRecordset
If rstPrimaryRecordset.Fields(strfFROM_CONTACT).Value = True Then
UIMaster.RUICenter.ShowSegment 0, strsContact_Details
UIMaster.RUICenter.HideSegment 0, strsEmployee_Details
Else
UIMaster.RUICenter.ShowSegment 0, strsEmployee_Details
UIMaster.RUICenter.HideSegment 0, strsContact_Details
End If
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 94 of 128
Copyright CDC Software Corporation

Event Hook Script: Suggestion_OnClickFromContact

Exercise: 8-2
Event Hook Script: Suggestion_OnClickFromContact

Option Explicit
OnClick_FromContact()
Sub OnClick_FromContact()
Form.DisplaySuggByDetails()
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 95 of 128
Copyright CDC Software Corporation

Exercise 8-3
Form Script: Suggestion_Form

Exercise 8-3
Form Script: Suggestion_Form
New Subroutine : Set Required

Sub SetRequired()
Const
Const
Const
Const
Const
Const
Const

strfASSIGNED
strfASSIGNED_TO
strfREVIEWED
strfREVIEWED_BY
strfSEVERITY
strsREVIEW
straREVIEW

=
=
=
=
=
=
=

"Assigned"
"Assigned_To"
"Reviewed"
"Reviewed_By"
"Severity"
"Review"
"Review Tab"

Dim rfrmForm
Dim rstPrimaryRecordset
With UIMaster
Set rfrmForm = .RUICenter.Form
Set rstPrimaryRecordset = .RUICenter.PrimaryRecordset
End With
If rstPrimaryRecordset.Fields(strfASSIGNED).Value = True Then
UIMaster.RUICenter.SetFieldRequired strsREVIEW, strfASSIGNED_TO, True
UIMaster.RUICenter.SetFieldRequired strsREVIEW, strfSEVERITY, True
Else
UIMaster.RUICenter.SetFieldRequiredEx straREVIEW, strsREVIEW, strfASSIGNED_TO, FALSE
UIMaster.RUICenter.SetFieldRequiredEx straREVIEW, strsREVIEW, strfSEVERITY, FALSE
End If
If rstPrimaryRecordset.Fields(strfREVIEWED).Value = True Then
UIMaster.RUICenter.SetFieldRequired strsREVIEW, strfREVIEWED_BY, True
Else
UIMaster.RUICenter.SetFieldRequiredEx straREVIEW, strsREVIEW, strfREVIEWED_BY, FALSE
End If
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 96 of 128
Copyright CDC Software Corporation

End Sub

Exercise 8-3
Form Script: Suggestion_Form
Updated Subroutine: OnFormLoaed

Option Explicit
Sub OnFormLoaded(vntParameters)
DisplaySuggByDetails()
New call to set required
SetRequired()
End Sub

Event Hook Script: Suggestion_OnClickAssigned

Exercise 8-3
Event Hook Script: Suggestion_OnClickAssigned

Option Explicit
Form.SetRequired()

Event Hook Script: Suggestion_OnClickReviewed

Exercise 8-3
Event Hook Script: Suggestion_OnClickReviewed

Option Explicit

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 97 of 128
Copyright CDC Software Corporation

Form.SetRequired()

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 98 of 128
Copyright CDC Software Corporation

Exercise 8-4
Form Script: Suggestion_OnClickFromContact
Option Explicit
OnClickFromContact()
Sub OnClickFromContact
Const
Const
Const
Const
Const
Const
Const

strfFROMCONTACT
strfEMPLOYEE_ID
strfCONTACT_ID
strfCOMPANY_ID
strTITLE_WARNING
strMESSAGE_EMPLOYEE
strMESSAGE_CONTACT

=
=
=
=
=
=
=

"From_Contact"
"Employee_Id"
"Contact_Id"
"Company_Id"
"Warning"
"This will clear the employee field. Continue?"
"This will clear the contact/company fields. Continue?"

Dim rfrmForm
Dim rstPrimaryRecordset
Dim intResult
With UIMaster
Set rfrmForm = .RUICenter.Form
Set rstPrimaryRecordset = .RUICenter.PrimaryRecordset
End With
If rstPrimaryRecordset.Fields(strfFROMCONTACT).Value = True Then
' Suggestion made by contact
If UIMaster.RSysClient.EqualIds(rstPrimaryRecordset.Fields(strfEMPLOYEE_ID).Value, Null) = False Then
' Employee inforamtion is filled in - check if we can clear it
intResult = Global.CMSDialog(strMESSAGE_EMPLOYEE, strTITLE_WARNING, Array("OK", "Cancel"))
If intResult = 1 Then
' OK - clear the field
rstPrimaryRecordset.Fields(strfEMPLOYEE_ID).Value = Null
Else
' Cancel - reset the 'From Contact' field
rstPrimaryRecordset.Fields(strfFROMCONTACT).Value = True
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 99 of 128
Copyright CDC Software Corporation

Exit Sub
End If
End If
Else
' Suggestion made by employee
If UIMaster.RSysClient.EqualIds(rstPrimaryRecordset.Fields(strfCONTACT_ID).Value, Null) = False Then
' Contact inforamtion is filled in - check if we can clear it
intResult = Global.CMSDialog(strMESSAGE_CONTACT, strTITLE_WARNING, Array("OK", "Cancel"))
If intResult = 1 Then
' OK - clear the fields
rstPrimaryRecordset.Fields(strfCONTACT_ID).Value = Null
rstPrimaryRecordset.Fields(strfCOMPANY_ID).Value = Null
Else
' Cancel - reset the 'From Contact' field
rstPrimaryRecordset.Fields(strfFROMCONTACT).Value = False
Exit Sub
End If
End If
End If
' Update field attributes
Form.DisplaySuggByDetails()
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 100 of 128


Copyright CDC Software Corporation

Exercise 8-5
Form Script: Suggestion_From

Exercise 8-5
Form Script: Suggestion_Form
New Subroutines: NewFormData, NewSecondaryData, DeleteFormData

'---------------------------------------------------------------------------------Function NewFormData(rfrmForm, vntParameters)


'Call to AppServer
NewFormData = rfrmForm.DoNewFormData(vntParameters)
End Function
'---------------------------------------------------------------------------------Sub NewSecondaryData(rfrmForm, vntSecondary, vntParameters, rstRecordset)
'Call to AppServer
rfrmForm.DoNewSecondaryData vntSecondary, vntParameters, rstRecordset
End Sub
'---------------------------------------------------------------------------------Sub DeleteFormData(rfrmForm, vntRecordId, vntParameters)
'Call to AppServer
rfrmForm.DoDeleteFormData vntRecordId, vntParameters
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 101 of 128


Copyright CDC Software Corporation

Exercise 8-6
Form Script: Suggestion_Form

Exercise 8-6
Form Script: Suggestion_Form
Updated Subroutine: NewFormData

Const strCMS_SYSTEM
= "CMS System"
Const strCOMPANY_ACTIVITIES = "Company Activities"
Const strfCLASSIFICATION
= "Classification"
Const strfDIALOG_TEXT
= "Please select the Suggestion Type"
Const strfDIALOG_TITLE
= "Suggestion Type"
'---------------------------------------------------------------------------------Function NewFormData(rfrmForm, vntParameters)
Dim intResult
Dim objParam
Dim rstPrimaryRecordset
Dim vntChoices
' Prompt user for type of suggestion
vntChoices = Array(strCMS_SYSTEM, strCOMPANY_ACTIVITIES)
intResult = Global.CMSDialogRadio(strfDIALOG_TEXT, strfDIALOG_TITLE, vntChoices)
if intResult <= 0 Then
UIMaster.Back 0
Else
' Add a default value in transition point parameter array
Set objParam = Global.CreateTransitPointParamsObj()
objParam.AddDefaultField strfCLASSIFICATION, vntChoices(intResult-1)
vntParameters = objParam.ConstructParams()
' Call to AppServer
NewFormData = rfrmForm.DoNewFormData(vntParameters)
End If
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 102 of 128


Copyright CDC Software Corporation

End Function

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 103 of 128


Copyright CDC Software Corporation

Exercise 11-1
Appserver Rule: Suggestion
//
// Exercise 11-1
// New ASR: Suggestion
//
using System;
namespace
{
using
using
using
using
using
using

CMS.EF.Server
Pivotal.Interop.ADODBLib;
Pivotal.Interop.RDALib;
Pivotal.Application.Foundation.BusinessRule;
Pivotal.Application.Foundation.Utility;
Pivotal.Application.Foundation.Data.Element;
Pivotal.Application.Foundation.Data.Element.Table;

public class Suggestion : IRFormScript


{
private IRSystem7 m_rdaSystem;
public Suggestion()
{
//
// Constructor Logic here
//
}
class Suggestion : IRFormScript
#region IRFormScript Members
public object AddFormData(IRForm pForm, object Recordsets, ref object ParameterList)
{
try
{
object Suggestion_Id = pForm.DoAddFormData(Recordsets, ref ParameterList);
return Suggestion_Id;
}
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 104 of 128


Copyright CDC Software Corporation

catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
public void DeleteFormData(IRForm pForm, object RecordId, ref object ParameterList)
{
try
{
pForm.DoDeleteFormData(RecordId, ref ParameterList);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
public void Execute(IRForm pForm, string MethodName, ref object ParameterList)
{
}
public object LoadFormData(IRForm pForm, object RecordId, ref object ParameterList)
{
try
{
object recordsetList = pForm.DoLoadFormData(RecordId, ref ParameterList);
return recordsetList;
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
public object NewFormData(IRForm pForm, ref object ParameterList)
{
try
{
object recordsetList = pForm.DoNewFormData(ref ParameterList);
return recordsetList;
}
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 105 of 128


Copyright CDC Software Corporation

catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
public void NewSecondaryData(IRForm pForm, object SecondaryName, ref object ParameterList, ref Recordset
Recordset)
{
try
{
Pivotal.Interop.ADODBLib.Recordset SecondaryRecordSet = null;
pForm.DoNewSecondaryData(SecondaryName, ref ParameterList, SecondaryRecordSet);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
public void SaveFormData(IRForm pForm, object Recordsets, ref object ParameterList)
{
try
{
pForm.DoSaveFormData(Recordsets, ref ParameterList);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
public void SetSystem(RSystem pSystem)
{
try
{
m_rdaSystem = (IRSystem7)rdaSystem;
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 106 of 128


Copyright CDC Software Corporation

}
#endregion
}
}

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 107 of 128


Copyright CDC Software Corporation

Exercise 11-2
Appserver Rule: Suggestion
//
// Exercise 11-2
// Updated Transition Point: NewFormData
//
public object NewFormData(IRForm pForm, ref object ParameterList)
{
try
{
object recordsetList = pForm.DoNewFormData(ref ParameterList);
// Gets primary recordset
object[] recordsetArray = (object[])recordsetList;
Recordset suggestionRecordset = (Recordset)recordsetArray[0];
TransitionPointParameter transitionPointParameter = (TransitionPointParameter) m_rdaSystem
// Creates an instance the TransitionPointParamater ASR
.ServerScripts[AppServerRuleData.TransitionPointParameterAppServerRuleName].CreateInstance();
transitionPointParameter.ParameterList = ParameterList;
if (!transitionPointParameter.HasValidParameters())
transitionPointParameter.Construct();
else
// Set Default field values
transitionPointParameter.SetDefaultFields(suggestionRecordset);
return recordsetList ;
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 108 of 128


Copyright CDC Software Corporation

Challenge Exercise Module 11


Form Script: Suggestion_Form

Challenge exercise Module 11 - make field 'Object_' required if the Classification is CMS system
Add the following code to the subroutine OnFormLodaed

Note: you will need to set up entries in the user choice list 'Object Choices'
Const strsSUGGESTION
Const strfOBJECT

= "Suggestion"
= "Object_"

If rstPrimaryRecordset.Fields(strfCLASSIFICATION).Value = strCMS_SYSTEM Then


UIMaster.RUICenter.SetFieldRequired strsSUGGESTION, strfOBJECT, True
End If

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 109 of 128


Copyright CDC Software Corporation

Exercise 12-1
Client Script: Suggestion_OnAfterUpdateCont

Exercise: 12-1
Script: Suggesion_OnAferUpdateCont

Option Explicit
OnAfterUpdateContactId()
Sub OnAfterUpdateContactId()
Const strfCONTACT_ID = "Contact_Id"
Const strfSEVERITY
= "Severity"
Const strmGET_SEVERITY = "GetSeverity"
Dim
Dim
Dim
Dim
Dim
Dim

rfrmForm
rstPrimaryRecordset
vntParameters
objParam
vntfContact_Id
intfSeverity

Set rfrmForm = UIMaster.RUICenter.Form


Set rstPrimaryRecordset = UIMaster.RUICenter.PrimaryRecordset
vntfContact_Id = rstPrimaryRecordset.Fields(strfCONTACT_ID).Value
if UIMaster.RSysClient.EqualIds(vntfContact_Id, Null) = False then
Set objParam = Global.CreateTransitPointParamsObj()
objParam.SetUserDefParam 1, vntfContact_Id
vntParameters = objParam.ConstructParams
'Call Execute function
rfrmForm.Execute strmGET_SEVERITY, vntParameters
intfSeverity = objParam.GetUserDefParam (1, vntParameters)
rstPrimaryRecordset.Fields(strfSEVERITY).Value = intfSeverity
end if
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 110 of 128


Copyright CDC Software Corporation

End Sub

Appserver Rule: Suggestion


//
// Exercise 12-2
// Updated Transition Point: Execute
//
public void Execute(IRForm pForm, string MethodName, ref object ParameterList)
{
object returnValue = DBNull.Value;
Recordset returnRecordset = null;
string outValue = string.Empty;
try
{
TransitionPointParameter transitionPointParameter = (TransitionPointParameter)m_rdaSystem
.ServerScripts[AppServerRuleData.TransitionPointParameterAppServerRuleName].CreateInstance();
transitionPointParameter.ParameterList = ParameterList;
object[] userDefParameterArray = (object[])transitionPointParameter.GetUserDefinedParameterArray();
switch (MethodName)
{
case Suggestion.GetSeverity:
object contactId ;
userDefParameterArray[0] = 0;
transitionPointParameter.CheckUserDefinedParameterNumber(1);
contactId = transitionPointParameter.GetUserDefinedParameter(1) ;
// Get the type of contact from contact record
string contactType =
m_rdaSystem.Tables[ContactData.ContactTableName].Fields[ContactData.TypeFieldName].Index(contactId).ToString() ;
if (contactType == "Customer" | contactType == "Partner" )
{
userDefParameterArray[0] = 2 ;
break;
}
// Gets the company Id from contact record
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 111 of 128


Copyright CDC Software Corporation

object companyId =
m_rdaSystem.Tables[ContactData.ContactTableName].Fields[ContactData.CompanyIdFieldName].Index(contactId);
// Creates an instance of a Pivotal dataset object
DataAccess rdstOpportunites = (DataAccess)
m_rdaSystem.ServerScripts[AppServerRuleData.DataAccessAppServerRuleName].CreateInstance();
rdstOpportunites.PermissionIgnored = true;
// Retunds a recordset of active opportunities for the company
Recordset rstOpportunities = rdstOpportunites.GetRecordset(strqFindActiveOpportunites, 1,
companyId, OpportunityData.OpportunityIdFieldName);
if (rstOpportunities.RecordCount > 0) userDefParameterArray[0] = 1;
break ;
}
ParameterList = transitionPointParameter.SetUserDefinedParameterArray(userDefParameterArray);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 112 of 128


Copyright CDC Software Corporation

Exercise 14-1
Appserver Rule: Suggestion
//
// Exercise 14-1 Part 1
// New local objects
//
public
public
public
public

const
const
const
const

string
string
string
string

strgSuggestions = "Suggestions";
strdSeveritySetTo = "SeveritySetTo";
strtSuggestion = "Suggestion";
strfSeverity = "Severity";

//
//
//
//

Langauge Group
Language String
Table Name
Field 'Severity'

private ILangDict m_suggestionLangDict;

//
// Exercise 14-1 Part 2
// Update to method 'SetSystem'
//
public void SetSystem(RSystem pSystem)
{
try
{
m_rdaSystem = (IRSystem7)pSystem ;
m_suggestionLangDict = m_rdaSystem.GetLDGroup(Suggestion.strgSuggestions);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}
//
// Exercise 14-1 Part 3
// New private method SeverityMessage
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 113 of 128


Copyright CDC Software Corporation

//
private string severityMessage(int Severity)
{
string suggestionServerity =
m_rdaSystem.Tables[Suggestion.strtSuggestion].Fields[Suggestion.strfSeverity].Choices[Severity].ToString();
return m_suggestionLangDict.GetTextSub(Suggestion.strdSeveritySetTo, new
string[]{suggestionServerity}).ToString();
}
//
// Exercise 14-1 Part 4
// Updated Transition Point: Execute
//
public void Execute(IRForm pForm, string MethodName, ref object ParameterList)
{
object returnValue = DBNull.Value;
Recordset returnRecordset = null;
string outValue = string.Empty;
try
{
TransitionPointParameter transitionPointParameter = (TransitionPointParameter)m_rdaSystem
.ServerScripts[AppServerRuleData.TransitionPointParameterAppServerRuleName].CreateInstance();
transitionPointParameter.ParameterList = ParameterList;
object[] userDefParameterArray = (object[])transitionPointParameter.GetUserDefinedParameterArray();
switch (MethodName)
{
case Suggestion.GetSeverity:
object contactId ;
userDefParameterArray[0] = 0;
transitionPointParameter.InfoMessage = severityMessage(0);
transitionPointParameter.CheckUserDefinedParameterNumber(1);
contactId = transitionPointParameter.GetUserDefinedParameter(1) ;
// Get the type of contact from contact record
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 114 of 128


Copyright CDC Software Corporation

string contactType =
m_rdaSystem.Tables[ContactData.ContactTableName].Fields[ContactData.TypeFieldName].Index(contactId).ToString() ;
if (contactType == "Customer" | contactType == "Partner" )
{
userDefParameterArray[0] = 2 ;
transitionPointParameter.InfoMessage = severityMessage(2);
break;
}
// Gets the company Id from contact record
object companyId =
m_rdaSystem.Tables[ContactData.ContactTableName].Fields[ContactData.CompanyIdFieldName].Index(contactId);
// Creates an instance of a Pivotal dataset object
DataAccess rdstOpportunites = (DataAccess)
m_rdaSystem.ServerScripts[AppServerRuleData.DataAccessAppServerRuleName].CreateInstance();
rdstOpportunites.PermissionIgnored = true;
// Retunds a recordset of active opportunities for the company
Recordset rstOpportunities = rdstOpportunites.GetRecordset(strqFindActiveOpportunites, 1,
companyId, OpportunityData.OpportunityIdFieldName);
if (rstOpportunities.RecordCount > 0)
{
userDefParameterArray[0] = 1;
transitionPointParameter.InfoMessage = severityMessage(1);
}
break ;
}
ParameterList = transitionPointParameter.SetUserDefinedParameterArray(userDefParameterArray);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
}
}

Client Script: Suggestion_OnAfterUpdateCont


530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 115 of 128


Copyright CDC Software Corporation


Exercise: 14 Part 5
Updated Script: Suggesion_OnAferUpdateCont
New code after return from Execute
Global.CMSMsgBox objParam.GetInfoString(vntParameters), Suggestion Severity, vbOKOnly

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 116 of 128


Copyright CDC Software Corporation

Challenge Exercise Module 14


Client Script: Suggestion_OnAfterUpdateCont

Challenge Exercise Module

Option Explicit
OnAfterUpdateContactId()
Sub OnAfterUpdateContactId()
Const
Const
Const
Const
Const
Dim
Dim
Dim
Dim
Dim
Dim
Dim
Dim

strfCONTACT_ID = "Contact_Id"
strfSEVERITY
= "Severity"
strmGET_SEVERITY = "GetSeverity"
strgSUGGESTIONS = "Suggestions"
strdSUGGESTION_SEVERITY = "Suggestion Severity"

rfrmForm
rstPrimaryRecordset
vntParameters
objParam
vntfContact_Id
intfSeverity
rldtLangDict
strMessage

Set rldtLangDict = UIMaster.RSysClient.GetLDGroup(strgSUGGESTIONS)

Set rfrmForm = UIMaster.RUICenter.Form


Set rstPrimaryRecordset = UIMaster.RUICenter.PrimaryRecordset
vntfContact_Id = rstPrimaryRecordset.Fields(strfCONTACT_ID).Value
if UIMaster.RSysClient.EqualIds(vntfContact_Id, Null) = False then
Set objParam = Global.CreateTransitPointParamsObj()
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 117 of 128


Copyright CDC Software Corporation

objParam.SetUserDefParam 1, vntfContact_Id
vntParameters = objParam.ConstructParams
'Call Execute function
rfrmForm.Execute strmGET_SEVERITY, vntParameters
intfSeverity = objParam.GetUserDefParam (1, vntParameters)
rstPrimaryRecordset.Fields(strfSEVERITY).Value = intfSeverity
Global.CMSMsgBox objParam.GetInfoString(vntParameters), rldtLangDict.GetText(strdSUGGESTION_SEVERITY),
vbOKOnly
end if
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 118 of 128


Copyright CDC Software Corporation

Exercise 15-1
Client Script: Suggestion_Form

Exercise 15-1
Form Script: Suggestion_Form
New Subroutine: NewActivity(intActivityType)

Sub NewActivity(intActivityType)
Const
Const
Const
Const
Const
Const
Const
Const
Dim
Dim
Dim
Dim
Dim

'

strrMEETING = "Meeting"
strrTO_DO = "To-Do"
strrCALL = "Call"
strrNOTE = "Note"
strfSUGGESTION_ID = "Suggestion_Id"
strfACTIVITY_TYPE = "Activity_Type"
strfCONTACT_ID = "Contact_Id"
strfCONTACT = "Contact"

strFormName
objParam
rstPrimaryRecordset
vntParameters
vntContact_Id

' Choses form name based on activity type


Select Case intActivityType
Case 2
strFormName = strrCALL
Case 1
strFormName = strrMEETING
Case 3
strFormName = strrTO_DO
Case 5
strFormName = strrNOTE
Case Else
Exit Function
End Select

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 119 of 128


Copyright CDC Software Corporation

Set rstPrimaryRecordset = UIMaster.RUICenter.PrimaryRecordset


' Builds default field value set
Set objParam = Global.CreateTransitPointParamsObj()
With objParam
.AddDefaultField strfACTIVITY_TYPE, intActivityType
.AddDefaultField strfSUGGESTION_ID, rstPrimaryRecordSet.Fields(strfSUGGESTION_ID).Value
vntContact_Id = rstPrimaryRecordSet.Fields(strfCONTACT_ID).Value
If Not IsNull(vntContact_Id) Then .AddDefaultField strfCONTACT, vntContact_Id
vntParameters = .ConstructParams()
End With
' Opens the a modal form
UIMaster.ShowFormModal strFormName, Null, vntParameters
End Sub

Client Script: Suggestion_NewCall

Exercise 15-2
Event Hook Script: Suggestion_NewCall

Form.NewActivity(2)

Client Script: Suggestion_NewMeeting

Exercise 15-2
Event Hook Script: Suggestion_NewMeeting

Form.NewActivity(0)

Client Script: Suggestion_NewToDo

Exercise 15-2
Event Hook Script: Suggestion_NewToDo
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 120 of 128


Copyright CDC Software Corporation


Form.NewActivity(1)

Client Script: Suggestion_NewNote

Exercise 15-2
Event Hook Script: Suggestion_NewNote

Form.NewActivity(5)

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 121 of 128


Copyright CDC Software Corporation

Exercise 15-2
Client Script: Suggestion_Form

Exercise 15-2
Form Script: Suggestion_Form
New Subroutine: DeleteFormData

'---------------------------------------------------------------------------------Sub DeleteFormData(rfrmForm, vntRecordId, vntParameters)


Const
Const
Const
Const

strsACTVITIES = "Activities"
strfRESOLVED = "Resolved"
strfSUGGESTION_ID = "Suggestion_Id"
strfACTIVITY_COMPLETE = "Activity_Complete"

Const strMSSG_TITLE = "Suggestion Delete Error"


Const strSTATUS_MSSG = "Cannot delete suggestion. It is not resolved."
Const strINCOMPLETE_MSSG = "Cannot delete suggestion. It has incomplete activities."
Dim rstPrimaryRecordset
Dim rstSecondaryRecordset
Dim intNumberOfIncompleteActivities
Set rstPrimaryRecordset = UIMaster.RUICenter.PrimaryRecordset
If rstPrimaryRecordset.Fields(strfRESOLVED) <> True Then
Global.CMSMsgBox strSTATUS_MSSG, strMSSG_TITLE, vbOKOnly
UIMaster.RUICenter.DeleteCanceled = True
Exit Sub
End If
Set rstSecondaryRecordset = UIMaster.RUICenter.GetRecordset(strsACTVITIES)
intNumberOfIncompleteActivities = 0
If IsNull(rstPrimaryRecordset.Fields(strfSUGGESTION_ID).Value) Then
Exit Sub
ElseIf rstSecondaryRecordset.RecordCount > 0 Then
rstSecondaryRecordset.MoveFirst
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 122 of 128


Copyright CDC Software Corporation

While rstSecondaryRecordset.EOF = False


If rstSecondaryRecordset.Fields(strfACTIVITY_COMPLETE ).Value <> True Then
intNumberOfIncompleteActivities = intNumberOfIncompleteActivities + 1
End If
rstSecondaryRecordset.MoveNext
Wend
End If
Set rstPrimaryRecordset = Nothing
Set rstSecondaryRecordset = Nothing
If intNumberOfIncompleteActivities > 0 Then
Global.CMSMsgBox strINCOMPLETE_MSSG, strMSSG_TITLE, vbOKOnly
UIMaster.RUICenter.DeleteCanceled = True
Exit Sub
End If

'Call to AppServer
rfrmForm.DoDeleteFormData vntRecordId, vntParameters
End Sub

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 123 of 128


Copyright CDC Software Corporation

Exercise 15-3
Appserver Rule: Suggestion
//
// Exercise 15-3
// Updated Transition Point: DeleteFormData
//
public void DeleteFormData(IRForm pForm, object RecordId, ref object ParameterList)
{
try
{
// Deletion item for suggestion records
DeletionRelationItem suggestionDeleteRealtionItem =
(DeletionRelationItem)
m_rdaSystem.ServerScripts[AppServerRuleData.DeletionRelationItemAppServerRuleName].CreateInstance() ;
suggestionDeleteRealtionItem.Construct(Suggestion.strtSuggestion, Suggestion.strfSuggestionId);
// Deletion item for appointments
DeletionRelationItem appointmentsDeleteRealtionItem =
(DeletionRelationItem)
m_rdaSystem.ServerScripts[AppServerRuleData.DeletionRelationItemAppServerRuleName].CreateInstance() ;
appointmentsDeleteRealtionItem.Construct(AppointmentsData.AppointmentsTableName,
Suggestion.strfAppointmentsFKName);
// Adds appointments deletion item to collection of secondary data to be deleted
suggestionDeleteRealtionItem.SecondaryDeletionRelationItemCollection.Add(appointmentsDeleteRealtionItem);
// Provides access to cascade delete method.
DataAccess suggestionDataAccess =
(DataAccess)m_rdaSystem.ServerScripts[AppServerRuleData.DataAccessAppServerRuleName].CreateInstance();
suggestionDataAccess.CascadeDelete(RecordId, suggestionDeleteRealtionItem, false);
pForm.DoDeleteFormData(RecordId, ref ParameterList);
}
catch (Exception e)
{
throw new PivotalApplicationException(e.Message, e, m_rdaSystem);
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 124 of 128


Copyright CDC Software Corporation

}
}

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 125 of 128


Copyright CDC Software Corporation

Exercise 15-4
Event Hook Script: Suggestion_PrintForm

Exercise 15-4 - Part 1


Event Hook Script: Suggestion_PrintForm
Option Explicit
Call LoadSuggestionReport
'---------------------------------------------------------------------------------------------------------------Sub LoadSuggestionReport()
Const strrSUGGESTION_SUMMARY = "Suggestion Summary"
Const strfSUGGESTION_ID = "Suggestion_Id"
Dim
Dim
Dim
Dim

rstSuggestion
vntSuggestionId
ObjParam
vntParameters
Set rstSuggestion = UIMaster.RUICenter.PrimaryRecordset
vntSuggestionId = rstSuggestion.Fields(strfSUGGESTION_ID).Value
Set objParam = Global.CreateTransitPointParamsObj()
' Set report name
objParam.SetUserDefParam 1, strrSUGGESTION_SUMMARY
' Set Destintaition. 1 = screen, 2 = printer
objParam.SetUserDefParam 2, 1
'Set which records to use. 1 = Entire System, 2 = Static List, 3 = Query, 4 = Individual Record Selection
objParam.SetUserDefParam 3, 4
' Set record Id
objParam.SetUserDefParam 4, vntSuggestionId
vntParameters = objParam.ConstructParams()
UIMaster.LoadReportComponent(vntParameters)

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 126 of 128


Copyright CDC Software Corporation

End Sub

Client Script: Suggestion_Form

Exercise 15-4 - Part 2


Form Script: Suggestion_Form
New Subroutine: OnReportComponentLoaded

Sub
Const strfSUGGESTION_ID = "Suggestion_Id"
Dim
Dim
Dim
Dim
Dim
Dim

objParam
objrReport
strReportName
intReportDestination
intUseRecordsFrom
vntRecordSet
Set objParam = Global.CreateTransitPointParamsObj()

' Get/Set reports name


strReportname = objParam.GetUserDefParam(1, vntParameters)
Set objrReport = UIMaster.GetStealthReport(strReportName)
'Get/Set report destination.
intReportDestination = objParam.GetUserDefParam(2, vntParameters)
objrReport.destination = intReportDestination
' Get/Set of recdordss
intUseRecordsFrom = objParam.GetUserDefParam(3, vntParameters)
vntRecordSet = objParam.GetUserDefParam(4, vntParameters)
Call objrReport.UseRecordsFrom(intUseRecordsFrom , vntRecordSet)
'Run the report
objrReport.RunReport
Set objrReport = Nothing
End Sub
530: Business Server Customization Fundamentals
Student International Workbook: Code Samples

Page: 127 of 128


Copyright CDC Software Corporation

Exercise 15-5
Client Script: SmartPortal_Suggestion

Exercise 15-5
Client Script: SmartPortal_Suggestion

Option Explicit
Function OnClick(UIPortalItem, TableId, RecordId)
Const
Const
Const
Const
Const
Const

strTITLE = "Unresolved Suggestion"


strMSSG = "This suggestion is not resolved.<br>Please select you action <b>below</b>."
strASSIGN = "Assign Suggestion"
strOPEN = "Edit Suggestion"
strrSUGGESTION = "Suggestion"
strrASSIGN_SUGGESTION = "Assign_Suggestion"

Dim intResult
Dim strForm
intResult = Global.CMSDialogRadio(strTITLE ,

strMSSG, Array(strASSIGN , strOPEN))

Select Case intResult


Case -1 Exit Function
Case 1 strForm = strrASSIGN_SUGGESTION
Case 2 strForm = strrSUGGESTION
End Select
UIMaster.Showform actionNoSave, strForm, RecordId
End Function

530: Business Server Customization Fundamentals


Student International Workbook: Code Samples

Page: 128 of 128


Copyright CDC Software Corporation

Potrebbero piacerti anche