IG
IG
Limitation of liability This document is provided “as-is”. Information and views expressed in this document, including
URL and other Internet Web site references, may change without notice. You bear the risk of using
it.
Some examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
Intellectual property This document does not provide you with any legal rights to any intellectual property in any
Microsoft product.
You may copy and use this document for your internal, reference purposes.
Trademarks Microsoft, Dexterity, Microsoft Dynamics, MSDN, Visua SourceSafe, Visual Studio, and Windows
are trademarks of the Microsoft group of companies. FairCom and c-tree Plus are trademarks of
FairCom Corporation and are registered in the United States and other countries.
Warranty disclaimer Microsoft Corporation disclaims any warranty regarding the sample code contained in this
documentation, including the warranties of merchantability and fitness for a particular purpose.
License agreement Use of this product is covered by a license agreement provided with the software product. If you
have any questions, please call the Microsoft Dynamics GP Customer Assistance Department at
800-456-0025 (in the U.S. or Canada) or +1-701-281-6500.
INTEGRATION GUIDE i
C O N T E N T S
ii IN T E G R AT I O N G U ID E
C O N T E N T S
Chapter 24: Navigation Pane Categories and Area Pages ....................... 195
Area Page ...................................................................................................................................................195
Navigation pane category........................................................................................................................196
iv IN T E G R AT I O N G U ID E
C O N T E N T S
INTEGRATION GUIDE v
C O N T E N T S
vi IN T E G R AT I O N G U ID E
C O N T E N T S
viii IN T E G R AT I O N G U ID E
C O N T E N T S
INTEGRATION GUIDE ix
C O N T E N T S
Get() ....................................................................................................................................................518
Release ................................................................................................................................................519
SetIndex ..............................................................................................................................................520
SetUserRole........................................................................................................................................521
List scripts..................................................................................................................................................523
ActionStatus_LogActionComplete() ..............................................................................................525
ActionStatus_LogError()..................................................................................................................526
AddCommand()................................................................................................................................528
AddGroup() .......................................................................................................................................533
AddReport().......................................................................................................................................535
BuildDictSpecificID()........................................................................................................................536
Columns_AddToken()......................................................................................................................537
Columns_AutoGenTokensForEnumField() ..................................................................................540
ConfirmAction() ................................................................................................................................541
CreateDefaultColumn()....................................................................................................................543
CreateDefaultCustomViewRecord() ..............................................................................................545
CreateDefaultFactBox() ....................................................................................................................546
CreateDefaultViewRecord() -- Options..........................................................................................548
CreateDefaultViewRecord() -- View...............................................................................................549
DeleteForListView() -- Options.......................................................................................................550
DeleteForListView() -- Columns .....................................................................................................551
DeleteForListView() -- Business Analyzer Reports......................................................................552
DisassembleDictSpecificID..............................................................................................................553
Exists() ................................................................................................................................................554
ExistsAsAction()................................................................................................................................556
ExistsAsGroup() ................................................................................................................................557
FactBoxParameter_Add ...................................................................................................................558
FindCommandInCmdList().............................................................................................................560
GetListID() .........................................................................................................................................561
GetMarkedRecordCount() ...............................................................................................................562
GetMarkedRecordsTableIndex().....................................................................................................563
GetMarkedRecordsTableRef() .........................................................................................................564
GetViewID() .......................................................................................................................................565
InfoValue_ClearState() .....................................................................................................................566
InfoValue_IsStateSet().......................................................................................................................567
InfoValue_SetState()..........................................................................................................................568
List_FormatBoolean() .......................................................................................................................569
List_FormatCurrency().....................................................................................................................570
List_FormatDate() .............................................................................................................................571
List_FormatInteger().........................................................................................................................572
List_FormatPhone() ..........................................................................................................................573
List_FormatQuantity() .....................................................................................................................574
List_FormatString()...........................................................................................................................575
List_FormatTime() ............................................................................................................................576
List_GetIDsForCoreCommand .......................................................................................................577
List_MultiSelectActionCompleteEvent .........................................................................................579
List_Open ...........................................................................................................................................580
List_RegisterAction()........................................................................................................................582
List_RegisterGroup() ........................................................................................................................583
List_SetFactBoxParameter ...............................................................................................................584
RegisterListNavigationCommand()...............................................................................................585
XMLDoc_AddColumn .....................................................................................................................586
XMLDoc_AddHeaderField .............................................................................................................587
XMLDoc_AddLineItem ...................................................................................................................588
XMLDoc_AddLineItemValue .........................................................................................................589
XMLDoc_Create ................................................................................................................................590
x IN T E G R A T I O N G U I D E
C O N T E N T S
XMLDoc_Save ...................................................................................................................................593
Menu scripts..............................................................................................................................................595
AddCommandToMenu() .................................................................................................................596
AddNavBarButton() .........................................................................................................................598
AlreadyExistsOnMenu() ..................................................................................................................600
FindCommandInMenu()..................................................................................................................601
MenusExistForProduct()..................................................................................................................602
Report scripts ............................................................................................................................................603
syImportReportTemplate() ..............................................................................................................604
syRemoveReportTemplate() ............................................................................................................606
Security scripts .........................................................................................................................................607
AddSecurityTaskOperation() ..........................................................................................................608
AddTaskToRole() .............................................................................................................................. 611
CreateSecurityRole().........................................................................................................................612
CreateSecurityTask().........................................................................................................................613
DeleteSecurityForProduct().............................................................................................................614
Exists() -- Security Role ....................................................................................................................615
Exists() -- Security Task ....................................................................................................................616
Exists() -- Security Task Operation .................................................................................................617
Exists() -- Security Task Role ...........................................................................................................619
GetValidSystemPassword() .............................................................................................................620
LoadListView.....................................................................................................................................621
Security() ............................................................................................................................................622
SetIndex ..............................................................................................................................................623
syUserInRole()...................................................................................................................................626
Shortcut scripts.........................................................................................................................................627
ScBar_AddDexForm() ......................................................................................................................628
ScBar_AddExternalFile()..................................................................................................................629
ScBar_AddFolder() ...........................................................................................................................630
ScBar_AddMacro()............................................................................................................................631
ScBar_AddUrl() .................................................................................................................................632
ScBar_ItemExists ...............................................................................................................................633
Setup Checklist scripts ...........................................................................................................................635
AddSetupChecklistItem() ................................................................................................................636
FindSetupChecklistItem() ................................................................................................................639
SmartList scripts.......................................................................................................................................641
Explorer_Add_Column_To_Object ................................................................................................642
Explorer_Add_GoTo_Item...............................................................................................................645
Explorer_Add_Object.......................................................................................................................647
Explorer_AddItem_To_ListView ....................................................................................................648
Explorer_Add_SubItem_To_ListView ...........................................................................................651
Explorer_Check_Stop_Processing ..................................................................................................652
Explorer_Remove_Column_From_Object ....................................................................................654
Explorer_Remove_GoTo_Item ........................................................................................................655
Explorer_Remove_Object ................................................................................................................656
Explorer_Search_Generic.................................................................................................................657
Explorer_Set_SQL_Join_Info ...........................................................................................................661
Explorer_Set_SQL_Query_Field .....................................................................................................663
Explorer_SQL_Search_Generic .......................................................................................................664
SQL scripts ................................................................................................................................................667
GrantAccess() ....................................................................................................................................668
SQL_GetConnection() ......................................................................................................................669
Toolbar scripts ..........................................................................................................................................671
AddCommandBar()..........................................................................................................................672
INTEGRATION GUIDE xi
C O N T E N T S
AddCommandToCmdBar().............................................................................................................674
ButtonsExistForProduct() ................................................................................................................676
CmdBarIsVisible().............................................................................................................................677
ExistsForUserID()..............................................................................................................................678
FindCommandInCmdList().............................................................................................................679
ToggleCommandBar() ......................................................................................................................680
Unified Communications scripts..........................................................................................................681
Activate...............................................................................................................................................682
GatherSIP().........................................................................................................................................683
Register...............................................................................................................................................684
Unregister...........................................................................................................................................686
xii IN T E G R A T I O N G U I D E
INTRODUCTION
Introduction
The Integration Guide provides information about developing Microsoft® Dexterity
applications that integrate with Microsoft Dynamics™ GP. You should be familiar
with creating Dexterity applications before using the information in this manual.
Refer to the Dexterity Quick Start, Dexterity Programmer’s Guide, SanScript
Reference and Function Library Reference manuals for additional information
about resources and sanScript commands described in this manual.
You may use and modify the scripts and resources in the sample integrating application for
use in your own applications, but we make no warranties regarding the sample dictionary,
including any warranties of merchantability or fitness for a particular purpose.
• Part 3, Object Triggers, explains how to use and implement form, focus, data-
base and procedure triggers in an integrating application.
• Part 4, Window Elements, explains the conventions used for window compo-
nents, such as lookups, zooms and notes. Use the information provided to cre-
ate applications that look and function like Microsoft Dynamics GP.
• Part 6, Lists, explains how to implement lists for your integration, or add func-
tionality to existing Microsoft Dynamics GP lists.
• Part 9, Packaging Your Application, explains the process used to build, pack-
age, install and update an integrating application.
• Part 10, Windows Installer, describes how to create an installer for your
Microsoft Dynamics GP integration.
• Part 11, Script Reference, provides detailed descriptions for the procedures and
functions you will use to implement core functionality in your integration.
2 IN T E G R A T I O N G U I D E
IN T RO D U C T IO N
Symbol Description
➥ of table Items; A continuation character indicates that a script
continued from one line to the next should be typed as
one line in the Script Editor.
The light bulb symbol indicates helpful tips, shortcuts
and suggestions.
Margin notes summa- Margin notes call attention to critical information. and
rize important informa- direct you to other areas of the documentation where a
tion. topic is explained.
Convention Description
Part 2, Object Triggers Bold type indicates a part name.
Chapter 3, “Reports” Quotation marks indicate a chapter name.
Using the Modifier Italicized type indicates a section name.
set 'l_Item' to 1; This font is used for script examples.
RUNTIME.EXE Words in uppercase indicate a file name.
Software Development Acronyms are spelled out the first time they’re used.
Kit (SDK)
TAB or ALT+M Small capital letters indicate a key or a key sequence.
INTEGRATION GUIDE 3
4 IN T E G R A T I O N G U I D E
PART 1: INTEGRATION BASICS
Part 1: Integration Basics
This portion of the documentation provides an overview of creating an integration
for Microsoft Dynamics GP. The following topics are discussed:
6 IN T E G R A T I O N G U I D E
Chapter 1: Developing Integrations
Before you begin, it’s important to understand what types of integrations you can
make and what the basic process is for creating them. Information about developing
integrations is divided into the following sections:
• Types of integrations
• Multidictionary environment
• Development process
• Using a product ID
• Determining the current product
• Creating a development folder
• Preparing for test mode
• Source Code Control
Types of integrations
For additional Typically, you will develop applications that contain vertical enhancements,
information about customizations to functionality in the accounting system, or a combination of both.
creating new or
customized forms and Vertical enhancements
reports, refer to The most common type of development involves creating new forms and reports
Chapter 3, “Forms,” that add new functionality to the accounting system. This type of development
and Chapter 5, allows you to create custom vertical applications not already provided by the core
“Reports.” application.
Vertical enhancements allow you to tie your application into existing functionality
by re-using resources from the main product dictionary. For example, the Lead
Maintenance form in the sample integrating application uses lookup, note, save,
delete and clear buttons. This form also uses the RM_Salesperson_MSTR table, and
uses the Salesperson lookup form provided by the main dictionary.
Customizations
This type of development involves the direct customization of existing forms and
reports in the main product dictionary. Common customizations include adding
new fields to a form or report, or new menus or tables to a form. Direct
customizations allow you to offer features or reporting capabilities not already
provided in existing forms and reports.
Refer to Part 3, Object Although delivering customized forms and reports can be a very valuable part of your
Triggers, for more product offering, be aware that you must redo any customizations to forms and reports with
information about each Microsoft Dynamics GP update. If your primary focus is customizations, we
using triggers. recommend that you use object triggers in your application. Triggers reduce the number of
customizations to forms in the main product dictionary, reducing the impact of maintenance
updates on your application.
Multidictionary environment
The multidictionary feature supported by the Dexterity runtime engine allows your
application to seamlessly integrate with Microsoft Dynamics GP. Multidictionary
allows the runtime environment to recognize separate application dictionaries and
run them as one integrated application. When you develop an integrating
application and deliver it to customers, it must operate in this multidictionary
environment.
INTEGRATION GUIDE 7
PA RT 1 I N T E G R A T I O N B A S I C S
2
0
Microsoft Dynamics GP
3333
Sample Integrating App.
Windows
:C:Dynamics GP/Dynamics.dic
:C:Dynamics GP/Data/Forms.dic
:C:Dynamics GP/Data/Reports.dic
:C:Dynamics GP/Develop.dic
:C:Dynamics GP/Data/F3333.DIC
:C:Dynamics GP/Data/R3333.DIC
Refer to Chapter 58, Each line in the launch file contains information necessary for the runtime engine to
“Using Launch Files,” run the various dictionaries that make up the complete application. When you
in Volume 1 of the install one or more integrating applications, you add additional information to the
Dexterity launch file that allows the additional dictionary to work in the multidictionary
Programmer’s Guide environment.
for more information
about launch files. The following illustration shows how you would configure a launch file to launch
Microsoft Dynamics GP and the Sample Integrating Application included with
Dexterity:
8 IN T E G R A T I O N G U I D E
C H A P T E R 1 DE V E LO P I N G IN T E G R A T IO N S
Development process
The development process for an integration begins by creating your application
directly in the main product dictionary (Dynamics.dic). This allows you to add new
resources, such as new forms and reports, use existing resources in the main
product dictionary, such as data types and fields, and customize existing forms and
reports. Once you’ve completed your application development, you’ll package your
application using Dexterity Utilities, then deliver the application to customers.
Create new or use Build your application using Package and ship
existing resources in Dexterity Utilities to extract your application
the Dynamics resources with IDs of 22,000 or dictionary.
dictionary. This is greater, and transfer alternate
called the development forms and reports..
dictionary.
Dexterity App.cnk
App.dic
This checklist provides the steps required to develop an application that integrates
in a multidictionary environment. Each step describes a phase in your application’s
development, and provides instructions for finding additional information about
each phase.
Be sure to make a backup of the Dynamics dictionary prior to starting your application
development.
INTEGRATION GUIDE 9
PA RT 1 I N T E G R A T I O N B A S I C S
You will also want to test your completed application in a multidictionary environment.
Using a product ID
Each integrating product must have its own unique product ID. You will use the
product ID in several places throughout the code for your integration. We
recommend that you create a constant for the product ID, rather than hard-coding
the product ID into scripts. For example, the sample integrating application uses the
following constant for the product ID:
IG_PROD_ID 3333
Using a constant allows you to easily change the product ID if needed. It also allows
you to begin coding if you haven’t yet requested a product ID from Microsoft.
10 IN T E G R AT I O N G U ID E
C H A P T E R 1 DE V E LO P I N G IN T E G R A T IO N S
• It keeps the core dictionary for the Microsoft Dynamics GP installation in its
original state, which is important for testing your integration in a runtime
setting.
• The additional files generated, such as Resource Explorer temporary files and
reference information files won’t clutter the application installation folder.
• The path for accessing the development folder can be much simpler. For
example, C:\Develop.
• Build operations, such as creating a dictionary chunk for your integration, can
be performed in the development folder.
Keep in mind that several features in the accounting system won’t be available
when you run in test mode. Test mode has no support for the multidictionary
architecture, so common features like SmartList won’t be available. It’s important
that you thoroughly test your integration in a multidictionary runtime
environment. Code that works in test mode can operate differently when used with
the runtime engine.
To allow running in test mode, you may need to write two versions of specific
sections of sanScript code. One version will be designed to run in test mode, and the
other will be designed to work with the runtime engine. You can use the following
code to determine whether code is being executed in test mode or with the runtime
engine:
INTEGRATION GUIDE 11
PA RT 1 I N T E G R A T I O N B A S I C S
• Resources for the integration are much easier to manage, because only new or
modified resources are stored in the source code control repository.
• It’s much easier to upgrade your integration to work with new releases of the
core product. Source code control is an essential part of the upgrade process.
You will learn about the upgrade process in Chapter 43, “Updating an
Application.”
To learn more about using Source Code Control when creating an integration for
Microsoft Dynamics GP, refer to Chapter 55, “Source Code Control for Integrating
Applications,” in Volume 1 of the Dexterity Programmer’s Guide.
12 IN T E G R AT I O N G U ID E
Chapter 2: Sample Integration
The sample integrating application (Develop.cnk) available with Dexterity
illustrates many of the concepts needed while developing an integrating application
for Microsoft Dynamics GP. Information about the sample integration is divided
into the following sections:
• Sample overview
• Installing the sample
• Using the sample source code
Sample overview
The sample application includes source code for a sample maintenance form, a
sample trigger form, and a sample inquiry form. The sample also includes a card
list, a transaction list, and a report list integration. The sample also shows how to
implement the various forms of navigation, such as menus and toolbars.
INTEGRATION GUIDE 13
PA RT 1 I N T E G R A T I O N B A S I C S
14 IN T E G R AT I O N G U ID E
C H A P T E R 2 SA MP LE I N TE GRA T ION
The Leads Report Options window is used to create and modify the report options
for the various Leads reports. This window is also accessed from the Report List in
Microsoft Dynamics GP.
Sample SmartList
The sample application for Microsoft Dynamics GP creates a new SmartList object
that displays Lead information.
INTEGRATION GUIDE 15
PA RT 1 I N T E G R A T I O N B A S I C S
16 IN T E G R AT I O N G U ID E
C H A P T E R 2 SA MP LE I N TE GRA T ION
Sample reports
The sample application provide examples of reports, and shows how they can be
run from within the application.
Navigation
The sample integrating application uses the standard forms of navigation in
Microsoft Dynamics GP, such as Area Pages, menus, and toolbars. The following
illustration shows the Leads item that was added to the Sales Area Page.
INTEGRATION GUIDE 17
PA RT 1 I N T E G R A T I O N B A S I C S
This toolbar is added by the sample integrating application for Microsoft Dynamics
GP, and allows access to windows provided by the sample.
Installing
To install the sample integrating application, complete the following steps:
Item Navigation
Lead Maintenance Cards >> Sales >> Leads
Lead Inquiry Inquiry >> Sales >> Leads
Leads Reports Reports >> IG Sample >> Leads
Leads List View >> Sales Lists >> Leads
Contact History Cards >> Sales >> Customer
Selection from the Extras >> Additional submenu.
Contact History Setup Tools >> Setup >> Sales >> Contact History
Contact History List View >> Sales Lists >> Contact History
18 IN T E G R AT I O N G U ID E
C H A P T E R 2 SA MP LE I N TE GRA T ION
To run the macro, choose Microsoft Dynamics GP >> Tools >> Macro >> Play. Select
the IG_Sample_Data.mac macro file, located in the Develop folder of the Samples
folder of your Dexterity installation.
INTEGRATION GUIDE 19
PA RT 1 I N T E G R A T I O N B A S I C S
6. Assign a company.
In the Company Assignment window, mark the company that you want to use
the template with.
Click Save.
20 IN T E G R AT I O N G U ID E
C H A P T E R 2 SA MP LE I N TE GRA T ION
When you specify the report destination for either the IG_Leads report or the
IG_Leads_List report, you will see Template listed as an available report type.
INTEGRATION GUIDE 21
PA RT 1 I N T E G R A T I O N B A S I C S
Do not transfer the contents of the sample application to your current development
dictionary. The update process will replace existing resources with IDs at and above 22,000
with resources in the sample application dictionary. Use only a copy of an unmodified
Microsoft Dynamics GP dictionary.
22 IN T E G R AT I O N G U ID E
PART 2: INTEGRATION COMPONENTS
Part 2: Integration Components
This portion of the Integration Guide explains how to work with standard resources
for your integrating application. The follolwing topics are discussed:
• Chapter 4, “Tables,” explains how to use tables in Microsoft Dynamics GP, and
contains standards for using and maintaining tables.
24 IN T E G R AT I O N G U ID E
Chapter 3: Forms
There are two primary ways you implement forms in your development dictionary;
you can create new forms, or you can create alternate forms by changing Microsoft
Dynamics GP forms directly. Information about forms is divided into the following
sections:
• New forms
• Alternate forms
• Using the Modifier
• Controlling form access
New forms
You can create new forms directly in your development dictionary, and re-use
existing resources from the Dynamics.dic dictionary in these forms. For example,
the sample application’s Lead Maintenance form re-uses resources, including the
RM_Salesperson_Lookup form, the Salesperson ID field, and various window
controls, such as the Save, Clear, and Delete buttons, and the note and padlock
buttons.
INTEGRATION GUIDE 25
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
In test mode, access new forms using one of the following methods:
• Shortcut Bar item – A shortcut bar item provides navigation to any form in the
development dictionary (except forms in the System series). You can add new
forms from the development dictionary to the Shortcut Bar in exactly the same
manner as Microsoft Dynamics GP forms.
Once installed, access your application’s forms by adding them to the Shortcut Bar.
If you’re using a form trigger, display the form that allows you to activate the form
trigger.
26 IN T E G R AT I O N G U ID E
C H A P T E R 3 F O R M S
Alternate forms
An alternate form is a Microsoft Dynamics GP form you customize, then deliver with
your integrating application. After the user installs your product, they can use
system security to access the alternate form instead of the original. There are several
types of customizations you may choose to make:
It’s important that you do not change existing functionality on the form. This
includes removing an existing field from the form, or altering the way in which the
accounting system processes information in the form.
Scripts
You cannot modify existing field, window or form scripts, but you can attach a
script to a focus event (a pre, change or post event) that Microsoft Dynamics GP
isn’t using. However, there is a danger that the focus event will be used in future
releases. This would inhibit your script from running once you’ve installed your
application.
We recommend that you use a focus trigger rather than applying a script directly to a
Microsoft Dynamics GP field. Maintenance updates have no effect on triggers.
INTEGRATION GUIDE 27
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
Object triggers are especially useful when tracking additional data in a Microsoft
Dynamics GP form. For instance, a third-party developer added two fields to track
lead information in the RM_Salesperson form, like the following illustration:
Additional third-party
fields.
In this case, the third-party developer delivers the entire alternate form as part of the
extracted third-party dictionary. With a form trigger, the third-party developer can
attach the same functionality to the form without modifying the form directly. The
form trigger adds an item to the Additional menu, where the user can access one or
more third-party forms related to the Microsoft Dynamics GP form:
28 IN T E G R AT I O N G U ID E
C H A P T E R 3 F O R M S
By using the form trigger rather than delivering an alternate form, the original form
remains available to the user, and updates won’t affect your integration.
In the main dictionary, users can modify forms as they normally would. In the third-
party dictionary, users can modify either new forms or alternate forms.
INTEGRATION GUIDE 29
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
2
0
Microsoft Dynamics GP
3333
Sample Integrating App.
Windows
:C:Dynamics GP/Dynamics.dic
:C:Dynamics GP/Data/Forms.dic
:C:Dynamics GP/Data/Reports.dic
This generic pathname in
:C:Dynamics GP/Develop.dic
the launch file specifies
the name and location of
:C:Dynamics GP/Data/F3333.DIC
the forms dictionary. :C:Dynamics GP/Data/R3333.DIC
The default location of the forms dictionary is the same location as your application
dictionary. A user can change the location of the forms dictionary using the Edit
Launch File window in Microsoft Dynamics GP. This window shows all
applications appearing in a multidictionary environment, and allows the user to
change the location of the forms or reports dictionaries:
For instance, changing the location of the forms dictionary to a network location
allows multiple users to share a single forms dictionary across a network.
If you change the path for your forms dictionary, be sure to move an existing forms
dictionary to that location. Otherwise, the runtime engine will attempt to create a new forms
dictionary the next time a user accesses the Modifier.
30 IN T E G R AT I O N G U ID E
C H A P T E R 3 F O R M S
Refer to the system documentation for Microsoft Dynamics GP for details about
using this window to control access to forms.
INTEGRATION GUIDE 31
32 IN T E G R AT I O N G U ID E
Chapter 4: Tables
Refer to Chapter 9, You can create tables in your development dictionary using any of the Microsoft
“Tables,” in the Volume Dynamics GP fields. In addition, you can read, write, delete or update existing
1 of the Dexterity records in Microsoft Dynamics GP tables. However, you cannot modify existing
Programmer’s Guide table definition in any way, including changing keys, adding fields, or changing
for information about names. The following sections explain the methods you should use when creating
creating tables. the tables for your integration:
• Designing tables
• Creating SQL tables
• Granting SQL access privileges
• Assigning default values to columns
• Working with SQL Server™
• Storing account numbers
• Pathnames
Designing tables
In many types of integrations, you’ll want to associate records in your application
with records in the accounting system. For instance, you may want to track
additional contact information for a customer record in a third-party table. To do
this, you could create a table that includes new fields you’ve created in your
development dictionary, as well as one or more of the RM_Customer_MSTR table’s
key values.
Salesperson
Using the key values from the customer record, you can retrieve the corresponding
contacts record. This is especially important when Microsoft Dynamics GP
performs actions with the customer record (such as deleting the record or creating a
new one), and you want to perform similar actions to the corresponding customer
contact record. This is necessary to maintain referential integrity between a third-
party record and a related record in the accounting system. Object triggers provide
the best means for implementing referential integrity in your application.
INTEGRATION GUIDE 33
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
The following illustration shows how deleting a customer record triggers the
deletion of a related customer contacts record in the third-party table:
RM_Customer_MSTR
Customer Number AARONFIT001
Customer Name Aaron Fitz Electrical
Address 1 One Microsoft Way
Address 2
Phone 1 4255550101
The delete operation Phone 2
You can specify the type of database action (read, read lock, add, update or delete)
that you want a database trigger to respond to using the
Trigger_RegisterDatabase() function.
{Name: Startup}
local integer l_result;
34 IN T E G R AT I O N G U ID E
C H A P T E R 4 T A B LE S
When the delete operation occurs, the trigger passes the contents of the deleted
table buffer as an inout parameter to the trigger processing procedure, as shown
below. The trigger processing procedure then sets key values from the
RM_Customer_MSTR table buffer and deletes the contact history record that
corresponds to the deleted RM_Customer_MSTR record.
{Name: IG_Trigger_Delete_Contact_History}
inout table RM_Customer_MSTR;
• You must be logged into SQL, or an additional SQL Login dialog will be
displayed when the tables are created.
• The current SQL user must have create permissions, or an error will occur when
tables are created.
To resolve these issues, the sample integrating application creates SQL tables for the
current company, only after the user has logged into the system as “DYNSA” or
“sa”. This ensures that the no additional login dialog is displayed, and that no
creation errors will occur since the administrator always has create privileges. Refer
to Database security on page 407 for more information.
The following focus trigger is used to create SQL tables for the sample integrating
application.
The trigger is activated only after the user has logged into a company and to the
appropriate SQL database. This prevents the additional login dialog from being
displayed.
INTEGRATION GUIDE 35
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
The following code is the trigger processing procedure that creates the SQL tables.
The procedure uses a helper procedure that creates the table and then grants access
to the table and the table’s stored procedures. This is described in following section,
Granting SQL access privileges. It also calls another helper procedure to bind default
values to the columns in each of the tables created. This is described in Assigning
default values to columns.
call IG_BindSQLDefaults;
end if;
end if;
To grant access privileges to the DYNGRP group, you will call a special function in
the Dynamics.dic dictionary. The GrantAccess() function is part of the SQL
Maintenance form in Dynamics.dic. The function can grant access to the table and
also to the auto-generated stored procedures for the table. The following example
shows how this function could be used to grant access to the IG_Leads_MSTR table
and its auto-generated stored procedures.
36 IN T E G R AT I O N G U ID E
C H A P T E R 4 T A B LE S
Microsoft Dynamics GP defines the following default values that can be used for
columns in your integration’s tables.
Default Description
GPS_CHAR Used for string and text fields
GPS_DATE Used for date fields
GPS_INT Used for integer fields
GPS_MONEY Used for currency fields
To apply default values to columns, you can use pass-through SQL. The
sp_bindefault stored procedure allows you to bind a default value to a column. For
example, the following code from the sample integration shows the pass-through
SQL used to assign default values to the columns for the
IG_Contact_History_MSTR table. This code must be run by a user who is the
database owner, such as “sa” or “DYNSA”. Otherwise, the procedure won’t have
sufficient privileges to bind defaults to the columns.
local string database;
local long SQL_connection, status;
local text SQL_Statements;
INTEGRATION GUIDE 37
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
Database names
You may need to retrieve the names of the system database, or of specific company
databases. To retrieve the name of the system database (the database that contains
the core accounting system tables) use the following code:
To retrieve the name of the database for the current company, you can use the
Intercompany ID global variable. This variable is automatically set to the name of
the database for the current company.
Pass-through SQL
For some aspects of your integration, you may need to use pass-through SQL. Pass-
through SQL requires an additional connection to the SQL server when being
executed. To make managing these pass-through connections easier, Microsoft
Dynamics GP provides an infrascture for these connections. The
SQL_GetConnection() function is used to retrieve a pass-through SQL connection
from Microsoft Dynamics GP. Using a connection maintained by the core
application is much more efficient than opening a separate pass-through connection
for your integration.
If you use the account number directly in your table, and the user changes the account
number structure, you will need to convert data in that table.
The Account Index field uniquely identifies each account. This index provides a
reference that you can use to retrieve and display the actual account number,
regardless of its format. There are two primary tables that store account numbers
and their corresponding indexes:
• The GL_Account_MSTR table stores account numbers, their indexes and all
additional information about the account number, such as the account
description.
38 IN T E G R AT I O N G U ID E
C H A P T E R 4 T A B LE S
In Microsoft Dynamics GP, the account number indexes are consecutive integers
that start at 1. When an account number is deleted, its index is no longer used.
When a new account is added, an index for the account is reserved at the end of the
index sequence.
Field Description
Project ID The key for the third-party table.
Phase A third-party field for tracking project phase information.
Detail A third-party field for tracking project detail information.
Account Index A global field. This field is also an invisible window field on the third-party
form.
The third-party form uses the GL_Account_MSTR table, as well as the third-party’s
IG_Project_MSTR table. The following illustration shows the Project Accounts
window in the third-party form.
The following steps explain how to display account information using the account
index.
INTEGRATION GUIDE 39
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
40 IN T E G R AT I O N G U ID E
C H A P T E R 4 T A B LE S
Pathnames
A new table you create will be stored in the appropriate database, based on the table
series you specified for the table in Dexterity. For series values such as Sales or
Financial, your third-party table will be accessed in each company database set up
in the accounting system. If you specify System as the series, your third-party table
will be accessed in the DYNAMICS database.
If you want your tables to be accessed from some other location, you must add the
tables to table groups. Then you can add records to the SY_Pathnames table
(SY02100) to specify the locations for third-party tables. An alternative to adding
records through code is to use the Pathnames window in Microsoft Dynamics GP to
specify pathnames for third-party tables. The following illustration shows this
window:
The Pathnames window is not directly accessible in Microsoft Dynamics GP. You must add
it as a shortcut so that it can be accessed from the Navigation pane.
Depending upon how you want to organize your application’s table groups, use the
following guidelines:
• Use a table group with a single table if you want to change pathnames for that
table alone. Microsoft Dynamics GP supports pathnames only if the table is part
of a table group.
• Use a table group with multiple tables to change pathnames for all tables in the
group. For instance, a group of tables that individually store invoicing header,
line item and summary information should be part of a single invoicing table
group. When you change pathnames for the table group, Microsoft Dynamics
GP will look for these three tables in the same location.
You cannot add a third-party table to an existing Microsoft Dynamics GP table group, nor
can you add a Microsoft Dynamics GP table to a third-party group.
INTEGRATION GUIDE 41
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
Setting pathnames
To change the location of your application’s data, use the Pathnames window. This
window writes pathname records to the SY_Pathnames table (SY02100). When the
SQLPath procedure in the accounting system runs, it checks the SY_Pathnames
table for a pathname based upon the company ID, product ID and series for the
table group being accessed. It then performs the table operation using that path.
42 IN T E G R AT I O N G U ID E
Chapter 5: Reports
You can develop either new reports in your development dictionary or customize
existing reports. However, if you need to customize an existing report directly, you
will face a few development issues. Information about reports is divided into the
following sections:
• Alternate reports
• Creating an alternate report
• Using the runtime Report Writer
• Controlling report access
• Report Writer functions to access report data
• Report writer function examples
• Report Writer function reference
• Word templates for reports
Alternate reports
You’ll need to customize a Microsoft Dynamics GP report if you want to change the
report directly, either by adding fields from one or more third-party tables, or by
changing report table relationships to include third-party tables.
Once you customize the Microsoft Dynamics GP report, use Dexterity Utilities to
transfer it to your extracted dictionary. Like alternate forms, you can then deliver
the alternate report to customers, where it takes the place of the original report. The
following RM Customer Report uses third-party fields from a third-party table
(IG_Contact_History_MSTR) for tracking contact history information.
RM Customer Report
Additional third-party
fields.
INTEGRATION GUIDE 43
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
You cannot directly customize Microsoft Dynamics GP reports that use a temporary table as
the main table. Instead, you must the technique described in Report Writer functions to
access report data on page 49 to make third-party data available to the report.
The following procedure uses components of this sample report to illustrate how to
set up an alternate report.
Open your development dictionary using Dexterity and display the report
definition for the report you’re customizing.
44 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
Once you’ve defined the relationship for the duplicate table and original table,
define additional relationships between the duplicate table and any third-party
tables you want to add to the relationship.
INTEGRATION GUIDE 45
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
After you’ve noted the report table relationships, close the Report Table
Relationships window.
6. Switch the main table for the report to the duplicate table.
In the Report Definition window, switch the main table for the report from the
original table to the duplicate table. A message will appear asking whether you
want to change the main table. Click OK. For the sample alternate report, the
duplicate table (IG_Customer_MSTR) replaces the original main table
(RM_Customer_MSTR).
• RM Customer MSTR
• Customer Master Summary
• RM Period Setup
• RM Customer/Class Report TEMP
• Customer Statements E-mail Addresses Temp
• User Language Master
In addition, create new report table relationships for any third-party table(s)
you related to the duplicate table in step 4. In the sample alternate report, a new
report table relationship for the third-party table IG_Contact_History_MSTR
exists for the RM Customer Report. When finished, the report table
relationships for the sample RM Customer Report look like the following:
Once you’ve created the report table relationships, close the Report Table
Relationships window.
Once you’ve made all your changes, test the report in a test mode environment. To
do this, simply print the report as you normally would. To test the report in a
multidictionary environment, follow the instructions in the following section.
46 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
In the main dictionary (Dynamics.dic), users can modify reports, or create new
reports as they normally would. In the third-party dictionary, users can modify a
new third-party report, create a new report, or modify an alternate report you’ve
delivered.
2
0
Microsoft Dynamics GP
3333
Sample Integrating App.
Windows
:C:Dynamics GP/Dynamics.dic
:C:Dynamics GP/Data/Forms.dic
:C:Dynamics GP/Data/Reports.dic
This generic pathname in
:C:Dynamics GP/Develop.dic
the launch file specifies
the name and location of
:C:Dynamics GP/Data/F3333.DIC
the reports dictionary. :C:Dynamics GP/Data/R3333.DIC
INTEGRATION GUIDE 47
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
The default location of the reports dictionary is the same location as your
application dictionary. However, a user can change the location of your
application’s reports dictionary using the Edit Launch File window in Microsoft
Dynamics GP. This window shows all applications appearing in a multidictionary
environment, and allows the user to change the location of the forms or reports
dictionaries.
For instance, changing the location of the reports dictionary to a network location or
shared drive allows multiple users to share a single forms dictionary across a
network.
If you change the path for your reports dictionary, be sure to move an existing reports
dictionary to that location. Otherwise, the runtime engine will attempt to create a new
reports dictionary the next time a user accesses the Report Writer.
48 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
Refer to the system documentation for Microsoft Dynamics GP for details about
using this window to control access to reports.
• Only one version of an alternate report can be used at a time. This prevents
additions from multiple third-party applications from appearing on the same
report. This situation often occurs for Purchase Order Processing and Sales
Order Processing reports.
• The user may have already made extensive customizations to the main report.
They would need to re-create these customizations for the alternate report.
• rw_TableHeaderCurrency()
• rw_TableHeaderString()
• rw_TableLineCurrency()
• rw_TableLineString()
• rw_ReportStart()
• rw_ReportEnd()
Within the Report Writer, end-users can create a calculated field that calls one of
these predefined Report Writer functions, passes in the appropriate parameters to
the function, and displays a piece of data from the third-party integration.
INTEGRATION GUIDE 49
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
The set of predefined Report Writer functions was originally designed to provide
access to third-party Sales Order Processing (SOP) and Purchase Order Processing
(POP) data. The functions can be used to retrieve data for any other reports, but
some of the parameters for the functions won’t be used.
The following is the trigger processing function that runs in response to this
function trigger. This function will access the IG_Contact_History_MSTR table,
retrieving the contact history information for the specified customer. The ID of the
customer must be passed in through the sNumber parameter. The data item to be
retrieved is specified by the iControl parameter.
50 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
in integer Dict_ID;
in string Report_Name;
in string sNumber;
in integer sType;
in integer iControl;
The remaining work must be performed by the Report Writer user. A new
calculated field must be created for the report that will access the contact history
data. This calculated field will call the rw_TableHeaderString() Report Writer
function, supplying the appropriate parameters to indicate which data to retrieve.
For instance, to retrieve the “Last Contact Date” value, the following calculated
expression would be used:
Notice that the product ID for the sample integration (3333) is passed in, along with
the report’s name, the ID of the customer for which information is being retrieved,
and the control value 3 to indicate to the processing procedure that the last contact
date is to be returned.
Once the calculated field is complete, it can be placed on the report. When the report
is run, the trigger will be activated, and the trigger processing procedure will
retrieve the appropriate contact history information.
INTEGRATION GUIDE 51
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
These two items can all be returned as string values, and are line items, so the
rw_TableLineString() Report Writer function will be used to retrieve them. A
function trigger like the following function would need to be registered:
The following is the trigger processing function that runs in response to this
function trigger.
in integer dict_id;
in string report_name;
in string sNumber;
in integer sType;
in currency cSequenceOne;
in currency cSequenceTwo;
in integer iControl;
52 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
The remaining work must be performed by the Report Writer user. For instance, the
additional SOP data might be added to the SOP Blank Invoice Form. To identify a
specific line in the sales document, the Component Sequence and Line Item
Sequence values from the Sales Transaction Amounts Work table are used. These
values are stored as long integers. The rw_TableLineString() function is expecting
these values to be currencies, so two calculated fields must be created to convert the
long integer values to currencies. For example, the calculated field expression for a
new LineItemSequence calculated field would be:
An additional calculated field must be created for the report that will access the SOP
shipping weight and vendor data. This calculated field will call the
rw_TableLineString() Report Writer function, supplying the appropriate
parameters to indicate which data to retrieve. For instance, to retrieve the shipping
weight value, the following calculated expression would be used:
Notice that the product ID of the dictionary registering the function trigger (in this
example 3333) is passed in, along with the report’s name, the document number
and document type, the calculated fields for the component sequence and line item
sequence, and the control value 1 indicating to the processing procedure that the
shipping weight is to be returned.
Once the calculated field is complete, it can be placed on the report. When the report
is run, the trigger will be activated, and the trigger processing procedure will
retrieve the appropriate SOP line item information.
INTEGRATION GUIDE 53
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
rw_TableHeaderCurrency()
This function returns a currency amount or integer value to the calculated field. It
can be used in the header or body of a report. The function has the following
parameters:
in integer Dict_ID;
in string Report_Name;
in string sNumber;
in integer sType;
in integer iControl;
Dict_ID – An integer specifying the dictionary ID of the product that must process
the request for data. The trigger processing function must check this parameter to
determine whether it should process the request.
Report_Name – A string containing the name of the report on which the calculated
field will be used. You may not need to use this parameter. If it’s not needed, an
empty string should be supplied when creating the calculated field.
sNumber – A string that will typically contain the ID of the transaction or other item
for which additional information is being retrieved. For example, this may be the
SOP Number.
iControl – An integer that is used to indicate which piece of data to return. The
trigger processing procedure will examine this parameter to determine which data
to retrieve and return.
rw_TableHeaderString()
This function returns a string value to the calculated field. It can be used in the
header or body of a report. The function has the following parameters:
in integer Dict_ID;
in string Report_Name;
in string sNumber;
in integer sType;
in integer iControl;
Dict_ID – An integer specifying the dictionary ID of the product that must process
the request for data. The trigger processing function must check this parameter to
determine whether it should process the request.
54 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
Report_Name – A string containing the name of the report on which the calculated
field will be used. You may not need to use this parameter. If it’s not needed, an
empty string should be supplied when creating the calculated field.
sNumber – A string that will typically contain the ID of the transaction or other item
for which additional information is being retrieved. For example, this may be the
SOP Number.
iControl – An integer that is used to indicate which piece of data to return. The
trigger processing procedure will examine this parameter to determine which data
to retrieve and return.
rw_TableLineCurrency()
This function returns a currency amount or integer value to the calculated field. It is
typically used in the line items (additional header sections) of a report. The function
has the following parameters:
in integer Dict_ID;
in string Report_Name;
in string sNumber;
in integer sType;
in currency cSequenceOne;
in currency cSequenceTwo;
in integer iControl;
Dict_ID – An integer specifying the dictionary ID of the product that must process
the request for data. The trigger processing function must check this parameter to
determine whether it should process the request.
Report_Name – A string containing the name of the report on which the calculated
field will be used. You may not need to use this parameter. If it’s not needed, an
empty string should be supplied when creating the calculated field.
sNumber – A string that will typically contain the ID of the transaction or other item
for which additional information is being retrieved. For example, this may be the
SOP Number.
cSequenceOne – A currency value typically used to identify the line item for which
additional data is being retrieved. For typical SOP integrations, this will be the
Component Sequence field. For typical POP integrations, this will be the Break Field
1 field.
cSequenceTwo – A currency value typically used to identify the line item for which
additional data is being retrieved. For typical SOP integrations, this will be the Line
Item Sequence field. For typical POP integrations, this parameter can remain empty.
iControl – An integer that is used to indicate which piece of data to return. The
trigger processing procedure will examine this parameter to determine which data
to retrieve and return.
INTEGRATION GUIDE 55
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
rw_TableLineString()
This function returns a string value to the calculated field. It is typically used in the
line items (additional header sections) of a report. The function has the following
parameters:
function returns string sData;
in integer Dict_ID;
in string Report_Name;
in string sNumber;
in integer sType;
in currency cSequenceOne;
in currency cSequenceTwo;
in integer iControl;
Dict_ID – An integer specifying the dictionary ID of the product that must process
the request for data. The trigger processing function must check this parameter to
determine whether it should process the request.
Report_Name – A string containing the name of the report on which the calculated
field will be used. You may not need to use this parameter. If it’s not needed, an
empty string should be supplied when creating the calculated field.
sNumber – A string that will typically contain the ID of the transaction or other item
for which additional information is being retrieved. For example, this may be the
SOP Number.
cSequenceOne – A currency value typically used to identify the line item for which
additional data is being retrieved. For typical SOP integrations, this will be the
Component Sequence field. For typical POP integrations, this will be the Break Field
1 field.
cSequenceTwo – A currency value typically used to identify the line item for which
additional data is being retrieved. For typical SOP integrations, this will be the Line
Item Sequence field. For typical POP integrations, this parameter can remain empty.
iControl – An integer that is used to indicate which piece of data to return. The
trigger processing procedure will examine this parameter to determine which data
to retrieve and return.
rw_ReportStart()
This function can be called to notify the third-party application that the report has
started. It is typically called from a calculated field in the Report Header section. of
a report. The function has the following parameters:
function returns string Ret_Val;
in integer Dict_ID;
in string Report_Name;
Dict_ID – An integer specifying the dictionary ID of the product that must process
the request for data. The trigger processing function must check this parameter to
determine whether it should process the request.
Report_Name – A string containing the name of the report on which the calculated
field will be used. You may not need to use this parameter. If it’s not needed, an
empty string should be supplied when creating the calculated field.
56 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
rw_ReportEnd()
This function can be called to notify the third-party application that the report has
ended. It is typically called from a calculated field in the Report Footer section of a
report. The function has the following parameters:
function returns string Ret_Val;
in integer Dict_ID;
in string Report_Name;
Dict_ID – An integer specifying the dictionary ID of the product that must process
the request for data. The trigger processing function must check this parameter to
determine whether it should process the request.
Report_Name – A string containing the name of the report on which the calculated
field will be used. You may not need to use this parameter. If it’s not needed, an
empty string should be supplied when creating the calculated field.
• Indicate that the report is template-enabled. This makes the report visible in the
Reports lookup window in Microsoft Dynamics GP, allowing you to work with
the template for the report.
This step is no longer necessary beginning with Microsoft Dynamics GP 2010 R2 (also
known as Service Pack 2). Beginning with this release, all reports are template-enabled.
• Ensure that the Report Writer can locate and retrieve the Word template for the
report when the report is run.
Template-enabled reports
appear in the Reports
lookup.
INTEGRATION GUIDE 57
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
In the trigger processing function, you must check the product ID and resource ID
of the report that are passed in. These values indicate the report that is being
checked to find out whether it is template-enabled. If the product ID matches your
product, and the report ID matches a report that you want to be template-enabled,
return the value true from the function. The following example is the
IG_IsTemplateEnabledReport() trigger processing function for the sample
integrating application. It examines the product ID and resource ID passed into the
function, and compares them to the resource IDs for the reports that are to be
template-enabled. If the IDs match, the value true is returned from the function.
function returns boolean result;
The Report Destination window that is automatically displayed by the run report or
run report with name statements will automatically retrieve a Word template for a
report if a template has been created.
• Beginning with Microsoft Dynamics GP 2010 R2 (also know and Service Pack
2), the Template choice is always available. If the user chooses Template, but no
report template can be found, Microsoft Dynamics GP will use the HTML
version of the report.
58 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
If you have implemented a Report Options window for your integration that
displays a Report Destination window, you must modify your code that opens the
Report Destination window to allow it to find the a Word template for a report. The
Report_Destination form and window in the Dynamics.dic dictionary are typically
used for report options. The code in your Report Options window that opens the
Report Destination form must set the product ID and resource ID fields in the
Report_Destination window. The Report_Destination window uses these values to
find out whether a Word template has been created and assigned for the report. If
one has, the “Template” choice for the Report Type list will use that template.
The following example is the change script for the Destination button in the Leads
Report Options window in the sample integrating application. It opens the
Report_Destination window from the Dynamics.dic dictionary, allowing the user to
select the report destination. Notice that the values of the Product ID field and the
Resid field in the Report_Destination window are set to the values for the current
report. This allows the Report_Destination window to retrieve a Word template that
has been set up for the report.
{Set product ID and resource ID so that a template can be used if one has
been set up.}
INTEGRATION GUIDE 59
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
end if;
60 IN T E G R AT I O N G U ID E
C H A P T E R 5 R E P O R T S
INTEGRATION GUIDE 61
62 IN T E G R AT I O N G U ID E
Chapter 6: Procedures
Your application can call procedures in the Dynamics.dic dictionary to complete
common tasks (such as attaching form- and record-level notes), or more closely
integrate with the accounting system (such as posting to Microsoft Dynamics GP
tables from your application). Although you can’t view procedure names in the
Dynamics.dic dictionary, the procedure design documents available with the SDK
(Software Development Kit) provide the name, description, and parameters of each
procedure in the accounting system.
• Calling a procedure
• Using procedure triggers
• Using the script logger
• Procedure list
Calling a procedure
You can call a Microsoft Dynamics GP procedure exactly the same way as you call
your own procedures. Use the call script_name syntax for procedures and the call
script_name of form form_name syntax for form procedures.
• Use the Dexterity Script Logger to find the specific procedures Microsoft
Dynamics GP calls for a given process.
• Use the procedure design documents available with the SDK for a descrip-
tion of all procedures available.
• Use the procedures listed in Part 11, Script Reference, to perform common
integration tasks, such as adding navigation for your application.
INTEGRATION GUIDE 63
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
The recommended method of using procedure triggers is to not reference the parameters
passed from the original script. Using this method, a procedure trigger simply activates
when the selected procedure is called.
'Payment_Terms_Calculate_Avail', 498.33000,
0.00000, 0, 0.00000, 0.00000, file
'SY_Payment_Terms_MSTR'
Not all Microsoft Dynamics GP procedures are usable within a third-party product. We
recommend that, whenever possible, you use the procedures listed in Procedure list on
page 65, or those recommended for use by Dexterity technical support.
Once you understand the procedures in the call chain, you can call the same
procedures in your application to complete similar processing. To use the Script
Logger, complete the following steps:
64 IN T E G R AT I O N G U ID E
C H A P T E R 6 P R O C ED U R E S
Procedure list
The procedures listed in this section are suitable for performing common tasks
within an integrating application, and we recommend their use.
General Ledger
Details about the procedures listed here are available in the SDK.
INTEGRATION GUIDE 65
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
Inventory
Details about the procedures listed here are available in the SDK.
Invoicing
Details about the procedures listed here are available in the SDK.
Multicurrency Management
Details about the procedures listed here are available in the SDK.
66 IN T E G R AT I O N G U ID E
C H A P T E R 6 P R O C ED U R E S
Payables Management
Details about the procedures listed here are available in the SDK.
Payroll
Details about the procedures listed here are available in the SDK.
INTEGRATION GUIDE 67
PA RT 2 I N T E G R A TI O N C O M PO N E N T S
Receivables Management
Details about the procedures listed here are available in the SDK.
68 IN T E G R AT I O N G U ID E
C H A P T E R 6 P R O C ED U R E S
System Manager
Details about the procedures listed here are available in the SDK.
INTEGRATION GUIDE 69
70 IN T E G R AT I O N G U ID E
PART 3: OBJECT TRIGGERS
Part 3: Object Triggers
Refer to Chapter 2, Use the information presented here to understand how to use object triggers in an
“Sample Integration,” integrating application. The sample integrating application (DEVELOP.DIC)
for more information available with Dexterity includes additional source code examples. We recommend
about installing and that you review this application as you’re reading about object triggers. The
using the sample following topics are discussed:
integrating application.
• Chapter 7, “Using Triggers,” provides an overview of triggers and the
guidelines necessary for using object triggers in your application.
• Chapter 8, “Form Triggers,” explains how you can create triggers that provide a
way to navigate to your application’s forms.
• Chapter 9, “Focus Triggers,” explains how you can create triggers that are
activated by focus events.
• Chapter 10, “Database Triggers,” explains how you can create triggers that are
activated by database operations.
• Chapter 11, “Procedure Triggers,” explains how you can create triggers that are
activated when procedures are called.
• Chapter 12, “Function Triggers,” explains how you can create triggers that are
activated when functions are called.
72 IN T E G R AT I O N G U ID E
Chapter 7: Using Triggers
Triggers are functionality that allows an application to respond to events in another
dictionary. To create a trigger, you need to register it with the runtime engine. The
registration specifies which event activates the trigger and what procedure runs in
response. The procedure that runs in response is called the trigger processing
procedure. The trigger processing procedure can complete additional processing,
such as saving or deleting a third-party record, or opening or restarting a form.
Information about triggers is divided into the following sections:
• Trigger benefits
• Types of triggers
• Registering triggers
• Trigger processing procedure
• Unregistering triggers
• Enabling and disabling triggers
• Customization Status window
• Testing triggers
Keep in mind that object triggers are not the same as triggers in SQL Server, which
relational database environments commonly use. Object triggers are a Dexterity-
specific feature. They reside totally in your application and respond to events
initiated by a Dexterity application. In contrast, a SQL Server trigger invokes named
stored procedures in a SQL database in response to other database events.
Trigger benefits
Dexterity’s trigger design has the following benefits:
INTEGRATION GUIDE 73
PA RT 3 O B J EC T TR I G G E R S
Types of triggers
There are five trigger types supported in Dexterity. The following sections explain
each briefly; the remaining chapters in this part explain each in more detail.
Form triggers
When a form trigger is registered for a form, an “Additional” menu is added for
windows in the form in Microsoft Dynamics GP. In the registration, you specify a
menu item that will appear in the “Additional”. When the user selects this
menu item, the form trigger is activated, allowing your application to respond.
Typically, form triggers are used to provide navigation to your form without
customizing the Microsoft Dynamics GP form with a navigational control (such as a
push button).
Focus triggers
Focus triggers are activated by focus events, such as a window opening or closing,
or the focus moving from field to field. Focus events occur in any location where
Dexterity allows you to attach a script, such as window pre and post scripts, or field
pre, change and post scripts.
A focus trigger can be activated by any focus event on the form (such as when the
user clicks the Save button, or restarts the form). This gives you the same
functionality as attaching a script directly to a form, without modifying the form
directly.
Database triggers
Database triggers are activated by successful table operations, such as a record
begin read, saved, or deleted. The procedure that runs in response to a database
trigger has access to the same table buffer contents as the script that performed the
database operation.
Database triggers are useful for maintaining referential integrity between records in
your application and related records in the accounting system. When Microsoft
Dynamics GP reads, saves or deletes a record, you can use a database trigger to
perform similar operations for a related table in your application.
Procedure triggers
A procedure trigger is activated when a specific procedure is run. The trigger
processing procedure runs either before or after the procedure being triggered from
and has access to the same parameters as the original procedure.
Function triggers
A function trigger is activated when a specific function is run. You can run a
function or procedure in response to the function being triggered from. The function
or procedure that runs in response to the function call can run before or after the
original function.
74 IN T E G R AT I O N G U ID E
C H A P T E R 7 U S I N G TR I G G E R S
Registering triggers
To create an object trigger, you must register the trigger for use with the runtime
engine. You also need to create a trigger processing procedure that runs when the
trigger is activated. Use the following functions to register each of your
application’s triggers for use with the runtime engine.
The trigger registration specifies the conditions that will activate the trigger. For
instance, the registration for a procedure trigger includes the name of the procedure
that will activate the trigger when it is called.
When you register a trigger, a tag is assigned that uniquely identifies the trigger. The
tag is returned by the optional tag parameter for each trigger registration function.
You will use the tag when you want to enable, disable or unregister the trigger.
There is no way to get a specific trigger’s tag after the trigger has been registered. If
you need to work with an individual trigger, you must keep track of the tag
assigned when you registered the trigger. Commonly, global variables are used to
store the tag for each trigger.
When you register a trigger, the return value from the function indicates whether
the trigger was registered. The following table lists the possible return values:
Refer to Chapter 20, Although you can register triggers from anywhere in your application, the
“Procedures,” in preferred method is through a startup procedure. This is a procedure that’s run
Volume 2 of the prior to the Main Menu form pre script for for the main application dictionary. You
Dexterity can create two types of startup procedures:
Programmer’s Guide
for more information • Create a procedure named “Startup” for an application that integrates with
about procedures. Microsoft Dynamics GP. For multiple applications, startup procedures run in
the order in which the applications are listed in the launch file.
INTEGRATION GUIDE 75
PA RT 3 O B J EC T TR I G G E R S
For example, the following procedure named “Startup” registers a form trigger. It
runs before the form pre script for the Main Menu form. The procedure named
IG_Open_Contact_History runs in response to this trigger.
{Name: Startup}
local integer l_result;
If you make changes in how your triggers are registered, the registration code must
be run again before any changes will take effect. If your triggers are registered in the
Startup procedure, be sure you exit then restart the runtime engine (or test mode) to
reregister your triggers.
The following example processing procedure runs in response to the form trigger
registered for the RM_Customer_Maintenance form. This procedure runs when the
user selects the Contact History menu item.
{Name: IG_Open_Contact_History}
if not isopen(form IG_Contact_History) then
open form IG_Contact_History;
'Customer Number' of window IG_Contact_History of form IG_Contact_History
➥ = 'Customer Number' of window RM_Customer_Maintenance of form
➥ RM_Customer_Maintenance;
run script 'Customer Number' of window IG_Contact_History
➥ of form IG_Contact_History;
end if;
Unregistering triggers
Once registered, a trigger remains valid until you exit the runtime engine, exit test
mode or unregister it. To unregister a trigger, use the Trigger_Unregister() function
and the tag that uniquely identifies the trigger. Remember, the tag was assigned
when you registered the trigger. When you unregister a trigger, its tag becomes
invalid. If you reregister the trigger, a new tag will be assigned.
76 IN T E G R AT I O N G U ID E
C H A P T E R 7 U S I N G TR I G G E R S
To enable or disable specific triggers, you need to know the tag that was assigned when you
registered the trigger.
When using your development dictionary in test mode, the name of the
Dynamics.dic dictionary will appear in this window. When running your
integrating application in a multidictionary environment, this window will list both
products.
You can print the Customization Status report from the Customization Status
window. This report lists information about triggers in the selected dictionary. The
following illustration shows a portion of this report:
When printed in test mode, this report lists only the triggers for the development
dictionary. When printed in a multidictionary environment, all products currently
running will be listed in the report.
INTEGRATION GUIDE 77
PA RT 3 O B J EC T TR I G G E R S
Testing triggers
Triggers are designed to work identically whether you are using your development
dictionary (in test mode), or operating in a multidictionary environment (at
runtime). However, you should test your application’s triggers in a multidictionary
environment as much as possible, because this environment most closely matches
your customers’ environment.
Triggers will allow you to change core application functionality. For example,
when using a focus trigger with a field, the reject script statement will prohibit the
change script for that field from running.
When testing and debugging your application, it’s important that you account for
all situations where you may be affecting Microsoft Dynamics GP functionality,
such as in the previous example. During the testing process, you can enable and
disable your application’s triggers appropriately to locate the source of application
errors.
78 IN T E G R AT I O N G U ID E
Chapter 8: Form Triggers
When you register a form trigger for a form, the form for which the trigger is
registered adds an “Additional” menu for each window in the form. The item you
registered will appear in this menu. When selected, the menu item activates the
trigger processing procedure you’ve written. Although you can complete any
processing you’d like with this processing procedure, its intended use is for opening
a corresponding third-party form:
See Chapter 1, Form triggers are especially useful when you don’t want to modify a Microsoft
“Developing Dynamics GP form by adding a navigational control (such as a push button). For
Integrations,” for instance, instead of modifying the RM_Customer_Maintenance form to have a
information about “Contact History” button, the sample integrating application uses a form trigger.
installing the sample When you open the RM_Customer_Maintenance form, the Additional menu will
integrating application. display an item that opens the third-party form named IG_Contact_History.
You must redistribute alternate forms with each maintenance release of Microsoft Dynamics
GP. Rather than creating alternate forms, we recommend you provide additional
functionality using a third-party form accessed from a form trigger.
INTEGRATION GUIDE 79
PA RT 3 O B J EC T TR I G G E R S
{Name: Startup}
local integer l_result;
When the user chooses the Contact History menu item, this trigger processing
procedure opens the third-party form named IG_Contact_History, sets window
fields, and retrieves a record from the Contact History table.
{Name: IG_Open_Contact_History}
open form IG_Contact_History;
80 IN T E G R AT I O N G U ID E
C H A P T E R 8 F O R M T R I G G E R S
We recommend that you examine the customizations you currently make to Microsoft
Dynamics GP forms, and determine whether you can provide the same functionality using
triggers.
Menu items
If more than one third-party developer adds functionality to the same Microsoft
Dynamics GP form using form triggers, the Additional menu will list several menu
items, one for each third-party form.
Duplicate menu item names from multiple third-party developers will appear in the
Additional menu with no functional conflicts. To minimize any confusion from
possible naming conflicts, we recommend that you don’t hard-code the name of the
menu item during the form trigger registration. Instead, refer to a getmsg() string in
the registration so users can modify the menu item using the Modifier.
The following example uses the getmsg() function to refer to a message (with the
resource ID of 22,233) stored in the dictionary.
INTEGRATION GUIDE 81
82 IN T E G R AT I O N G U ID E
Chapter 9: Focus Triggers
Focus triggers are activated by “focus” events, such as a window opening or
closing, or the focus moving from one field to the next. You can use focus triggers
anywhere Dexterity allows you to attach a script, such as window pre and post
scripts, or field pre, change and post scripts. Focus triggers respond to focus events
regardless of whether scripts already exist for those focus events.
You can create focus triggers that respond to the following types of objects and
focus events:
Focus triggers require that you specify the object that activates the trigger (such as a
window, form or field), the focus event for that object (such as a pre, change or post
event), and the procedure you want to run in response to the trigger.
INTEGRATION GUIDE 83
PA RT 3 O B J EC T TR I G G E R S
{Name: Startup}
local integer l_result;
Prior to the original Microsoft Dynamics GP change script, any application that
issues a reject script statement will cancel all processing for the current focus event.
For instance, if application 2 uses the reject script statement in a processing
procedure, it cancels all remaining focus triggers as well as the original save button
change script. This ensures that no further processing continues until all
applications meet the appropriate conditions.
Once the Microsoft Dynamics GP change script runs successfully, all following
triggers run successfully. For instance, if application 4 uses reject script, a focus
trigger for application 5 still runs.
84 IN T E G R AT I O N G U ID E
C H A P T E R 9 F O C U S T R I G G E R S
You shouldn’t use focus triggers to save or delete a record directly, because there’s no way of
knowing whether the Microsoft Dynamics GP table operation was successful or not. Instead,
you should use database triggers to save and delete third-party records based on a successful
Microsoft Dynamics GP table operation.
Saving records
To save a third-party record with a related Microsoft Dynamics GP record, apply a
focus trigger to the Save button. This trigger can verify whether conditions required
for the save have been met, such as whether the user addressed all required fields in
the third-party window. If the save operation doesn’t meet these conditions, the
reject script statement stops processing for the Microsoft Dynamics GP save
operation.
OK
No reject record
to
save? (third-party)
Yes
Was
No abort script
the record
saved? (Microsoft Dynamics GP)
Yes
INTEGRATION GUIDE 85
PA RT 3 O B J EC T TR I G G E R S
Once the user addresses the required fields, then clicks Save again, the focus trigger
verifies the conditions for the save, and a database trigger can complete the save.
{Name: Startup}
local integer l_result;
This trigger processing procedure runs in response to the focus trigger on the Save
button. If the user doesn’t enter all required fields in the Contact History window,
the reject script statement cancels all processing and the user can address the
required fields. Otherwise, the Microsoft Dynamics GP save operation runs to
completion.
{Name: IG_Verify_Contact_Save}
local integer l_answer;
86 IN T E G R AT I O N G U ID E
C H A P T E R 9 F O C U S T R I G G E R S
Deleting records
When the user deletes a record from Microsoft Dynamics GP, it may be necessary to
delete a corresponding record from a third-party table. A focus trigger on the Delete
button can verify whether the third-party record can be deleted. If the third-party
record can’t be deleted, the reject script statement cancels all processing. The
process is shown in the following illustration.
OK
No reject record
to
delete? (third-party)
Yes
Was
No abort script
the record
deleted? (Microsoft Dynamics GP)
Yes
{Name: Startup}
local integer l_result;
INTEGRATION GUIDE 87
PA RT 3 O B J EC T TR I G G E R S
This trigger processing procedure attempts to read and actively lock a third-party
record. If it can, the Microsoft Dynamics GP delete continues. If it can’t obtain an
active lock, it issues a reject script statement and stops all processing.
{Name: IG_Verify_Contact_Delete}
release table IG_Contact_History;
{Name: Startup}
local integer l_result;
This trigger processing procedure for the form focus trigger simply closes the third-
party form.
{Name: IG_Close_Contact_History}
88 IN T E G R AT I O N G U ID E
C H A P T E R 9 F O C U S T R I G G E R S
{Name: Startup}
local integer l_result;
l_result = Trigger_RegisterFocus(anonymous(window
➥ RM_Customer_Maintenance of form RM_Customer_Maintenance),
➥ TRIGGER_FOCUS_PRE, TRIGGER_AFTER_ORIGINAL, script
➥ IG_Restart_Contact_History);
if l_result <> SY_NOERR then
warning "Trigger registration failed.";
end if;
{Name: IG_Restart_Contact_History}
{Name: Startup}
l_result = Trigger_RegisterFocus(anonymous(window RM_Customer_Maintenance
➥ of form RM_Customer_Maintenance), TRIGGER_FOCUS_CONTEXT_MENU,
➥ TRIGGER_AFTER_ORIGINAL,
➥ script IG_Trigger_Customer_Maintenance_Context_Menu);
if l_result<>SY_NOERR then
warning "Focus trigger registration failed.";
end if;
INTEGRATION GUIDE 89
PA RT 3 O B J EC T TR I G G E R S
The trigger processing procedure adds a command to the context menu that will
open the Contact History form. Notice how the script retrieves the tag of the context
menu command list, and then adds the command to the end of the list.
{Name: IG_Trigger_Customer_Maintenance_Context_Menu}
90 IN T E G R AT I O N G U ID E
C H A P T E R 9 F O C U S T R I G G E R S
{Name: Startup}
local integer l_result;
l_result = register_focus_trigger(anonymous(window
➥ Customer_Lookup_Scroll of form Customer_Lookup), TRIGGER_FOCUS_PRE,
➥ TRIGGER_AFTER_ORIGINAL, script IG_Get_Scrollwin_Information);
if l_result <> SY_NOERR then
warning "Trigger registration failed.";
end if;
When the trigger is activated, this trigger processing procedure sets values from the
current line in the Customers and Prospects scrolling window to window fields in
the Customer Contacts window.
{Name: IG_Get_Scrollwin_Information}
{If the Contact History window is open, try to update it.}
if isopen(form IG_Contact_History) then
{Update the window only if there aren't pending changes.}
if not changed(form IG_Contact_History) then
'Customer Number' of window 'Contact History' of form
IG_Contact_History = 'Customer Number' of window
➥ Customer_Lookup_Scroll of form Customer_Lookup;
INTEGRATION GUIDE 91
PA RT 3 O B J EC T TR I G G E R S
92 IN T E G R AT I O N G U ID E
C H A P T E R 9 F O C U S T R I G G E R S
Microsoft Dynamics GP uses command-based menus. You can’t use menu triggers with
command-based menus. For Microsoft Dynamics GP, you can only use menu triggers for
form-based menus.
{Name: Startup}
local integer l_result;
{Name: Startup}
local integer l_result;
INTEGRATION GUIDE 93
PA RT 3 O B J EC T TR I G G E R S
Be aware that other integrating applications can instantiate table buffers as well.
There is a possibility of multiple developers trying to use the same table buffer,
especially when trigger processing procedures reference a Microsoft Dynamics GP
table. Thus, it’s a good idea to “clean up” any table buffers your trigger processing
procedures access, and not to expect a table buffer to be in a known state when a
trigger processing procedure accesses it.
94 IN T E G R AT I O N G U ID E
Chapter 10: Database Triggers
Database triggers are activated by successful table operations, such as saving a
record, deleting a record or reading a record. Database triggers are the most reliable
way of ensuring relational integrity between a third-party record and a related
Microsoft Dynamics GP record, since a database trigger is activated only if the
database operation was successful. The following table lists each type of database
trigger:
See Chapter 2, For example, using a single trigger activated by the add operation, the sample
“Sample Integration,” integrating application automatically creates a new third-party contact history
for information about record when a new customer record is created in the accounting system. Likewise,
installing the sample using a single delete trigger, the sample application automatically deletes a third-
integrating application. party customer contacts record when the corresponding customer record is deleted.
Information about database triggers is divided into the following sections:
l_result = Trigger_RegisterDatabase(anonymous(table
➥ RM_Customer_MSTR), form RM_Customer_Maintenance,
➥ TRIGGER_ON_DB_DELETE, script IG_Delete_Contact_History;
if l_result <> SY_NOERR then
warning "Database trigger registration failed.";
end if;
INTEGRATION GUIDE 95
PA RT 3 O B J EC T TR I G G E R S
Using ranges
Successful table operations that occur for a range of records will activate a database
trigger for each record in the range. The range operation passes each record’s buffer
to the processing procedure.
A restriction prohibits the trigger from activating when a database operation occurs from
other locations in the system. Therefore, you should not use a restriction if you use database
triggers to enforce referential integrity constraints between Microsoft Dynamics GP records
and third-party records.
96 IN T E G R AT I O N G U ID E
C H A P T E R 1 0 D AT A B AS E T R I G G E R S
A database trigger with a form restriction runs only if the table operation uses the
form’s record buffer. For instance, if the form’s Save button calls a procedure which
then saves a record to a table, the database trigger won’t run (you’re using the
procedure’s record buffer, not the form’s). However, if the Save button passes the
form’s record buffer to the procedure, the database trigger runs because you’re still
using the form’s record buffer.
Microsoft Dynamics GP forms typically don’t delete or save records using a procedure. They
use either a field change script or a form procedure, where a script passes the record buffer to
the form procedure.
{Name: Startup}
local integer l_result;
This trigger processing procedure sets key values and default values, then saves a
new contact history record corresponding to the new customer record.
{Name: IG_Create_Contact_History}
inout table RM_Customer_MSTR;
INTEGRATION GUIDE 97
PA RT 3 O B J EC T TR I G G E R S
{Name: Startup}
local integer l_result;
l_result = Trigger_RegisterDatabase(anonymous(table
➥ RM_Customer_MSTR),form RM_Customer_Maintenance,
➥ TRIGGER_ON_DB_UPDATE, script IG_Save_Contact_History);
if l_result <> SY_NOERR then
warning "Database trigger registration failed.";
end if;
This trigger processing procedure saves the third-party contact history record with
any new information the user may have added to the corresponding customer
record.
{Name: IG_Save_Contact_History}
inout table RM_Customer_MSTR;
There are two ways in which you can use delete database triggers; responding to a
record deleted from a Microsoft Dynamics GP form, and responding to a record
deleted from a Microsoft Dynamics GP procedure.
98 IN T E G R AT I O N G U ID E
C H A P T E R 1 0 D AT A B AS E T R I G G E R S
{Name: Startup}
local integer l_result;
l_result = Trigger_RegisterDatabase(anonymous(table
➥ RM_Customer_MSTR), form RM_Customer_Maintenance,
➥ TRIGGER_ON_DB_DELETE, script IG_Delete_Contact_History);
if l_result <> SY_NOERR then
warning "Database trigger registration failed.";
end if;
This trigger processing procedure deletes the third-party contact history record that
corresponds to the deleted RM_Customer_MSTR record.
{Name: IG_Delete_Contact_History}
inout table RM_Customer_MSTR;
To handle this situation, delete a related third-party record conditionally within the
processing procedure that responds to the database delete trigger. This will also
work in cases where a Microsoft Dynamics GP procedure removes a range of
records. The trigger then runs for each successful record delete in the range.
INTEGRATION GUIDE 99
PA RT 3 O B J EC T TR I G G E R S
{Name: IG_Delete_Contact_History}
inout table RM_Customer_MSTR;
You can specify either of these table operations in the table_operations parameter of
the Trigger_RegisterDatabase() function. If successful, the record’s buffer is passed
to your processing procedure as an inout parameter.
{Name: Startup}
local integer l_result;
l_result = Trigger_RegisterDatabase(anonymous(table
➥ RM_Customer_MSTR), form RM_Customer_Maintenance,
➥ TRIGGER_ON_DB_READ_LOCK, script IG_Update_Contact_History);
if l_result <> SY_NOERR then
warning "Database trigger registration failed.";
end if;
100 IN T E G R AT I O N G U ID E
C H A P T E R 1 0 D AT A B AS E T R I G G E R S
This processing procedure updates the Contact History window with the same key
value as the one displayed in the RM_Customer_Maintenance form. It then
attempts to retrieve an existing record using the script for the Customer Number
field.
{Name: IG_Update_Contact_History}
inout table RM_Customer_MSTR;
Procedure triggers are especially useful if you want to react to certain processes in
Microsoft Dynamics GP, such as posting, by completing additional processes.
Information about procedure triggers is divided into the following sections:
{Name: Startup}
local integer l_result;
• It can use no parameters, thereby ignoring values from the original procedure.
This is the recommended method of using a procedure trigger.
• It can use the same parameters as the original procedure. However, the
parameters in the trigger processing procedure must match the parameter list of
the original procedure script.
Ignoring parameters
If you choose to When using procedure triggers, we strongly recommend that you do not alter
reference a procedure’s parameters passed from the original script. Using this method, a third-party
parameters, see Using developer’s procedure trigger simply runs when the specified Microsoft Dynamics
original parameters on GP procedure is called. The values of a Microsoft Dynamics GP procedure’s
page 105, for more parameters are difficult to determine unless you can accurately predict where and
information. how the procedure will be called. Furthermore, changing parameter values in a
Microsoft Dynamics GP procedure is also more likely to unexpectedly alter the
results of other procedures called in a Microsoft Dynamics GP process.
{Name: Startup}
local integer l_result;
This trigger processing procedure runs when the System_Login procedure is called.
This procedure runs when the user initially logs into Microsoft Dynamics GP.
{Name: IG_Check_Login}
104 IN T E G R AT I O N G U ID E
C H A P T E R 1 1 PR O C E D U R E TR I G G E R S
There are additional considerations you should take into account when working
with parameters from an original procedure, depending on whether it’s called in
the background or the foreground. Note that the differences are based on how the
procedure was called (using either the call or call background statements), not how
it’s actually running.
{Name: Startup}
local integer l_result;
This trigger processing procedure uses the same parameters as the SY_Master_Post
procedure. It uses the in parameters to set values in a log table used for tracking
posting activity.
{Name: IG_Log_Posting_Activity}
in string batch_source;
in integer source_window;
in 'Print Report Flag Array' l_report;
in 'Print To Printer Array' l_printer;
in 'Print To Screen Array' l_screen;
in 'Export File Type Array' export_file_type;
in 'File Export Name Array' export_file_name;
106 IN T E G R AT I O N G U ID E
C H A P T E R 1 1 PR O C E D U R E TR I G G E R S
{Name: Startup}
local integer l_result;
{Name: Startup}
local integer l_result;
110 IN T E G R AT I O N G U ID E
C H A PT E R 1 2 F U N C T I O N TR I G G E R S
It first checks the Status parameter to ascertain whether the function successfully
saved the checkbook record. It then checks the Maximum Check Dollar in the
current record; if it’s greater than $10,000, it displays a warning, then opens a third-
party form for setting security access to the checkbook:
{Name: IG_Verify_Checkbook}
function returns boolean Status;
• Trigger_RegisterDatabaseByName()
• Trigger_RegisterFocusByName()
• Trigger_RegisterFormByName()
• Trigger_RegisterFunctionByName()
• Trigger_RegisterProcedureByName()
Refer to the Trigger function library in the Function Library Reference manual for a
complete description of the functions used to register cross-dictionary triggers.
Helper functions
Rather than write all of this code every time you want to retrieve a value from a
window in another dictionary, consider writing a general-purpose routine. For
example, the following function retrieves the value from the specified window.
in integer prod_id;
in string form_name;
in string window_name;
in string field_name;
out anonymous field ret_val;
optional out integer storagetype;
optional out string compile_errors;
114 IN T E G R AT I O N G U ID E
C H A PT E R 1 3 C R O S S - D I C T I O N A R Y T R I G G E R S
The following example uses the GetWindowValue() function to retrieve the value
of the Applicant Number field in the HR_Applicant_Tracking window of the
HR_Applicant form.
For example, the following script is the trigger processing procedure for the delete
trigger on the Applicants table. Notice that the table is passed to the trigger
processing procedure as an anonymous table. Also notice that the column()
function is used to retrieve the value of the Applicant Number field in the table.
The following illustration shows the sample maintenance form and some of the
different components described:
push buttons
password padlock
button
browse buttons
• Chapter 14, “Browse Controls,” explains how to use and implement browse
controls and sort lists in your application.
• Chapter 15, “Push Buttons,” explains the types of push buttons used in a typical
window.
• Chapter 17, “Expansions And Zooms,” explains how to use and implement
expansion and zoom controls in your application.
• Chapter 20, “Data Entry Conventions,” explains how to use prompts, required
fields, a tab sequence and field groups to organize information in a window.
118 IN T E G R AT I O N G U ID E
Chapter 14: Browse Controls
Browse controls allow users to sequentially scan records in a window. These
controls accompany any window where a user can add, view, or change one of
several records at a given time. The following illustration shows a typical browse
control, as well as a sort list that usually accompanies such a control.
• Browse buttons
• Sort lists
Browse buttons
Browse buttons include four push button fields that allow the user to move to the
first record in the table, to the previous record, the next record or to the last record in
the table:
previous record
first record
last record
next record
Use browse buttons with almost any “parent,” or main window. Do not use browse
buttons with a true “child” window (a window only accessible from a parent
window), or with a window used to maintain a single record only (such as a setup
window).
'Sort By' = 1;
120 IN T E G R AT I O N G U ID E
C H A P T E R 1 4 B R O W S E C O N T R O L S
Sort lists
For information about Typically, a sort list is included with browse buttons. The list specifies the key by
sort lists used in a which the user views records when using browse buttons. In the following
lookup window, refer illustration, the sort list includes items that correspond to the two keys for the Leads
to Chapter 16, Master table. The default selection in the sort list (By Lead ID) allows a user to
“Lookups.” browse the Leads Master table by the first key in the table:
The items in the sort list should always correspond to the order and number of keys
in the table being browsed. If the table being browsed has a single key, don’t use a
sort list; display browsed records according to that key.
SavedOnRestart True
SetChangeFlag False
VisibleItems The maximum number of items to display in the list.
We recommend that you set the value to six.
If you intend to distribute your product internationally, you should fill a sort list with
message resources using the getmsg() function. You can translate message resources
using Dexterity Utilities, or your users can change them using the Modifier.
After the push button has been added to the window, you must set its properties for
proper display in the control area. Set the following Visual properties for the field:
Appearance 3D Highlight
BackColor System - Toolbar
Border True
Font System
FontColor System
Size-Height 24
Size-Width 72
Style Text on Right
The vertical separators that appear between the push buttons in the control area are
individual lines that you must add using the line tool. Each vertical line has the
following Visual properties:
Appearance 3D Border
LineColor System
LineSize 1
Position-Top 3
Size-Height 16
Size-Width 0
Cancel button
Use a Cancel button only with windows that use an OK button. A cancel operation
should allow the user to close a window without being subjected to any “side
effects” of the window’s dismissal. Typically, this means that no warning dialogs
should appear asking whether the user wants to save changes, nor should any
requests appear that the user provide more information prior to the window
closing.
• Don’t use a Cancel button with windows that display an editable scrolling
window. Dexterity saves changes made in an editable scrolling window to the
linked table automatically, and you cannot reverse, or roll back these changes
once a cancel operation occurs for the window.
• Set the Cancel button’s Hyperspace property to True. This prevents the change
script for the currently focused window field from running when the user clicks
the Cancel button.
Clear button
Always use Clear buttons in combination with Save and Delete buttons. A clear
operation should clear the window and place the focus on the first field in the tab
sequence. It should never remove any information currently stored in a table, nor
should it close the window.
The Clear button should allow the user to clear changes made in the window
without any “side effects” of the clear operation. Typically, no warning dialogs
should appear asking whether the user wants to save changes, nor should any
requests appear requesting that the user provide more information prior to the
window clearing. Use an accelerator key of ALT+L to clear the contents of the widow
using the keyboard.
You shouldn’t use a Clear button with windows that display an editable scrolling
window. Dexterity automatically saves changes to the linked table, and you cannot
reverse, or roll back these changes once a clear operation occurs for the window.
124 IN T E G R AT I O N G U ID E
C H A P T E R 1 5 P U S H B U T T O N S
Delete button
Use a Delete button in combination with a Save and Clear button. A delete
operation should clear the window after the user deletes a record, but should not
close the window. The operation should clear the window, then place the focus on
the first field in the tab sequence.
Refer to Chapter 18, • Use the err() function to trap table operation errors that may occur during the
“Multiuser delete operation. This is extremely important in multiuser environments.
processing,” in Volume
2 of the Dexterity • Delete record notes you’ve assigned to a new, unsaved record using the
Programmer’s Guide Delete_Record_Note procedure available in Microsoft Dynamics GP.
for information about
handling multiuser • An access key of ALT+D should be used to delete a record using the keyboard.
processing issues.
• Enable the Delete button only when the user displays an existing record. Do not
enable the Delete button when the user creates a new record.
OK button
Use an OK button on windows used solely for viewing information (such as an
inquiry window) or on setup or preferences windows, used in maintaining a single
record. For windows whose contents are display only, an OK button can appear by
itself.
For setup and preferences windows, use a Cancel button with an OK button. The
OK button should always save changes to a preferences file or a setup table. In
addition, always run the OK button change script when the user presses the ENTER
key. To do this, set the OK button’s Default property to True.
Save button
Always use a Save button with Clear and Delete buttons. The Save button should
save the displayed information to one or more tables, clear the window after it saves
the record, and should never close the window. When it completes the save
operation, the save operation should focus the cursor in the window’s key field.
• Always run the Save button’s change script when the user presses the ENTER
key. To do this, set the Save button’s Default property to true.
Refer to Chapter 18, • Use the err() function to trap table operation errors that may occur during the
“Multiuser save operation. This is extremely important in multiuser environments.
processing,” in Volume
2 of the Dexterity Example 5: Save button change script
Programmer’s Guide The following example checks whether required fields have been addressed by the
for information about user, and attempts to save the record. The err() function ascertains which error
handling multiuser occurred, so that the script can display the appropriate message and prompt the
processing issues. user to carry out a specific action.
126 IN T E G R AT I O N G U ID E
Chapter 16: Lookups
Refer to Chapter 10, Lookups are a combination of a lookup button, a lookup field, and a lookup
“Scrolling Windows,” window that opens when the user clicks the lookup button. The following
in Volume 2 of the illustration shows a lookup control and a lookup window:
Dexterity
Programmer’s Guide
for more information
about scrolling
windows and lookups. lookup button
lookup window
Keep in mind that many Microsoft Dynamics GP lookup forms require that you
complete some preprocessing prior to opening the lookup form.
This field is an array of push buttons. When you add this field to the layout,
Dexterity will assign it the next available array index.
128 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
Using the from current clause in the fill window statement allows the lookup
form to properly focus on a record currently displayed in your form. For
instance, if a user entered a salesperson ID, then clicked the lookup button, the
lookup window would place the scrolling window focus on the record with that
salesperson ID.
Lookup types
Lookup controls include an editable field and a lookup push button. The following
illustration shows the salesperson lookup control. When the user clicks the lookup
button, the Salesperson lookup window will appear:
Most lookup fields are a key for a table, such as a salesperson ID, a customer ID or a
document number. The lookup button’s change script displays a lookup window
listing all the records associated with the lookup field. When the user selects a
record and the lookup window closes, the lookup window returns the value to the
lookup field.
Two types of lookup controls are used in a primary window: primary lookups and
secondary lookups.
primary lookup
secondary lookup
Primary lookups
The primary lookup is the first lookup control on a window. This lookup control
should allow the user to view records entered and maintained in the current
window (such as master records entered in a maintenance window).
You should never disable a primary lookup button, but you should lock the lookup
field. This includes times when the user adds a new, unsaved record or when the
user retrieves an existing record.
Secondary lookups
Secondary lookups display related records (such as checkbook, salesperson or class
IDs related to a customer record) and associate them with the record displayed in
the current window.
See the Adding records Secondary lookup controls work similarly to a primary lookup; however, secondary
on the fly on page 132 lookup fields should provide the ability to zoom to a maintenance form and display
for more information. the entire record, and should allow the user to add records on the fly.
130 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
This field is an array of push buttons. When you add this field to the layout,
Dexterity assigns it the next available array index.
The script sets invisible key fields on the lookup form, then runs the script for
the Redisplay button. This script uses the fill window statement with the from
current keyword to place the scrolling window focus on a record currently
displayed in the Lead Maintenance form.
In your development dictionary, you can also open an existing Microsoft Dynamics GP
lookup form, returning any valid return values to the lookup field. See Using existing
lookups on page 128 for more information.
If the user chooses to add the salesperson record, the Salesperson Maintenance
window is displayed, and the key field (Salesperson ID) is set to the new ID entered
in the Customer Maintenance window.
132 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
Creating a lookup
Lookup windows typically include a scrolling window, a find field, a view options/
sort by list, a show/hide detail button and a form-level note button. The following
illustration shows the Leads lookup window included in the sample integrating
application.
Scrolling window
Note button
Select Cancel
button button
Scrolling window
A lookup window contains a scrolling window that displays the records that can be
selected with the lookup. Normally, the scrolling window displays one line of
information for each record in the table linked to the lookup.
The contents of the scrolling window is controlled by the Sort by/View options
button drop list. The mode of the scrolling window is controlled by the Show/Hide
detail button.
The contents of this button drop list is specified dynamically through sanScript
code. The items correspond to keys in the scrolling window’s linked table. When
the user selects an item in the sort list, the lookup window’s scrolling window is
filled using the selected key.
SavedOnRestart True
SetChangeFlag False
TabStop False
Alignment Left
Appearance 3D Highlight
BackColor System - List Header1
Border True
FontColor System - List Header1 Text
Style Text on Right
134 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
{Which group of items was selected? If it's less than 4, a sorting item
was selected.}
if '(L) Sort By' < 4 then
{Set the Sort By button drop list.}
result = Field_SetCaption('(L) Sort By', "&View: All " +
➥ itemname('(L) Sort By', '(L) Sort By'));
add item "by Lead ID" to '(L) Sort By' of window 'Lead Lookup';
add item "by Lead Name" to '(L) Sort By' of window 'Lead Lookup';
add item "by Salesperson" to '(L) Sort By' of window 'Lead Lookup';
add item "-" to '(L) Sort By' of window 'Lead Lookup';
add item "Refresh" to '(L) Sort By' of window 'Lead Lookup';
add item "-" to '(L) Sort By' of window 'Lead Lookup';
add item "Show Detail" to '(L) Sort By' of window 'Lead Lookup';
add item "Hide Detail" to '(L) Sort By' of window 'Lead Lookup';
set '(L) Sort By' of window 'Lead Lookup' to 'Sort By' of window
➥ 'Lead Maintenance' of form IG_Lead_Maintenance;
run script '(L) Sort By' of window 'Lead Lookup';
Column headers
The column headers indicate what information is displayed in the scrolling window
when it’s in normal mode. Typically, each header is a push button that the user can
click to indicate how the lookup should be sorted.
Specify a text caption that is appropriate for each column of the lookup.
TabStop False
Alignment Left
Appearance 3D Highlight
BackColor System - List Header2
Border True
FontColor System - List Header2 Text
Style Text Only
136 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
Appearance 2D Border
LineColor System
Refresh button
The Refresh (Redisplay) button contains the code that actually fills the scrolling
window for the lookup. When the user clicks the Refresh button or chooses the
Refresh item in the Sort by/View options button drop list, the contents of the
scrolling window is refreshed based on the sort order specified and the contents of
the Find field.
Visible False
Editable False
You’ll use these fields in the change script you attach to the refresh button.
TabStop False
Appearance 3D Highlight
BackColor Transparent
Border True
Style Graphic Only
138 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
When the scrolling window is displaying details, the items shown in normal mode
are displayed in bold text. The additional items are shown in plain text. If they
require additional explanation, the additional items can have prompts. These
prompts are also displayed in plain text.
TabStop False
Tooltip Show Details
Appearance 3D Highlight
BackColor Transparent
Border False
Find
The Find allows you to search the contents of the scrolling window, based on the
sorting order specified in the Sort by/View options button drop list.
The prompt for the Find is actually a string field whose content is specified through
sanScript code when a sorting method is chosen in the Sort by/View options button
drop list.
140 IN T E G R AT I O N G U ID E
C H A P T E R 1 6 L O O K U P S
Adding a Find
To add a Find to a lookup window, use the following procedure.
Editable False
TabStop False
Alignment Left
Appearance 3D Highlight
BackColor System - Button Face
Border True
FontColor System - Window Text
TabStop True
Tooltip Enter the value to search for
A lookup window should also have a Cancel button that simply closes the window.
The script for the Open button will be similar to the following example.
{Open the Lead Maintenance form and display the current selection.}
open form IG_Lead_Maintenance;
The New button is similar to the Open button. It opens the appropriate maintenance
window, allowing you to create a new item. It shouldn’t close the lookup window.
Note
Lookup windows should include window-level notes, if your application already
supports them. Window-level notes let the user attach information to the lookup
window that can be shared with other users.
Refer to Chapter 18, “Notes,” for more information about adding window-level and
record-level note support to your application.
142 IN T E G R AT I O N G U ID E
Chapter 17: Expansions And Zooms
Refer to Chapter 16, Along with lookups, expansions and zooms are the primary methods of accessing
“Lookups,” for additional information in a Microsoft Dynamics GP window. The following
additional information illustration shows how expansions and zooms appear in a typical window:
about using lookup
fields and lookup
zoom expansion
windows in your
application.
Information about expansions and zooms is divided into the following sections:
• Expansions
• Zooms
Expansions
Expansions extend, or expand the functionality of a primary window. Microsoft
Dynamics GP uses expansion windows when the current window isn’t large
enough to display all relevant fields. Use an expansion window only if you cannot
add its functionality to the parent window.
expansion field
expansion window
When you save the record from the main window, the copy to table statement
will automatically copy the contents from both the main and expansion
windows to the current table buffer. When retrieving a record, the copy from
table statement will retrieve the current record and fill both the main window
and the expansion window.
2. Add an OK button.
An expansion window typically has an OK button. The OK button should
simply close the window.
Even though the expansion window will close, information in the expansion
window will persist until you clear the form. This information allows the save
operation to save the contents of both the main and expansion windows.
Zooms
A zoom allows a user to “drill down” to a lower level of detail for a given record. A
zoom control includes a zoom field and a zoom pointer. The following illustration
shows a typical zoom control:
prompt
The Salesperson zoom field in the sample application’s Lead Maintenance window
allows the user to zoom to the Salesperson Maintenance window, where the user
can view the entire salesperson record. The zoom field must provide a key value
(Salesperson ID) to display a salesperson record.
Always allow a zoom operation, regardless of whether the zoom field is empty or not. If the
field is empty, open the maintenance form with no record displayed.
144 IN T E G R AT I O N G U ID E
C H A P T E R 1 7 EX P A N S I O N S A N D Z O O M S
Refer to Chapter 16, Be sure to review the following points when adding a zoom field to your window:
“Lookups,” for
information about • A zoom field should always have a lookup button and the ability to add records
creating a lookup and on the fly.
adding records on the
fly. • The value of the zoom field should never change because of changes the user
makes in the window they zoomed to. To change the value of a zoom field,
allow the user to enter a new value and add a new record on the fly, or select an
existing record using a lookup.
Visible False
Zoom True
• Record-level notes are attached to a given record and are available for a specific
record for a given company.
record-level note
button
window-level note
button
• Window-level notes
• Record-level notes
Window-level notes
Window-level notes provide the user with a means of attaching information to a
window, such as detailed procedures for using the window, that can be shared with
other users.
Window-level note buttons are actually made up of two different button fields that
indicate whether a note is attached to the record currently displayed. The note
button with a “clean sheet” should appear if there isn’t a window-level note
attached to the window.
When the user attaches a note to the window, the note button with the “filled sheet”
should appear.
Note Present Button - Toolbar Indicates the presence of a note for the window.
A window-level note button should appear in the lower-right corner of the window,
in the window status area.
When the user clicks the window-level note button, one of five note windows
should appear, allowing the user to change or delete an existing note or add a new
note to the current window. The note window that’s displayed when one of the note
forms is opened is shown in the following illustration:
You can display this window by opening one of five forms; Form_Note_1,
Form_Note_2, Form_Note_3, Form_Note_4 or Form_Note_5. Microsoft Dynamics
GP uses multiple forms in order to allow users to enter or edit multiple instances of
window-level and record-level notes at a given time. When a note is entered or
changed and the user clicks Attach, the note ID, date, time and note text and will be
stored in the SY_Notes_MSTR table.
148 IN T E G R AT I O N G U ID E
C H A P T E R 1 8 N O T E S
Using procedures
Refer to the Procedure The following table explains each of the Microsoft Dynamics GP procedures used to
Design Documents implement window-level notes.
available with the SDK
for more information Name Description
about procedures used Check_Note_ID_String This script ascertains which of five possible note forms are currently
for notes. open. If one is open, it ascertains whether it’s displaying the note
record for the current window. If it is, the window is brought to the
front, allowing the user to view or edit the note.
Get_Next_Form_Note_ This script ascertains which note form is currently open (if any) and
To_Open returns an integer indicating the next available note form. There can be
a maximum of five note forms open. For example, if Form_Note_1 and
Form_Note_3 are open, a 2 will be returned (indicating Form_Note_2).
Check_For_Note This script checks the SY_Notes_MSTR table to ascertain whether a
note record exists for the window.
{Use the window display name as the key for the SY_Notes_MSTR table.}
l_Note_ID = "Lead Maintenance";
{---------------------------------------------------------
This section checks whether a note form for the current window is already
open. If a note form is already open, it's brought to the front. If no
note form is open for this window, the Get_Next_Form_Note_To_Open
procedure is used to return the next available note form. If none is
available (form_number=0), the user is warned to close available note
forms.
----------------------------------------------------------}
call Check_Note_ID_String, l_Note_ID, isthere, form_number;
if isthere = false then
call Get_Next_Form_Note_To_Open, form_number;
if form_number = 0 then
warning "Too many notes are currently open. Close
➥ available notes windows prior to attaching a note.";
abort script;
end if;
end if;
{---------------------------------------------------------
If a note form is available, each of five possible instances must be
examined. This section checks the value of form_number from the
Get_Next_Form_Note_To_Open procedure, and opens the first available note
form.
----------------------------------------------------------}
if form_number = 1 then
open form Form_Note_1 return to 'Dummy Note Show Hide';
'Note ID' of window Form_Note_1 of form Form_Note_1 = l_Note_ID;
'Display Name' of window Form_Note_1 of form
➥ Form_Note_1 = l_Display_Name;
if not isthere then
run script '(L) Dummy WIN PRE' of window Form_Note_1
➥ of form Form_Note_1;
end if;
150 IN T E G R AT I O N G U ID E
C H A P T E R 1 8 N O T E S
{----------------------------------------------------------
This section checks the SY_Notes_MSTR table for an existing record. If one
is present, it hides the Note Absent button and shows the Note Present
button.
----------------------------------------------------------}
Record-level notes
Record-level notes provide the user with a means of attaching comments to a
specific record that can be shared with other users. The following illustration shows
how a note button appears in a window.
Record-level note buttons are actually made up of two different button fields that
indicate whether a note is attached to the current record. The note button with a
“clean sheet” should appear if there isn’t a record-level note attached to the record.
The note button with the “filled sheet” should appear once the user attaches a note
to a record.
A note button should appear to the right of the lookup button for a record’s key
field. If no lookup button is present, no note button should be present either.
You can display this window by opening one of five forms; Form_Note_1,
Form_Note_2, Form_Note_3, Form_Note_4 and Form_Note_5. Microsoft Dynamics
GP uses multiple forms in order to allow users to enter or edit multiple instances of
notes at any given time. When a note is entered or changed and the user clicks
Attach, the note ID, date, time and note text and will be stored in the
SY_Record_Notes_MSTR table.
152 IN T E G R AT I O N G U ID E
C H A P T E R 1 8 N O T E S
Using procedures
Refer to the Procedure The following table explains each of the procedures used to implement record-level
Design Documents notes.
available with the SDK
for additional Name Description
information about Check_Note_Index This script ascertains which (if any) of the five note forms is
these procedures. open. If one is open, it determines if the record note
displayed is the one for the current developer record.
Get_Next_Form_Note_To_Open This script ascertains which note form (if any) is currently
open and returns an integer indicating the next available
note form. There can be a maximum of five note forms
open. For example, if Form_Note_1 and Form_Note_3 are
open, a 2 will be returned (indicating Form_Note_2).
Check_For_Record_Note This script reads the SY_Record_Notes_MSTR table based
on the note index for the current developer record. If no
matching record is found, 0 is returned. If a matching
record is found, 1 is returned. The table is closed at the
completion of the script.
Get_Next_Note_Index This script retrieves a note index for a new developer
record. This must be stored with the developer record and
the note record.
Delete_Record_Note This script removes a record-level note from the
SY_Record_Notes_MSTR table.
{----------------------------------------------------------
This portion of the script checks to see whether a note
form with the current note index is already open.
----------------------------------------------------------}
call Check_Note_Index, 'Note Index', l_Found, l_Form_Number;
if not l_Found then
call Get_Next_Form_Note_To_Open, l_Form_Number;
if l_Form_Number = 0 then
{Too many note forms are open. A message will appear.}
abort script;
end if;
end if;
154 IN T E G R AT I O N G U ID E
C H A P T E R 1 8 N O T E S
{----------------------------------------------------------
This portion of the script opens the next available notes
form and sets its window fields. There are five forms
available.
----------------------------------------------------------}
if l_Form_Number = 1 then
open form Form_Note_1 return to 'Dummy Record Note Show Hide';
'Record Note' of window Form_Note_1 of form Form_Note_1 = true;
'Note ID' of window Form_Note_1 of form Form_Note_1 = l_Note_ID;
'Note Index' of window Form_Note_1 of form Form_Note_1 = 'Note Index';
if not l_Found then
run script '(L) Dummy WIN PRE' of window Form_Note_1
➥ of form Form_Note_1;
end if;
else
open form Form_Note_5 return to 'Dummy Record Note Show Hide';
'Record Note' of window Form_Note_5 of form Form_Note_5 = true;
'Note ID' of window Form_Note_5 of form Form_Note_5 = l_Note_ID;
'Note Index' of window Form_Note_5 of form Form_Note_5 = 'Note Index';
if not l_Found then
run script '(L) Dummy WIN PRE' of window Form_Note_5
➥ of form Form_Note_5;
end if;
end if;
5. Add a change script to the Dummy Record Note Show Hide field.
This script runs when the user initially displays the record (see step 6). The
procedure Check_For_Record_Note attempts to read the
SY_Record_Notes_MSTR table based on the note index for the displayed
record. If a note record is found, this script sets the ‘Dummy Record Note Show
Hide’ field to 1 to display the button fields appropriately.
156 IN T E G R AT I O N G U ID E
C H A P T E R 1 8 N O T E S
Using passwords
The User Password Setup dialog allows users to apply a new password, or change a
password for access to a given record. This dialog appears when the user clicks the
password padlock button. The following illustration shows the User Password
Setup dialog.
Password control requires that you store the password entered in this dialog with
the record, and allow access to the record only if the user enters its corresponding
password.
Once the user saves the record and attempts to access the record again, another
dialog appears (invoked from the getstring() function), asking the user to enter the
password assigned previously.
A password dialog
appears if there is a
password for a given
record.
Visible False
Editable False
{----------------------------------------------------------------
If there is an existing password for the lead record, set a field to that
password, allowing the user to enter the old password in the User Password
Setup window prior to entering a different one.
----------------------------------------------------------------}
'Dummy Password' of window Set_Change_Password of form
➥ SY_Set_Change_Password = 'Lead Password' of table IG_Leads_MSTR;
160 IN T E G R AT I O N G U ID E
C H A P T E R 1 9 P AS S WO R D C O N TR O L
162 IN T E G R AT I O N G U ID E
Chapter 20: Data Entry Conventions
Microsoft Dynamics GP uses several data entry conventions for organizing how
information appears on a window. The following conventions are discussed:
• Required fields
• Prompts
• Auto-complete
• Field groups
• Tab sequence
• Using product names
Required fields
Required fields are window fields that must contain information in order to save a
record properly. Set the Required property to True for any field that functions as a
primary key or key segment. This ensures that the user enters the key information
required to store the record.
required field
Once you’ve positioned the pointer over the prompt, release the mouse button;
a highlight will flash to indicate that the link was successful. Link the remainder
of the required fields. When you’ve finished, choose Link Prompt again to
unmark the menu item.
Date fields
When using date fields in the windows for your integration, be sure to account for
the size of the calendar drop-down that appears within the date field. We
recommend that date fields be 101 pixels wide for optimal display. This allows a full
4-digit year to display with large fonts.
If you don’t have this much space available, we recommend that date fields be a
minimum of 85 pixels wide.
Prompts
A prompt provides a label for a field. All fields or controls displayed in a window
must have a prompt; however, push buttons, single check box controls and radio
buttons store prompts as static text within the data type definition for each. The
following illustration shows a typical prompt.
prompt field
164 IN T E G R AT I O N G U ID E
C H A PT E R 2 0 D AT A E N T R Y C O N V E N T IO N S
Creating prompts
Use the following procedure when creating prompts so they appear like standard
prompts in Microsoft Dynamics GP.
Appearance 3D Highlight
BackColor System - Button Face
Border True
FontColor System - Button Text
Pattern None
PatternColor Black
Refer to Required fields • Prompts for fields that you’ve marked as required (the field’s Required
on page 163 for more property is true) will appear in the required fields format when linked. Users
information about can specify this format using the User Display Preferences window in Microsoft
creating required Dynamics GP.
fields.
• Prompts that you’ve linked to fields will appear dimmed when you use the
disable statement to disable the field.
To link a prompt to its field, open the Layout window and choose Link Prompt from
the Tools menu. Click the field you want linked, and drag the pointer to the prompt
you want the field linked to. Once you’ve positioned the pointer over the prompt,
release the mouse button; a highlight will flash to indicate that the link was
successful. Link the remainder of the fields, then choose Link Prompt again to
unmark the menu item.
Standard Description
Naming Fields should use short prompts (such as “Name” instead of “Lead Name”)
only when a previous prompt has used the full name within the same window.
Abbreviations Use abbreviations consistently. If an abbreviation could also be another word,
use a period after the abbreviation. For example, use “No.” as the abbreviation
for “Number,” but “Acct” for “Account”.
Punctuation Prompts should never use punctuation other than a colon (:). Use a colon after
prompts for list fields, radio button groups and check box groups.
Capitalize the first letter of each word in the prompt.
Standard Description
General Prompt text should appear left-justified in all cases.
By default, prompts use the System font. Prompts should be wide enough to
display properly when the operating system is set to display large fonts.
International Design your prompts to allow for translation into other languages. Since
translating prompts can result in longer prompts, always make the prompt
approximately 30% wider than the size required to accommodate the text.
Positioning Position prompts no less than 8 pixels from the left edge of the window area.
Auto-complete
To be consistent with Microsoft Dynamics GP, the control field for any maintenance
window you create should have its AutoComplete property set to true. This allows
the user to easily access data by selecting previously entered values from a list.
Users can control whether they use auto-complete by setting the appropriate user
preference.
For example, Lead ID field in the Lead Maintenance window has auto-complete
enabled. If the user chooses to use auto-complete, the auto-complete list will
automatically be displayed for this field.
AutoComplete is set to
true for the Lead ID field.
Field groups
A field group is an area of the window that contains closely related fields. In most
Microsoft Dynamics GP windows, field groups are used to clearly delineate header,
detail and summary information in the window. The following illustration shows a
typical division of a window’s workable area based on the information each area
contains.
Be sure to allow enough space between the groups to clearly indicate which fields
belong to each group.
166 IN T E G R AT I O N G U ID E
C H A PT E R 2 0 D AT A E N T R Y C O N V E N T IO N S
Tab sequence
A tab sequence moves the focus from one field to the next field in the sequence
when a user presses the TAB key. The tab sequence helps reduce unnecessary
keystrokes, enables users to enter data in a logical order and increases keyboard
efficiency.
Use the following procedure when setting a tab sequence for windows that will
appear in Microsoft Dynamics GP.
1 3
2 4
5 11
6 12
7 13
8
9 10 14
15
16
17
If there are any push button controls within the window area, set push button
controls beginning with the top (or leftmost) button, and ending with the
bottom (or rightmost) button.
18 19 20
21
• Lookups
• Notes
• Browse buttons
• Help buttons
• Password buttons
• Print button
• Zoom buttons
If the token specifies a product for which a product name cannot be found, the
string [unknown] is substituted.
You can also use product tokens to include the name of a product in static strings.
The following static string will include the name of the sample integrating
application, which has the product ID 3333:
@PROD3333@ Options:
If you need to use product names in strings you create, you can use the
Utility_SubstituteTokens() function to replace the product tokens with the
corresponding product names.
168 IN T E G R AT I O N G U ID E
PART 5: NAVIGATION
Part 5: Navigation
Use the information in this portion of the documentation to learn about adding
navigation elements to your integration. The following is a list of the topics
discussed, along with a brief explanation of each:
• Chapter 21, “Commands,” describes how work with commands and command
forms for your integration.
• Chapter 22, “Menus in Microsoft Dynamics GP,” explains how to add items to
menus in Microsoft Dynamics GP.
• Chapter 23, “Toolbars in Microsoft Dynamics GP,” describes how to add items
to toolbars in Microsoft Dynamics GP.
• Chapter 25, “Shortcuts,” explains how to add shortcuts to the Navigation pane.
170 IN T E G R AT I O N G U ID E
Chapter 21: Commands
Commands are an essential part of the navigation for your integration. They allow
navigation items for your integration to appear seamlessly with the navigation
items for Microsoft Dynamics GP. Information about commands is divided into the
following sections:
• Command overview
• Command forms
• Defining commands
• Opening the command form
• Closing the command form
Command overview
Commands are used to define actions for your application. A command can open a
form, or can execute a script attached to the command. A command can also be
used to contain a list of other commands.
In Microsoft Dynamics GP, commands are used to define the contents of the menus
and toolbars displayed to the user. Special windows in Microsoft Dynamics GP
allow the user to customize the menus and toolbars. Users can specify how the
various commands are organized and displayed.
You will define commands for your integrating application, and add them to the
menus and toolbars that are displayed in the Microsoft Dynamics GP interface. It’s
important that you do this using the capabilities provided within the Microsoft
Dynamics GP application, rather than by directly using commands such as
CommandList_Add(). Using the methods and functions provided by the Microsoft
Dynamics GP application allows your application’s commands to participate in the
customization and security features of the application.
Command forms
Commands are a form-level resource. For your integrating application, we
recommend that you create a separate form that will contain the commands you
define for your integration. To make it easy to find the commands that are defined
within Microsoft Dynamics GP, consider using the following naming scheme for
your command form:
Command_name
For the name portion, substitute something that uniquely identified your
application. For example, the command form for the sample integrating application
is named Command_IG_Sample.
The command form should contain one window with the following names:
These names prevent the command form from appearing in the Security Setup
window and from being included in activity tracking.
Be sure that you set the AutoOpen property for the window to False to prevent the dummy
window from being displayed when you open the command form.
Defining commands
When you define the commands for your integration, use the following guidelines
to maintain consistency within the application.
Commands to create
Create commands for the following items in your integration:
• Any forms that are opened directly from a menu or a toolbar. This includes any
forms that a user may want to explicitly open, even if they are not part the
integration’s default navigation.
• Any actions or processes that a user can start independently, or that you want to
specifically control access to.
Naming commands
When naming commands, use the following conventions:
Images
Native pictures or icon resources are used for command images. In Microsoft
Dynamics GP, several images used for commands are defined as native pictures in
the Dynamics.dic dictionary. Several other images used for commands are defined
as icon resources in the GPIcons.dll file that is installed with Microsoft Dynamics
GP.
Various native pictures for commands are already defined in the Dynamics.dic
dictionary, and may be appropriate for your commands. If you have implemented
standard windows for your integration, such as transaction, inquiry, or list
windows, we recommend that you use the standard images for the corresponding
commands. The images are listed in the following table.
Cmd_Inquiry Cmd_Setup
Cmd_List Cmd_Transactions
Cmd_Reports Cmd_Utilities
172 IN T E G R AT I O N G U ID E
C H A P T E R 2 1 C O M M A N D S
If you create your own command images, the images should be 20 pixels by 20
pixels to display properly on a toolbar. Native pictures used for commands typically
have Cmd_ as the prefix for their name.
The icon images included in the GPIcons.dll are typically used when creating
commands that are used as actions for lists. The Dynamics.dic dictionary already
contains a reference to this icon assembly, so the icon resources in this resource
assembly are easily available for your. You will learn more about creating
commands for list actions in Commands for the Action Pane on page 212.
The following example shows the registration for the trigger that opens the
Command_IG_Sample command form in the sample integrating application:
l_result = Trigger_RegisterProcedure(script OpenCommandForms,
➥ TRIGGER_AFTER_ORIGINAL, script IG_OpenCommandForm);
if l_result <> SY_NOERR then
warning "Procedure trigger registration failed.";
end if;
The following script runs when the trigger is activated, and opens the
Command_IG_Sample form.
open form Command_IG_Sample;
The following script runs when the trigger is activated, and closes the
Command_IG_Sample form.
close form Command_IG_Sample;
Command security
You control access to the functionality in your application by specifying whether
commands are visible and enabled. When you disable or hide commands for you
integration, users cannot access the functionality provided by those commands.
One common location for integrations to control access to commands is in the form
pre script for the command form. Access (such as registration keys) can be checked
at the time the command form is opened. If access shouldn’t be allowed, the
commands on the form can be hidden and disabled.
Microsoft Dynamics GP provides two procedures that you can use to control access
to the commands for your integration. The Command_HideAndDisable and
Command_ShowAndEnable procedures provide a standard way for integrations
to enable and disable commands. By using common procedures, Microsoft
Dynamics GP can choose to display the commands, but leave them in the disabled
state so they cannot be used. This can be useful so that all commands can be seen,
such as when testing an application.
174 IN T E G R AT I O N G U ID E
Chapter 22: Menus in Microsoft Dynamics GP
Menus in the Area Pages are the primary method of navigation within the Microsoft
Dynamics GP application. As an alternative, these same menu items are also
available in the “Main” toolbar and from “Tools” submenu of the Microsoft
Dynamics GP menu. You will add commands for your integration to the menus
already defined in Microsoft Dynamics GP. Information about menus is divided
into the following sections:
• Menu overview
• Menu implementation
• Menu structure in Microsoft Dynamics GP
• Viewing the menu structure
• Adding to Microsoft Dynamics GP menus
• Menu creation procedure
Menu overview
The menus in Microsoft Dynamics GP are created dynamically, each time a user logs
into the accounting system. Security settings control what items appear in the set of
menus displayed for a specific user. This prevents users from trying to access items
they do not have permission to see, and reduces clutter in the menu structure.
The menu items in the Area Pages are the primary method of navigation in
Microsoft Dynamics GP. To display an Area Page, the user selects it in the
Navigation Pane. For example, the following is the Sales Area Page. It displays the
various menu items that are available to complete sales-related tasks.
You will create commands for the items in your integration that you want to access
from the Area Pages or the alternative menus. When you add commands to the
Area Pages, they will automatically be included in the corresponding alternative
menus.
These same commands you create for menu items will typically be used for toolbar
items as well. Refer to Chapter 21, “Commands,” for more information about
creating commands for your integration. Code in your integrating application will
add the commands to the appropriate locations in the menu structure.
Menu implementation
To understand how to structure the code that adds menu items for your integration,
it is useful to know how menus are implemented. Microsoft Dynamics GP stores a
default set of menus in the syMenuMstr (SY07110) table. If a user customizes the
menus, their customized menu set is saved in the syMenuMstr table.
The menu structure displayed for a user is built each time that user logs into
Microsoft Dynamics GP. If the user has made customizations to the menus, the
user’s customized set of menu items is used. Otherwise the default set of menus is
used.
Every integrating dictionary that will have menu items must contain sanScript code
that defines the default menu items for that application. Each time a user logs into
Microsoft Dynamics GP, this code to define the default menus will be run, ensuring
that the default menu structure is always up-to-date.
Once the default menu structure has been updated, Microsoft Dynamics GP is ready
to load the appropriate set of menus for the current user. Either the default set or the
user’s customized set will be used, depending on whether the user has made menu
customizations.
Menus built from sanScript code that is run directly from a dictionary can be
constructed more quickly than those built from information stored in a SQL table.
Microsoft Dynamics GP uses this fact to optimize how the menu structure for a user
is built.
• If the user has customized their set of menus, the menu information from the
syMenuMstr table will be used.
• If the user has not made any menu customizations, the default menu set is used.
Rather than load this default menu set from the syMenuMstr table, the
sanScript code that defines the default menu items for each dictionary is called
again. This will load the default menu set more quickly.
When you write the sanScript code to define your integration’s menu items, the
code must be able to work with both of these cases. The code from the sample
integrating application will show you how to structure your code to create menu
items.
176 IN T E G R AT I O N G U ID E
C H A P T E R 2 2 M EN U S I N M I C R O S O F T D Y N A M I C S G P
178 IN T E G R AT I O N G U ID E
C H A P T E R 2 2 M EN U S I N M I C R O S O F T D Y N A M I C S G P
The other menus are managed by the Microsoft Dynamics GP application, and
should not contain any third-party menu items.
Adding commands
Refer to Part 11, Script Microsoft Dynamics GP provides the AddCommandToMenu() global function that
Reference, for more you will use to add commands to menus. Use the table in the section Menu structure
information about in Microsoft Dynamics GP on page 177 to find the form name and command list
these procedures and (menu or submenu) to which you want to add the command. You will also use the
functions. resourceid() function to look up the resource IDs of the command forms and
commands.
For example, the following code adds the IG_Lead_Maintenance command to the
end of the CL_Sales_Cards command list.
Seq = 0;
Status = AddCommandToMenu(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Cards of form Command_Sales),
Seq,
3333,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Maintenance of form Command_IG_Sample),
true,
LoadMode);
Notice that the resourceid() function is used to look up the resource IDs of the
commands and command forms accessed, such as the CL_Sales_Cards command
and the Command_Sales form.
180 IN T E G R AT I O N G U ID E
C H A P T E R 2 2 M EN U S I N M I C R O S O F T D Y N A M I C S G P
Adding separators
Separarators are a special built-in command that you can add to menus. Like other
commands, you add them using the AddCommandToMenu() function. The
following special constants are used to refer to the separator command:
Constant Description
CMD_BUILTINCMD_DICTID Specifies the ID of the dictionary that contains the separator
built-in command.
CMD_BUILTINCMD_FORMID Specifies the resource ID of the form that defines the
separator built-in command.
cmdSeparator The built-in separator command.
For example, the following code adds a separator to the end of the CL_Sales_Cards
command list.
Seq = 0;
Status = AddCommandToMenu(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Cards of form Command_Sales),
Seq,
CMD_BUILTINCMD_DICTID,
CMD_BUILTINCMD_FORMID,
resourceid(command cmdSeparator),
true,
LoadMode);
When you add your menu items, we recommend that you add them to the end of the menu or
submenu. You should also consider using a separator to separate your items from the default
items.
Adding submenus
To add a submenu, you will use the AddCommandToMenu() function to add a
command list command to an existing menu. Once the command list has been
added, use this same function to add commands to the new submenu.
Parameters
Your integration will have one procedure that will create the default set of menu
items for the integration. This procedure will run in response to the trigger
registered for the CreateDefaultMenuStructure procedure.
in integer LoadMode;
optional in boolean ShowProgress;
The LoadMode parameter indicates what action the menu creation procedure will
be performing, based on the value passed in through the parameter. It will
correspond to one of the following constants:
Constant Description
MENULOAD_TOTABLE The menu items are being added to the default menu set in the
syMenuMstr table.
MENULOAD_TOMEMORY The menu items are being added directly to the menu set displayed
in Microsoft Dynamics GP.
Execution
The menu creation procedure for your integration will run once when the user logs
into Microsoft Dynamics GP. The LoadMode parameter will correspond to the
MENULOAD_TOTABLE constant, indicating that the menu creation procedure
should examine the default menu items for the integration. If they do not exist, the
menu creation procedure should add them to the default menu set.
If the user has not customized their menu set, the menu creation procedure will be
run again. The LoadMode parameter will correspond to the
MENULOAD_TOMEMORY constant, indicating that the menu creation procedure
should add its default menu items directly to the menu structure in Microsoft
Dynamics GP.
For the items added to the Cards and Inquiry menus, the sequence number is set to
0 so the items are added to the end of the specified menu. The other items are added
to specific locations in the menus, using the FindCommandInMenu() function.
If menu items are being added to the default menu set stored in the syMenuMstr
table, the MenusExistForProduct() function is used to verify whether the menu
items already exist. If they do, no items are added. Notice that the LoadMode
parameter passed into the procedure is used within the AddCommandToMenu()
function to load the menu commands appropriately to either the syMenuMstr table
or to the menu set for the current user.
182 IN T E G R AT I O N G U ID E
C H A P T E R 2 2 M EN U S I N M I C R O S O F T D Y N A M I C S G P
in integer LoadMode;
optional in boolean ShowProgress;
Status = AddCommandToMenu(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Inquiry of form Command_Sales),
Seq,
CMD_BUILTINCMD_DICTID,
CMD_BUILTINCMD_FORMID,
resourceid(command cmdSeparator),
true,
LoadMode);
Status = AddCommandToMenu(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Setup of form Command_Sales),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Contact_History_Setup of form
➥ Command_IG_Sample),
true,
LoadMode);
184 IN T E G R AT I O N G U ID E
C H A P T E R 2 2 M EN U S I N M I C R O S O F T D Y N A M I C S G P
Status = AddCommandToMenu(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Reports of form Command_Sales),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Reports of form Command_IG_Sample),
true,
LoadMode);
Status = AddCommandToMenu(CMD_BUILTINCMD_DICTID,
CMD_BUILTINCMD_FORMID,
resourceid(command cmdToolbarContextMenu),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command Toolbar_IGSample of form Command_IG_Sample),
true,
LoadMode);
• Toolbar overview
• Toolbar implementation
• Toolbars in Microsoft Dynamics GP
• Adding to Microsoft Dynamics GP toolbars
• Toolbar creation procedure
Toolbar overview
Toolbars display groups of commands in the form of a toolbar. The toolbars in
Microsoft Dynamics GP are created dynamically each time a user logs into the
accounting system. Security settings and user preferences control what items
appear on each toolbar. Each user can customize the toolbars to have their own
specific arrangement.
You can add items to existing Microsoft Dynamics GP toolbars. You can also create
new toolbars for your integrating application. For example, the following toolbar is
defined in the sample integrating application:
You will create commands for the items in your integration that you want to appear
on toolbars. These same commands will typically be used for menu navigation as
well. Refer to Chapter 21, “Commands,” for more information about creating
commands for your integration. Code in your integrating application will add the
commands to the appropriate locations for each toolbar.
Toolbar implementation
A default toolbar configuration is stored by Microsoft Dynamics GP. Each user
begins with a copy of this default configuration, which they can customize to meet
their needs. When a user logs into the system, their personal toolbar configuration is
used.
When you add toolbars and toolbar items, you will add them to the default
configuration. The items you add can also be replicated for each user defined in the
system, allowing all users to have access to the toolbars and toolbar commands.
It’s important that you add your toolbars and toolbar items for your integration
only once. You should not add items each time Microsoft Dynamics GP is launched.
Use the ExistsForUserID() function in Microsoft Dynamics GP to verify whether
toolbars have been defined for your product. Use the ButtonsExistForProduct()
function to verify whether toolbar items have been defined for your products.
Adding commands
Microsoft Dynamics GP provides the AddCommandToCmdBar() global function
that you will use to add commands to toolbars. Use the table in the section Toolbars
in Microsoft Dynamics GP on page 188 to find the form name and command list for
the toolbar to which you want to add the command. You will also use the
resourceid() function to look up the resource IDs of the command forms and
commands.
For example, the following code adds the IG_Lead_Maintenance command to the
end of the Sales toolbar.
Seq = 0;
status = AddCommandToCmdBar(DYNAMICS,
resourceid(form Command_System),
resourceid(command Toolbar_Sales of form Command_System),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Maintenance of form Command_IG_Sample),
true,
MENULOAD_TOTABLE);
Notice that the resourceid() function is used to look up the resource IDs of the
commands and command forms accessed, such as the Toolbar_Sales command and
the Command_System form.
188 IN T E G R AT I O N G U ID E
C H A P T E R 2 3 T O O L B AR S I N M I C R O S O F T D Y N A M I C S G P
Adding separators
Separarators are a special built-in command that you can add to toolbars. Like other
commands, you add them using the AddCommandToCmdBar() function. The
following special constants are used to refer to the separator command:
Constant Description
CMD_BUILTINCMD_DICTID Specifies the ID of the dictionary that contains the separator
built-in command.
CMD_BUILTINCMD_FORMID Specifies the resource ID of the form that defines the
separator built-in command.
cmdSeparator The built-in separator command.
For example, the following code adds a separator to the end of the Sales toolbar,
defined by the Toolbar_Sales command list.
Seq = 0;
Status = AddCommandToCmdBar(DYNAMICS,
resourceid(form Command_System),
resourceid(command Toolbar_Sales of form Command_System),
Seq,
CMD_BUILTINCMD_DICTID,
CMD_BUILTINCMD_FORMID,
resourceid(command cmdSeparator),
true,
MENULOAD_TOTABLE);
The following example shows the registration in the sample integrating application
for the trigger that runs in response to the CreateDefaultCmdBarButtons procedure
in Microsoft Dynamics GP. When the trigger is activated, the
IG_CreateToolbarItems procedure is run.
l_result = Trigger_RegisterProcedure(script
➥ CreateDefaultCmdBarButtons, TRIGGER_AFTER_ORIGINAL, script
➥ IG_CreateToolbarItems);
if l_result <> SY_NOERR then
warning "Procedure trigger registration failed.";
end if;
{Add the toolbar and clone for each user who has toolbars}
pos = 0; {Place at the beginning of the row}
status = AddCommandBar("",
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
true, {visibility}
2, {row number}
pos, {position}
true) of form syCmdBarObj;
190 IN T E G R AT I O N G U ID E
C H A P T E R 2 3 T O O L B AR S I N M I C R O S O F T D Y N A M I C S G P
The following is the toolbar command creation procedure for the sample integrating
application. It runs in response to the trigger for the CreateDefaultCmdBarButtons
procedure. The trigger processing procedure uses the ButtonsExistForProduct()
function to find whether commands have already been added to the toolbar. If they
have not, it uses the AddCommandToCmdBar() function to add two items that will
appear on the toolbar.
Seq = 1;
status = AddCommandToCmdBar(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Maintenance of form Command_IG_Sample),
true, {available for all users}
MENULOAD_TOTABLE);
increment Seq;
status = AddCommandToCmdBar(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Inquiry of form Command_IG_Sample),
true, {available for all users}
MENULOAD_TOTABLE);
Create a command for the item to add to the Toolbars context menu, just as you
would any other command for your integration. The Toolbars context menu is a
built-in command defined by Dexterity. For example, the Toolbar_IGSample
command (a script command) is defined in the Command_IG_Sample command
form for sample integrating application. The command is added to the the Toolbars
context menu to control access to the sample toolbar.
Typically, the menu item is added by the same procedure used to add the other
menu items for your integraiton. For example, the following is a portion of the
IG_CreateMenuItems procedure in the sample integration. It adds the command for
the sample toolbar to the Toolbars context menu.
{Add the item to display the sample toolbar}
{Find the appropriate location of the Custom toolbar item}
Seq = FindCommandInMenu(CMD_BUILTINCMD_DICTID,
CMD_BUILTINCMD_FORMID,
resourceid(command cmdToolbarContextMenu),
DYNAMICS,
resourceid(form Command_System),
resourceid(command Toolbar_Custom of form Command_System),
LoadMode,
"");
Status = AddCommandToMenu(CMD_BUILTINCMD_DICTID,
CMD_BUILTINCMD_FORMID,
resourceid(command cmdToolbarContextMenu),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command Toolbar_IGSample of form Command_IG_Sample),
true,
LoadMode);
The script attached to the command performs two actions when the item is chosen
from the Toolbars context menu. It retrieves the tags for the menu item and the
toolbar the command is controlling. It uses these tags to toggle the state of the
toolbar and the check mark for the menu item. The following is the script for the
Toolbar_IGSample command for the sample integration.
192 IN T E G R AT I O N G U ID E
C H A P T E R 2 3 T O O L B AR S I N M I C R O S O F T D Y N A M I C S G P
Information about defining a Navigation Pane category and Area Page is divided
into the following sections:
• Area Page
• Navigation pane category
Area Page
The first item in each Navigation pane category is a link to the Area Page for that
category. The Area Page displays links that allow the user to navigate to various
windows and reports that are part of the category.
The command used for the Area Page should have the following characteristics:
Command Name The command name should indicate that the command is
being used for an area page. For instance, the command for the sample integrating
application is named AreaPage_IGSample.
Display Name This name is used for the text of the Area Page link that appears
in the Navigation Pane.
Type The command type must be set to Script. The script defines what items are
displayed in the Area Page. Details of this script are found in the next section.
• Adds commands and command lists for items that appear on the page.
• Displays the Area Page.
The following example shows the code for command that defines the sample Area
Page in the sample integrating application.
{Reports}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(451) {Reports}, IMAGE_REPORTS of form syAreaPageXML, true, 1;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Reports
➥ of form Command_IG_Sample;
{Inquiry}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(4426) {Inquiry}, IMAGE_INQUIRY of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Inquiry
➥ of form Command_IG_Sample;
{Setup}
call AddContentArea of form syAreaPageXML, XMLState, getmsg(860) {Setup},
➥ IMAGE_SETUP of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command
➥ IG_Contact_History_Setup of form Command_IG_Sample;
end if;
196 IN T E G R AT I O N G U ID E
C H A P T E R 2 4 N A V IG A TI O N P A N E C A T EG O R I E S A N D A R E A P A G E S
Command Name The command name should indicate that the command is
being used for a Navigation pane category. For instance, the command for the
sample integrating application is Navigation_IGSample.
Display Name This name is used for the button in the Navigation Pane.
Normal Image This should be set to an image that represents the Navigation
pane category.
The following example is a portion of the Startup script for the sample integrating
application. It registers the trigger for the CreateDefaultNavBarButtons procedure.
l_result = Trigger_RegisterProcedure(script CreateDefaultNavBarButtons,
➥ TRIGGER_AFTER_ORIGINAL, script IG_CreateNavigationBarButton);
if l_result <> SY_NOERR then
warning "Trigger registration for CreateDefaultNavBarButtons failed.";
end if;
The following is the trigger processing procedure that adds the Navigation pane
category for the sample integrating application. It uses the AddNavBarButton()
function to add the new category, but only if categories haven’t been added already.
local string sWhere;
local integer nStatus, nSeq;
{Find out whether the Navigation pane categories for this product have already
been added}
range clear table syNavBarButtons;
range table syNavBarButtons where sWhere;
get first table syNavBarButtons;
if err() = OKAY then
abort script;
end if;
nSeq = 0;
{Add the button to navigation}
nStatus = AddNavBarButton("",
nSeq,
true,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command Navigation_IGSample of form Command_IG_Sample),
0, 0, 0,
true) of form syNavBarBtnObj;
The following example is a portion of the Startup script for the sample integrating
application. It registers the trigger for the CreateDefaultNavButtonMenuStructure
procedure.
l_result = Trigger_RegisterProcedure(script
CreateDefaultNavButtonMenuStructure, TRIGGER_AFTER_ORIGINAL, script
IG_CreateNavigationBarItems);
if l_result <> SY_NOERR then
warning "Procedure trigger registration for
CreateDefaultNavButtonMenuStructure failed.";
end if;
The following is the trigger processing procedure that adds the items to the new
Navigation pane for the sample integrating application. It adds the Area Page and
the Leads list to the navigation.
in integer nLoadMode;
optional in boolean fShowProgress = false;
198 IN T E G R AT I O N G U ID E
Chapter 25: Shortcuts
The Navigation pane in Microsoft Dynamics GP has a Shortcuts area that allows the
user to create shortcuts for navigation. Your integrating applications can add
shortcuts to the Navigation pane. Information about adding shortcuts is divided
into the following sections:
• Adding Shortcuts
• Restricting shortcuts
Adding Shortcuts
All of the functions and constants used to add items to the Shortcut Bar are part of
the syScBarObj form. When you use these functions or constants, you will need to
use the “of form” qualifier to indicate they are part of the syScBarObj form.
For details about the If an integrating application adds shortcuts, it typically does so during installation.
functions used for For example, the following code is an optional part of the installation procedure
shortcuts, refer to used for the sample integrating application.
Shortcut scripts on
page 623. if ask("Do you want to add shortcuts for the sample integrating application?",
➥ "Yes","No","") = ASKBUTTON1 then
{Add shortcuts for every user in the system.}
get first table SY_Users_MSTR;
while err() <> EOF do
call IG_Add_Shortcuts, 'User ID' of table SY_Users_MSTR;
get next table SY_Users_MSTR;
end while;
end if;
This code displays a dialog, asking whether shortcuts should be added. If the user
clicks Yes, the IG_Add_Shortcuts procedure is run. This procedure adds shortcuts
for two of the forms in the sample integrating application.
Name: IG_Add_Shortcuts
in string UserID;
Restricting shortcuts
Users can add shortcuts to windows by choosing Current Window or Other
Window from the Add menu on the Navigation pane. In some cases, you may not
want the user to be able to add an item as a shortcut. You can add a form-level
constant to control how the form can be added as a shortcut.
To control the shortcut behavior for a form, define a constant with the following
name:
~SHORTCUT~
The integer value of this contant specifies whether a shortcut can be created if it’s
the current form, or if the form will appear in the Add Other Windows list. The
following table lists the possible values:
If a form does not have any auto-open windows, it cannot be added as a shortcut.
200 IN T E G R AT I O N G U ID E
PART 6: LISTS
Part 6: Lists
Use the information in this portion of the documentation to learn about using lists
in your Microsoft Dynamics GP integration. The following is a list of the topics
discussed, along with a brief explanation of each:
• Chapter 26, “List Overview,” describes lists in Microsoft Dynamics GP and how
you can use them for your integration.
• Chapter 27, “Action Pane,” explains how to add actions to lists in Microsoft
Dynamics GP.
• Chapter 28, “Information Pane,” explains how to add content to the information
displayed for the item selected in the list.
• Chapter 29, “Card Lists,” describes how to create a card list for your integration.
• Chapter 30, “Transaction Lists,” describes how to create a transaction list for
your integration.
• Chapter 31, “Report Lists,” explains how to integrate with the Report List in
Microsoft Dynamics GP.
202 IN T E G R AT I O N G U ID E
Chapter 26: List Overview
The various lists in Microsoft Dynamics GP provide an efficient method of
navigation, and allow users to easily perform common tasks. You can integrate with
existing lists, or define your own lists for your integration. Information about lists is
divided into the following sections:
• List features
• List types
• Categories and navigation
• Opening lists by using code
• List Debugging Tools
List features
List in Microsoft Dynamics GP provide several features that make them easy to use.
Any list windows you create will also have these features.
Customization
Lists have many customization capabilities available. These include:
• Configurable columns
• Content display options
• Action Pane organization
Any lists you create or extend with customizations will be configurable through the
customization options.
Actions
Each list has an Action Pane at the top that displays the predefined actions that can
be performed for items the user has marked in the list.
Integrating applications can add actions to existing lists in Microsoft Dynamics GP.
They will also define actions for their own lists.
List types
Three types of lists are available in Microsoft Dynamics GP to display data.
Card lists
Card lists are used to view card items, such as customers, vendors, or accounts.
Transaction lists
Transaction lists are used to view date-sensitive information, such as payables
transactions or receivables transactions.
204 IN T E G R AT I O N G U ID E
C H A P T E R 2 6 L I S T O V E R V I E W
Report lists
Report lists are used to organize and generate reports for the data managed by
Microsoft Dynamics GP.
The various types of lists are divided into the following categories:
• Financial
• Sales
• Purchasing
• Administration
• Inventory
• Human Resources and Payroll
• Manufacturing
• Project
• Field Service
If you create new lists for your integration, you will have to assign them to one of
these categories. You could also create your own category. Refer to Chapter 24,
“Navigation Pane Categories and Area Pages,” for details about how to do this.
When a user opens a list through the Navigation Pane, the list content is displayed
in the main window. When a list is opened through code, it can be displayed in the
main window or in a separate window for the list. Restrictions can also be passed to
the list to restrict the information being displayed.
Opening a list
Microsoft Dynamics GP can display one card list, one trasaction list, and one report
list at a time. The lists can be in either the main Microsoft Dynamics GP window or
in a separate window. To open a list, use the List_Open procedure of the syListObj
form.
The List_Open procedure must always be called with the background keyword to prevent
conflicts with other list code that may be running.
Before you open a list using sanScript code, you must verify that a list of that type is
not already open. If a list of the specified type is already open, your code should
display a message indicating this to the user.
Opening a card list The following example shows how to verify whether a card list is already open. If
one is not, a specific card list can be opened.
local boolean list_is_open;
local string list_name;
206 IN T E G R AT I O N G U ID E
C H A P T E R 2 6 L I S T O V E R V I E W
Opening a transaction The following example shows how to verify whether a transaction list is already
list open. If one is not, a specific transaction list can be opened.
Opening a report list The following example shows how to verify whether a report list is already open. If
one is not, a specific report list can be opened.
The restriction parameters for the List_Open procedure are optional. They can be used in
addition to the standard restrictions defined for lists.
If you supply the restriction parameters for the List_Open procedure, their values
will be temporarily stored as properties for the command that is used to add the list
to the Microsoft Dynamics GP navigation. For instance, the command named
ListObj_Leads is defined to open the Leads sample card list. If the List_Open
procedure is used to open the Leads card list, and the optional restriction
parameters are supplied, they will be temporarily stored with the List_Obj_Leads
command.
You can retrieve the property values from the list command by using the
Command_GetNamedProperty() function. The following table lists the constants
defined in the syListObj form that correspond to the named properties that will be
set for the command used to open the list.
Constant Description
NAMEDPROP_RESTRICTIONTYPE The optional integer restriction parameter.
NAMEDPROP_RESTRICTIONSTRING1 The first string restriction parameter.
NAMEDPROP_RESTRICTIONSTRING2 The second string restriction parameter.
208 IN T E G R AT I O N G U ID E
C H A P T E R 2 6 L I S T O V E R V I E W
The following example shows how these named properties are retrieved for the
Leads card list in the sample integrating application.
ScriptDebugger=TRUE
210 IN T E G R AT I O N G U ID E
Chapter 27: Action Pane
The Action Pane for a list provides access to the various tasks that can be performed
for items in the list. Your Microsoft Dynamics GP integration can contain actions
that are added to the Action Pane for existing card lists, transaction lists, or report
lists. You will also define the actions for any new lists you create. Information about
actions is divided into the following sections:
• Action ID
• Commands for the Action Pane
• Command scripts
• Adding to the Action Pane
• Registering actions and groups
• Checking action access
• Verifying an action
• Executing an action
• Performing actions for marked rows
• Logging action status
• Acting on action errors
Action ID
Each action you create has an action ID, which is a long integer value that uniquely
identifies the action. For each action you are defining, assign a unique integer value
that identifies the action. Create constants for each action to make them easier to
manage in your code.
Refer to Part 11, Script Since multiple third-party products can add actions to Microsoft Dynamics GP lists,
Reference, for the ID of the product that defines the action must be encoded into the action ID. The
detailed descriptions of BuildDictSpecificID() function is used to encode an action value and product ID
the functions and into a single long integer action ID. You can use this function to determine the value
procedures used for you should assign to the constant you are creating for each action. This function
list actions. takes a dictionary ID and the numeric value of the action, and returns an encoded
value based on them.
For example, the following constant for the sample integrating application defines
the action that opens the Contact History window.
ACTION_CONTACT_HISTORY: 1
The Expressions window available within Dexterity can be used to determine the
encoded value for this action. Simply type the name and parameters for the
BuildDictSpecificID() function and click Evaluate to see the encoded value. For
example, the following illustration shows the encoded ID for the Contact History
action.
Notice how the product ID (in this case 3333) is used for the function. An additional
constant for the action is defined for the encoded value:
ACTION_CONTACT_HISTORY_ENCODED: 218431489
When a user chooses the action for a list, your code that processes the request will
use the DisassembleDictSpecificID procedure to extract the product ID and the
integer value assigned to the action. If it’s an action for your product, you will
perform the appropriate actions. If it’s not an action for your product, your code
should simply ignore it.
If you are defining actions for your own list windows, it is not necessary to encode the
product ID into your action IDs. The product is already known.
The form that contains the commands you are adding must be open before the Action Pane is
displayed. If it isn’t, the commands won’t appear on the action pane.
When defining the commands used for the Action Pane, be sure to specify the
additional “ribbon” properties that indicate how the command or command list
should appear when displayed. The following Ribbon Item Properties are available
in the Command Definition window:
Button Size Specifies the initial size of the button displayed in the Action Pane
for the command. The following table lists the available sizes:
Large
Button Type Specifies the type of action the button will perform. Set the type to
Action Button if the button will simply perform an action on the marked list items.
Set the type to Drop Dialog if the button will first display a drop dialog that allows
the user to confirm the action to be performed.
212 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
Layout Priority Specifies the preferred initial location of the button for the
command or command list. The following table lists the available locations and uses
the thick dashed outline to show where each appears within a group in the Action
Pane:
Secondary
Force Overflow
You must also specify the image to use for the action or group. The actions always
display an image. Groups display an image when they are in the collapsed state.
Typically, icon resources are used for the image display by an action or group. The
following table lists the icon resources that are used for the standard actions and
groups in Microsoft Dynamics GP. These icon resources have already been defined
in the Dynamics.dic dictionary. You should use these images when appropriate for
any groups or actions you define.
Command scripts
When an action is chosen in the Action Pane, the script for the action’s command
will be run. Typically, the command script will call the ExecuteListAction
procedure of the appropriate form listed in the following table:
The call will pass the encoded action ID indicating the action to run.
For example, the following is the script for the Contact History command for the
sample integrating application. This command was added as an action for the
Customers card list. Notice how the encoded action ID is passed, and that the
ExecuteListAction procedure for the syCardList is being called.
{Need to use the command ID with the product ID and command number encoded}
call ExecuteListAction of form syCardList, ACTION_CONTACT_HISTORY_ENCODED;
In some cases, you may want to have the user verify the action before it is
performed. You will learn more about this in Verifying an action on page 219.
The code needed to process an action can be extensive. The command script simply
starts the process. You will learn more about the details of processing an action in
Executing an action on page 220.
The data for each action is stored in the sy07240 table in the DYNAMICS database.
As you add actions, you may need to reset the actions that appear for a list. To do
this, you will need to delete the appropriate rows from the sy07240 table.
214 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
The following example is a portion of the Startup script for the sample integrating
application. It registers the trigger for the TRIGGER_LoadRibbonData procedure of
the syListObj form.
The trigger processing procedure that adds items to the Action Pane has a list object
variable passed into it. You will use this object to determine which list is being
displayed, and whether you need to add your actions to the list’s Action Pane. To
determine which list is being displayed, examine the list object’s ListID component.
It will correspond to one of the following constants:
The following example is the trigger processing procedure for the sample
integrating application that adds the Contact History action to the Customer card
list. Notice how it verifies that the Customer list is being displayed, and locates the
position of the item to be added.
{Does the Contact History command exist for the list? If not, add it.}
exists = ExistsAsAction(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Contact_History of form Command_IG_Sample),
DYNAMICS,
LISTID_CUSTOMERS,
LIST_PRIMARYVIEWID) of form syListViewCmdBarObj;
{If the command was found, add the Contact History command}
if seq <> 0 then
seq = seq + 1;
nStatus = AddCommand(DYNAMICS,
LISTID_CUSTOMERS,
LIST_PRIMARYVIEWID,
DYNAMICS,
resourceid(form ListObj_Customers),
resourceid(command CL_ModifyGroup of form ListObj_Customers),
seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Contact_History of form
➥ Command_IG_Sample),
LISTACTIONPRIORITY_SECONDARY,
LISTACTIONBTNSIZE_SMALL,
"" {caption},
true {visible},
true {clone for all list view}) of form syListViewCmdBarObj;
end if;
end if;
216 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
Each action has a corresponding command this is run when the action is performed.
Each group has a command list that defines the characteristics of the group. When
you register the command, you specify the encoded version of the Action ID that
corresponds to the command. You also specify under what conditions the action
should be available. The following table lists the available conditions:
Constant Description
LISTCMDTYPE_ALWAYSAVAILABLE The action is always available, regardless of the
number of items the user has marked in the list.
LISTCMDTYPE_SINGLESELECT The action is available when the user has marked
one item in the list.
LISTCMDTYPE_MULTISELECT The action is available when the user has marked
one or more items in the list.
LISTCMDTYPE_GROUP The item is a group.
How you register actions and groups for the Action Pane depends on whether you
are adding them to your own list or to an existing Microsoft Dynamics GP list.
For example, assume that the Qualify action can be performed for the items selected
in the list. This action would be active as long as the user has marked one or more
items to qualify. However, if the user marked an item that had already been
qualified, the “counts against” counter would be incremented, causing the Qualify
action to be disabled.
How you specify actions access for the Action Pane items depends on whether you
are adding actions to your own list or to an existing Microsoft Dynamics GP list.
You can refer to the script parameter documentation in the Microsoft Dynamics GP SDK to
see the set of parameters used with each CheckActionAccessForRecord procedure.
The following example is a portion of the Startup script for the sample integrating
application. It registers the trigger for the CheckActionAccessForRecord procedure
of the ListObj_Customers form used for the Customer list.
l_result = Trigger_RegisterProcedure(script CheckActionAccessForRecord of
➥ form ListObj_Customers, TRIGGER_AFTER_ORIGINAL, script
➥ IG_CheckAccessCustomerActions);
if l_result <> SY_NOERR then
warning "Procedure trigger registration failed.";
end if;
The trigger processing procedure is called once each time a user marks or unmarks
a line in the list. The procedure specifies how the item marked or unarked in the list
should be considered when determining whether the action should be accessible.
You will use the 'Table Reference' component of the list object composite passed into
the procedure to determine which row is being marked or unmarked in the list.
218 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
The parameter value returned through the “out” parameter this trigger processing
procedure specifies how the marked row should be considered. The value
corresponds to one of the following constants:
Constant Description
LISTACTIONACCESS_COUNT_NEUTRAL The marked row won’t affect the count for the
action.
LISTACTIONACCESS_COUNT_FOR The marked row will increase or decrease the
“count for” counter by one.
LISTACTIONACCESS_COUNT_AGAINST The marked row will increase or decrease the
“count against” counter by one.
For example, the following trigger processing procedure updates the action access
for two actions added to the Customer card list. Notice how the Inactive field from
the row being marked or unmarked is examined to determine which access counter
should be incremented or decremented.
in ListObjState list_object;
in integer nActionCmdTag;
out integer nAccessStatus;
Verifying an action
Actions for lists can impact a large amount of data in Microsoft Dynamics GP. For
actions that can’t easily be reversed, such as deleting marked items, you will want
the user to confirm the action before it is peformed. This is typically done with drop
dialogs that appear for buttons in the Action Pane. A typical drop dialog is shown
in the following illustration:
If a button on the Action Pane is going to display a drop dialog, the underlying command for
the action must have its Button Type property set to Drop Dialog in the Command
Definition window.
You can use the ConfirmAction() function to display a predefined drop dialog. You
can also create your own drop dialog to use for an action. To create your own drop
dialog, simply create a small window that will contain the content for the drop
dialog. In the script for the action’s command, use the as dropdialog clause with the
open window command. For example, the following sanScript code opens a drop
dialog for the Qualify action:
The Button Type for the command that will display the drop dialog must be set to Drop
Dialog in the command’s definition.
Code for the items in the drop dialog window will perform the specific action.
Using a drop dialog window for an action allows to user to perform the action
without having to open a separate window in Microsoft Dynamics GP. For
example, the following drop dialog is used for the Leads list in the sample
integrating application to qualify leads:
If you create your own drop dialog for an action, be sure to close the drop dialog
before any script code performs the action. If don’t close the drop dialog, it will
remain open and active while the action is processed. This would be confusing for
the user, since the drop dialog would remain open as a long-running action is
processed.
The following is the code for the OK button in the Qualify drop dialog. Notice how
it closes the drop dialog before the action is performed.
{Close the drop dialog -- so it's not visible while processing is occurring}
close window Qualify;
Executing an action
An action is executed when the user clicks an item in the Action Pane. How you
process an action depends on whether you are adding actions to your own list or to
an existing Microsoft Dynamics GP list.
220 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
The following example is a portion of the Startup script for the sample integrating
application. It registers the trigger for the ExecuteAction procedure of the
ListObj_Customers form used to implement the Customers list.
The trigger processing procedure that runs when the user chooses an action has a
list object variable and an action ID passed into it. You will use the action ID to find
out whether this is an action you need to process. If it is, you will use the object
variable to access the main table used for the list so you can determine what list
item the user has selected.
The following is the trigger processing procedure for the sample integrating
application that is activated whenever the user clicks an action in the Action Pane
for the Customers list. Notice that the DisassembleDictSpecificID procedure is
used to extract the product ID and action. If the action is defined by sample
integrating application, it is processed.
inout ListObjState list_object;
in long action_id;
in[ACTION_UPDATE_CONTACT_DATE]
{Update the contact date for all of the marked customers}
call IG_Update_Contact_Date, list_object;
end case;
end if;
end if;
Multi-select actions
When a multi-select action is being performed, you must retrieve a reference to the
temporary table that contains the marked rows. The GetMarkedRecordsTableRef()
function of the syListObj form retrieves the reference to this table. The
GetMarkedRecordsTableIndex() function of the syListObj form retrieves the index
number to use when accessing the records. You will use this table reference to
retrieve specific information about the current marked rows that are being
processed. The following example shows the basic looping code used to process the
marked rows.
local reference ListTableReference;
local integer ListTableIndex;
Single-select actions
When a single-select action is being performed, you must use the 'Table Reference'
component of the list object composite to find out the row that is marked. The action
will be performed for this row. The following example shows a portion of the
ExecuteAction procedure for the Leads list. This code runs in response to the Edit
Lead action. This action is a single-select action that opens the maintenance window
for the row that is marked in the list.
open form IG_Lead_Maintenance;
'Lead ID' of window 'Lead Maintenance' of form IG_Lead_Maintenance =
➥ 'Lead ID' of table (list_object:'Table Reference');
run script 'Lead ID' of window 'Lead Maintenance' of form
➥ IG_Lead_Maintenance;
222 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
Always-available actions
When an always-available action is being performed, the marked row information
available will depend on the number of rows marked in the list. If no rows are
marked, no record information is available. If one row is marked, the 'Table
Reference' component of the list object composite will contain the marked row. If
more than one row is marked, the 'Table Reference' component of the list object
composite will contain the first row that is marked, based on the current sort order
for the list. You can use the GetMarkedRecordCount() of the syListObj form to find
out the number of rows that are marked.
Refresh event
If your list processing code is keeping track of which rows in the list are marked, it
may be helpful to know when all of the rows in the list have been unmarked due to
a “refresh” event. To be notified of this situation for your list, add the
ClearMarkedRecordsEvent procedure to the list. This procedure must have the
following parameter:
Within the script that processes an action for a list, you must do the following:
• Keep track of the total number of successful and failed operations performed
Use the ActionStatus_LogError() function of the syListObj form to log the details of
each error that occurred when performing actions on list items. This function takes
several parameters that you supply to provide details about what failed for the
specific item. These details are displayed in the Status Message Detail window in
Microsoft Dynamics GP.
Errors encountered
during action processing
are displayed here.
After all of the marked items in the list have been processed, call the
ActionStatus_LogActionComplete() function of the form syListObj to indicate that
the logging action is complete. The total number of successful and failed operations
are passed as parameters to this function.
If the action being processed is a multi-select action, you must call the
List_MultiSelectActionCompleteEvent procedure to indicate that all of the items
have been processed. If you don’t use this function, the list will remain in the
“processing” state.
The data for each action status item is stored in the sy07250 table in the current
company’s database. As you log action status, you may want to see what has
actually been logged in this table.
The following example is a procedure that performs the Update Contact Date action
for the Customer card list. It processes each customer marked in the list, keeping
track of the number of customers successfully processed. Any processing errors are
logged using the ActionStatus_LogError() function.
{Use the table reference from the list object to find which Customers
are selected in the list.}
ListTableReference = GetMarkedRecordsTableRef(list_object) of form syListObj;
ListTableIndex = GetMarkedRecordsTableIndex(list_object) of form syListObj;
get first table(ListTableReference) by number ListTableIndex;
224 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
If you want to display a different message in the message bar for the list, you can
add the GetSummaryStatusMsgText procedure. This procedure is also defined for
several core lists in Microsoft Dynamics GP. To display a different message for the
message bar for core lists, you would create a procedure trigger that runs after the
GetSummaryStatusMsgText procedure. The GetSummaryStatusMsgText procedure
has the following parameters:
in syListActionStatusHdrState HdrState;
out string sMsgText;
You can create a procedure trigger for the ActOnActionError procedure defined for
the list you are creating an action for. The trigger processing procedure should run
after the procedure defined for the list. The following example registers a procedure
trigger for the ActOnActionError procedure defined for the Customer list.
l_result = Trigger_RegisterProcedure(script ActOnActionError of form
➥ ListObj_Customers, TRIGGER_AFTER_ORIGINAL, script
➥ IG_ActOnCustomerActionError);
if l_result <> SY_NOERR then
warning "Procedure trigger registration for ActOnActionError of form
➥ ListObj_Customers failed.";
end if;
In the trigger processing procedure you can perform any needed action to correct
the error, such as opening the appropriate maintenance window where the problem
can be resolved.
226 IN T E G R AT I O N G U ID E
C H A P T E R 2 7 A C T I O N P A N E
in ListDictID nListDictID;
in ListID nListID;
in ActionID nActionID;
in ErrorValue nErrorID;
in Reference sRecordID;
in ListStatusLineUserDefData UserDefData;
For transaction lists, the Information Pane contains three columns that display
header information, followed by the detailed line items for the selected transaction.
When integrating with Microsoft Dynamics GP lists, you can add additional items
to the end of each column in the header section. You can also add additional
information to the end of each line item.
The trigger processing procedure adds the items to the Information Pane section
indicated by the form-level procedure. In this example, the trigger processing
procedure uses the XMLDoc_AddHeaderField procedure to add items to the end of
the columns in the header section of the Information Pane.
The parameters for the trigger processing procedure must match those of the form-level
procedure defined on the list form. The parameter list will vary, depending on the list
implementation. Refer to Information Pane procedure reference on page 232 for the paramter
list needed for each list defined in Microsoft Dynamics GP.
in table RM_Customer_MSTR;
inout ListPrevPaneXMLState XMLState;
230 IN T E G R AT I O N G U ID E
C H A P T E R 2 8 I N F O R M A T I O N P A N E
Add the column The following example is a portion of the Startup script for the sample integrating
header. application. It registers a trigger for the XML_CreateLineColumnHeaders
procedure of the ListObj_AccountTrx form.
The parameters for the trigger processing procedure must match those of the form-level
procedure defined on the list form. The parameter list will vary, depending on the list
implementation. Refer to Information Pane procedure reference on page 232 for the paramter
list needed for each list defined in Microsoft Dynamics GP.
in integer nTrxType;
inout ListPrevPaneXMLState XMLState;
Add the line item The following example is a portion of the Startup script for the sample integrating
values. application. It registers a trigger for the XML_AddLineItem procedure of the
ListObj_AccountTrx form.
in table AccountListTemp;
inout ListPrevPaneXMLState XMLState;
• GL_TRX_HDR_WORK
• GL_Business_Form_HDR_WORK
• GL_YTD_TRX_OPEN
• GL_Account_TRX_HIST
232 IN T E G R AT I O N G U ID E
C H A P T E R 2 8 I N F O R M A T I O N P A N E
• GL_TRX_HDR_WORK
• GL_Business_Form_HDR_WORK
• GL_YTD_TRX_OPEN
• GL_Account_TRX_HIST
• GL_TRX_LINE_WORK
• GL_Business_Form_LINE_WORK
• GL_YTD_TRX_OPEN
• GL_Account_TRX_HIST
in table Batch_Headers;
in long nSubList;
inout ListPrevPaneXMLState XMLState;
in table IV_ItemList_View;
inout ListPrevPaneXMLState XMLState;
• IV_TRX_WORK_HDR
• IV_TRX_HIST_HDR
• POP_ReceiptHist
• SOP_HDR_HIST
• IVC_HDR_HIST
• bmTrxHist
234 IN T E G R AT I O N G U ID E
C H A P T E R 2 8 I N F O R M A T I O N P A N E
• IV_TRX_WORK_HDR
• IV_TRX_HIST_HDR
• POP_ReceiptHist
• SOP_HDR_HIST
• IVC_HDR_HIST
• bmTrxHist
• IV_TRX_WORK_LINE
• IV_TRX_HIST_LINE
• POP_ReceiptLineHist
• SOP_LINE_HIST
• IVC_LINE_HIST
• bmTrxCompHist
• POP_PO
• POP_POHist
• POP_Receipt
• POPReceiptHist
• PM_Manual_Payment_WORK
• PM_Payment_WORK
• PM_Transaction_WORK
• PM_Transaction_OPEN
• PM_Paid_Transaction_HIST
236 IN T E G R AT I O N G U ID E
C H A P T E R 2 8 I N F O R M A T I O N P A N E
• PM
• PM_CCHECKS
• POP_POTRX
• POP_RECEIPT
• POP_RETURN
• PM_DOC_INVOICE
• PM_DOC_FIN_CHG
• PM_DOC_MISC_CHG
• PM_DOC_RETURN
• PM_DOC_CR_MEMO
• PM_DOC_PAYMENT
• POP_DOCTYPE_INVOICE
• POP_DOCTYPE_SHIPMENT
• POP_DOCTYPE_SHIPMENT_INVOICE
• POP_DOCTYPE_IN_TRANSIT
• POP_DOCTYPE_RETURN
• POP_DOCTYPE_RETURNCREDIT
• POP_DOCTYPE_INVENTORYRETURN
• POP_DOCTYPE_INVENTORYRETURNCREDIT
• POP_PO
• POP_POHist
• POP_Receipt
• POPReceiptHist
• PM_Manual_Payment_WORK
• PM_Payment_WORK
• PM_Transaction_WORK
• PM_Transaction_OPEN
• PM_Paid_Transaction_HIST
• PM
• PM_CCHECKS
• POP_POTRX
• POP_RECEIPT
• POP_RETURN
• PM_DOC_INVOICE
• PM_DOC_FIN_CHG
• PM_DOC_MISC_CHG
• PM_DOC_RETURN
• PM_DOC_CR_MEMO
• PM_DOC_PAYMENT
• POP_DOCTYPE_INVOICE
• POP_DOCTYPE_SHIPMENT
• POP_DOCTYPE_SHIPMENT_INVOICE
• POP_DOCTYPE_IN_TRANSIT
• POP_DOCTYPE_RETURN
• POP_DOCTYPE_RETURNCREDIT
• POP_DOCTYPE_INVENTORYRETURN
• POP_DOCTYPE_INVENTORYRETURNCREDIT
• POP_POLine
• POP_POLineHist
• POP_ReceiptLine
• POP_ReceiptLineHist
• POP_POTRX
• POP_RECEIPT
• POP_RETURN
• POP_DOCTYPE_PO
• POP_DOCTYPE_DROPSHIP
• POP_DOCTYPE_BLANKET
• POP_DOCTYPE_BLANKET_DROPSHIP
238 IN T E G R AT I O N G U ID E
C H A P T E R 2 8 I N F O R M A T I O N P A N E
• POP_DOCTYPE_SHIPMENT
• POP_DOCTYPE_INVOICE
• POP_DOCTYPE_SHIPMENT_INVOICE
• POP_DOCTYPE_RETURN
• POP_DOCTYPE_RETURNCREDIT
• POP_DOCTYPE_INVENTORYRETURN
• POP_DOCTYPE_INVENTORYRETURNCREDIT
• POP_DOCTYPE_IN_TRANSIT
For PM Documents:
• PM_DOC_INVOICE
• PM_DOC_FIN_CHG
• PM_DOC_MISC_CHG
• PM_DOC_RETURN
• PM_DOC_CR_MEMO
• PM_DOC_PAYMENT
• PM_DOC_SCHEDULE
in table SOP_Prospect_MSTR;
inout ListPrevPaneXMLState XMLState;
• IVC_HDR_HIST
• IVC_HDR_WORK
• RM_Cash_WORK
• RM_Sales_WORK
• RM_OPEN
• RM_HISTORY
• SOP_HDR_HIST
• SOP_HDR_WORK
• SOP_QUOTE
• SOP_ORDER
• SOP_INVOICE
• SOP_RETURN
• SOP_BACK_ORDER
• SOP_FULFILLMENT_ORDER
• IVC_INVOICE
• IVC_RETURN
• RM_DOC_CASH
• RM_DOC_CRMEMO
• RM_DOC_DBMEMO
• RM_DOC_FINCHG
• RM_DOC_RETURNS
• RM_DOC_SALES
• RM_DOC_SCH_PP
• RM_DOC_SCH_PYMNT
• RM_DOC_SERVICE
• RM_DOC_WARR
• RM_Cash_WORK
• RM_Sales_WORK
• RM_OPEN
• SOP_HDR_HIST
• IVC_HDR_HIST
• RM_HISTORY
• SOP_HDR_WORK
• IVC_HDR_WORK
240 IN T E G R AT I O N G U ID E
C H A P T E R 2 8 I N F O R M A T I O N P A N E
• SOP_LINE_WORK
• SOP_LINE_HIST
• IVC_LINE_WORK
• IVC_LINE_HIST
in table RM_Salesperson_MSTR;
inout ListPrevPaneXMLState XMLState;
in table PM_Vendor_MSTR;
inout ListPrevPaneXMLState XMLState;
Information about implementing a card list is divided into the following sections:
Checking access
Add the The CheckListAccess procedure for the card list form is used to control access to the
CheckListAccess card list. In releases prior to Microsoft Dynamics GP 10, this procedure contained
procedure. code to verify that the user has access to the primary form used to manage the data
that is displayed in the list. If the user didn’t have access to the form, access to the
card list was denied. Beginning with Microsoft Dynamics GP 10, security tasks are
used to control access to card lists. Refer to Security task operations on page 395 for
information about creating security task operations that control access to specific list
features.
The CheckListAccess procedure can still be used to control access to a list. For
instance, you may not want to allow a list to be displayed if a specific module hasn’t
been registered. To grant access, the procedure should return true. Otherwise, the
procedure should return false.
For leads in the sample integration, the CheckListAccess procedure always allows
access. Security for this list is controlled through security tasks:
bSuccess = true;
Be sure to verify the key names for the duplicated table. You may want to change them to
names more suitable for the list’s temporary table.
244 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
Add additional fields to Some additional fields from the Dynamics.dic dictionary must be added to the
the temporary table. temporary table. These are:
InfoValue This field is used for the information icon that can be displayed for
each row in the list. This field is required only if the information icon will be
displayed. You may want to add this field now, in the event it is needed later for
your list.
Marked To Process The field is used for the check mark displayed for each row.
It is required for every list.
Attaching tables
Attach tables to the The content of a card list comes from the temporary table that is defined for the list.
card list. The master table and any other tables needed to populate the list’s temporary table
must also be attached to the list. Use the Form Definition window to attach these
tables to the card list form.
For the Leads list in the sample integration, the IG_Leads_List_TEMP table and the
IG_Leads_MSTR table were attached to the ListObj_Leads form. The
SY_Record_Notes_MSTR table is also attached, since it will be examined to verify
whether notes have been attached for each lead.
Table access
Assign a reference to The syCardList form in the Dynamics.dic dictionary must be able to access the main
the main table. table used for your card list. A reference to the main table for the card list provides
this access. You create this reference using a global procedure for your integration.
For example, the following is the procedure in the sample integrating application
that creates a reference to the IG_Leads_List_TEMP table for the Leads list.
Add the The procedure that assigns the table reference must be called each time the card list
RegisterTableRef is displayed. This in done using a trigger that will call the AssignTableRef
Trigger procedure. procedure you just created. The procedure trigger is created in the
RegisterTableRefTrigger procedure that is part of your card list form. The following
is the RegisterTableRefTrigger procedure for the Leads list.
inout integer nTriggerTag;
The tag for this trigger is automatically saved so that this trigger can be unregistered when
another list is displayed.
List columns
Add the The CreateListColumnsData procedure for the list form specifies which columns
CreateListColumns will be available for the list window. The CreateDefaultColumn() funtion is used to
Data procedure. add columns to a card list. When you add columns, you specify the following:
in ListDictID nListDictID;
in ListID nListID;
246 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
The column data for your list is stored in the sy07226 table in the DYNAMICS
database. As you create your list, you may need to reset the default columns that
appear for the list. To do this, you will need to delete the appropriate rows for your
list from the sy07226 table.
Add the Notice that the column display names are not part of the column definitions created
GetColumnName in the CreateListColumnsData procedure. The column names are used in various
procedure. locations in the list implementation, so they are defined in a separate procedure
named GetColumnName.
This procedure typically contains a case statement that returns the appropriate
column name, based on the resource ID passed into the procedure. The following is
the GetColumnName procedure for the Leads list in the sample integrating
application.
in ColFieldID sFieldID;
in ColArrayIndex iColIndex;
out string sColName;
case sFieldID
in [resourceid('Lead ID' of table IG_Leads_MSTR)]
set sColName to "Lead ID";
in [resourceid('Lead Name' of table IG_Leads_MSTR)]
set sColName to "Lead Name";
in [resourceid('Address 1' of table IG_Leads_MSTR)]
set sColName to "Address 1";
in [resourceid('Address 2' of table IG_Leads_MSTR)]
set sColName to "Address 2";
in [resourceid('City' of table IG_Leads_MSTR)]
set sColName to "City";
in [resourceid('State' of table IG_Leads_MSTR)]
set sColName to "State";
in [resourceid('Zip' of table IG_Leads_MSTR)]
set sColName to "ZIP";
in [resourceid('Contact' of table IG_Leads_MSTR)]
set sColName to "Contact";
in [resourceid('Lead Business Category' of table IG_Leads_MSTR)]
set sColName to "Category";
in [resourceid('Potential Revenue' of table IG_Leads_MSTR)]
set sColName to "Potential Revenue";
in [resourceid('Phone 1' of table IG_Leads_MSTR)]
set sColName to "Phone 1";
in [resourceid('Phone 2' of table IG_Leads_MSTR)]
set sColName to "Phone 2";
in [resourceid('Fax' of table IG_Leads_MSTR)]
set sColName to "Fax";
in [resourceid('Qualified Lead' of table IG_Leads_MSTR)]
set sColName to "Qualified";
in [resourceid('Qualification Date' of table IG_Leads_MSTR)]
set sColName to "Qualification Date";
in [resourceid('Lead Source' of table IG_Leads_MSTR)]
set sColName to "Source";
else
set sColName to "<<No Name>>";
end case;
248 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
List options
Add the Each list has numerous options that can be specified by the user, such as which
CreateListOptionsData sections of the list are displayed, and their corresponding sizes. These options are
procedure. stored in a table. A default set of options must be created for the list. This is done by
the CreateListOptionsData procedure. The following is the CreateListOptionsData
procedure for the Lead list. The list has the ID value 1.
Add the You can create predefined selections that control what items are displayed in the
FillListOptionsDDL list. These predefined selections appear in the “Restrictions” group displayed in the
procedure. Action Pane for the list. Each item has an integer value associated with it, which is
used to uniquely identify the options. Typically form-level constants are created for
each option. For example, the following constants are defined for the ListObj_Leads
form:
LISTOPTION_LEADSALL: 1
LISTOPTION_LEADSQUALIFIED: 2
The items are added by the FillListOptionsDDL procedure each time the list is
displayed. The list object state variable for the card list is passed into this procedure,
which allows access to the content of the drop-down list.
The following is the FillOptionsDDL procedure for the Leads list. It adds two
options to the list. Notice the constants are used to specify the data values for each
list item.
The following is the GetSortIndex procedure for the Leads list in the sample
integrating application. Notice that pass-through sanScript is used to create a
virtual key for the main table used for the Leads list.
in string sFieldName;
in ColSortOrder nSortOrder;
inout ListObjState list_object;
Add the SetRange The rows displayed in the list depend on several factors, such as the selection
procedure. option the user chose, or any search restrictions they have applied. The SetRange
procedure applies the appropriate range to the main table for the list, accounting for
any predefined selections or search criteria the user has specified.
The following is the SetRange procedure for the Leads list. It creates a set of range
selection criteria based on the user’s predefined selection and any filter options
specified through the Filter Pane at the top of the list. Every column that can be
displayed in the list must be included in the range restriction. The range where
statement is used to apply the range to the main table for the list.
250 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
{Apply any range restrictions based on the Find text the user entered}
if not empty(list_object:'Find Text') then
if not empty(sRestriction) then
sRestriction = sRestriction + CH_SPACE + SQL_AND + CH_SPACE;
end if;
Avoid using sanScript code, such as copy from table to table when loading the
temporary table with data. Each record copied from the source to the temporary
table will require two calls to the SQL Server, increasing network traffic and the SQL
Server load.
252 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
The InfoValue field in the temporary table specifies what the Information Icon will
display for a specific row. The InfoValue field is a bitmask field. It has multiple
states that can be set independently. The InfoValue_SetState() function of the
syListObj form in the Dynamics.dic dictionary should be used to specify the values
for the InfoValue column. The icon of the highest-priorty state will be displayed for
the list. The tooltip for the icon will display all of the states that have been set.
As an example, the Leads list examines two conditions that are indicated by the
Information Icon column. The first is whether the lead has been qualified. If the lead
has not been qualified, the InfoValue column (which controls the Information Icon)
is set to the “inactive” state. The following is the basic SQL statement used to find
the qualified state and set the InfoValue field:
The SQL statement examines the value of the QualifiedLead field, which has a
drop-down list datatype. This field can have the value 1 (not qualified) or 2
(qualified). The modulus operation (%) will return 1 if the lead is not qualified (1 %
2 = 1). It will return 0 is the lead is qualified (2 % 2 = 0).
The LISTTEMP identifier refers to the physical name of the temporary table used for
the list. The INFO_VALUE_INACTIVE identifier represents the value that the
InfoValue field should be set to when the lead has not been qualified.
The second condition examined will find whether the lead has a record-level note
attached. If a note is attached, the InfoValue column is set to the “note attached”
state. The following is the basic SQL statement used to find whether a note exists for
the current lead. If a record-level note exists, the InfoValue field will be set to
indicate that state:
The select statement counts the number of rows in the note master table that have
the same note index as the current row in the list’s temporary table. If a note is
attached for the current row, the value 1 will be returned. Otherwise, the value 0
will be returned.
The LISTTEMP identifier refers to the physical name of the temporary table used for
the list. The NOTETABLE identifier refers to the physical name of the
SY_Record_Notes_MSTR table. The INFO_VALUE_NOTE identifier represents the
value that the InfoValue field should be set to when the lead has a note attached.
The following is the complete Refresh procedure for the Leads list. Notice how it
loads the temporary table for the Leads list, and then uses pass-through SQL to set
the InfoValue field for each row of the list. The InfoValue_SetState() function is
used to retrieve the values used for the InfoValue field.
case nRefreshType
in [REFRESHTYPE_CHANGESORT]
fReloadData = true;
fResetRange = true;
fGetNewIndex = true;
in [REFRESHTYPE_RELOAD]
fReloadData = true;
fResetRange = true;
fGetNewIndex = true;
in [REFRESHTYPE_FIND]
fReloadData = true;
fResetRange = true;
fGetNewIndex = false;
in [REFRESHTYPE_RESTRICT]
fReloadData = true;
fResetRange = true;
fGetNewIndex = false;
else {Refresh type is invalid, so do nothing}
fReloadData = false;
fResetRange = false;
fGetNewIndex = false;
end case;
if fReloadData then
{Load the temporary table with data}
Table_Truncate(table(list_object:'Table Reference'));
254 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
{Define the values to which the InfoValue column must be set for rows that
meet the criteria}
InfoValue_SetState(InfoValueInactive, INFOVALUE_CUSTOM1) of form
➥ syListObj;
InfoValue_SetState(InfoValueNote, INFOVALUE_NOTEATTACHED) of form
➥ syListObj;
if fResetRange then
{Reset the range for the table}
call SetRange of form ListObj_Leads, list_object;
end if;
To have the Print This List or Send To Excel actions appear in the Action Pane for a list,
you must have the FormatField procedure defined first.
The FormatField procedure for the list is used to specify the formatting for fields in
the list. This procedure is automatically called as each field is displayed in the
Information Pane, used in the reports generated from the list, or exported to Excel.
The procedure has the following parameters:
in reference TableRef;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in integer nFormatFor;
out string sValue;
out integer nAlignment;
The table reference parameter provides access the current record in the temporary
table used for the list. The field and array index paramters indicate which field is
being displayed and may need formatting. The “format for” parameter will be set to
one of the following constants, indicating where the field value is to be used:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
The formatted value is passed back out of the procedure as a string. Consider using
the following functions defined for the syListObj form to help with formatting the
list data:
• List_FormatBoolean()
• List_FormatCurrency()
• List_FormatDate()
• List_FormatInteger()
• List_FormatPhone()
• List_FormatQuantity()
• List_FormatString()
• List_FormatTime()
256 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
You will also specify the alignment of the formatted data value. The last parameter
of the procedure must be set to one of the following constants to specify the
alignment:
Constant Description
ALIGN_LEFT Left-aligned
ALIGN_CENTER Center-aligned
ALIGN_RIGHT Right-aligned
The following example is the FormatField procedure for the Leads card list defined
in the sample integrating application. It formats each of the values that can appear
in the list.
in reference TableRef;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in integer nFormatFor;
out string sValue;
out integer nAlignment;
local string s;
case nFieldID
in[resourceid(field 'Lead ID')]
sValue = List_FormatString('Lead ID' of table(TableRef), nFormatFor)
➥ of form syListObj;
in[resourceid(field 'Lead Name')]
sValue = List_FormatString('Lead Name' of table(TableRef), nFormatFor)
➥ of form syListObj;
in[resourceid(field 'Address 1')]
sValue = List_FormatString('Address 1' of table(TableRef), nFormatFor)
➥ of form syListObj;
in[resourceid(field 'City')]
sValue = List_FormatString('City' of table(TableRef), nFormatFor) of
➥ form syListObj;
in[resourceid(field 'State')]
sValue = List_FormatString('State' of table(TableRef), nFormatFor) of
➥ form syListObj;
in[resourceid(field 'Zip')]
sValue = List_FormatString('Zip' of table(TableRef), nFormatFor) of
➥ form syListObj;
in[resourceid(field 'Contact')]
sValue = List_FormatString('Contact' of table(TableRef), nFormatFor)
➥ of form syListObj;
in[resourceid(field 'Lead Business Category')]
'Lead Business Category' of window State = 'Lead Business Category' of
➥ table(TableRef);
sValue = itemname('Lead Business Category' of window State,
➥ 'Lead Business Category' of window State);
in[resourceid(field 'Phone 1')]
sValue = List_FormatPhone('Phone 1' of table(TableRef), nFormatFor) of
➥ form syListObj;
Filter tokens
Add the The filtering feature of the card list allows the user to create restrictions that display
GetColumnTokens specific rows in the list. Most fields in the list can be searched without any
procedure. additional coding required for the list. However, some fields (such as list boxes,
drop-down lists, visual switches, and radio groups) require additional coding to
define the tokens that can be used for filtering based on these fields.
The filter tokens provide a user-friendly representation of the data for that field,
making it easy to select the possible values for that field when defining a filter. For
example, the Leads card list has a column for the Lead Business Category. This
column is a drop-down list that stores integer values 1 through 8, representing the
category. Rather than requiring the user need to know which category corresponds
to which value, filter tokens are created for this field to display the category values.
The core list code can automatically produce filter tokens for many list fields. For
the other fields that require filter tokens (typically list fields), you will add code to
the GetColumnTokens procedure you define for your list. This procedure has the
following parameters:
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
258 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
The following example is the GetColumnTokens procedure for the Leads card list. It
defines the filter tokens for the Lead Business Category column, which is based on a
drop-down list.
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
Action Pane
Define constants for The Action Pane allows the user to perform actions on the items selected in the list.
the actions. Adding groups and actions to the Action Pane is a multi-step process. You begin by
defining constants for the actions that you want to add to the Action Pane. For
instance, the following constants were defined for the Leads list:
ACTION_NEWLEAD: 1
ACTION_EDITLEAD: 2
ACTION_VIEWLEAD: 3
ACTION_DELETELEAD: 4
ACTION_QUALIFYLEAD: 5
Create commands and The next step involves creating commands for each action and command lists for
command lists for the each group that will appear in the Action Pane. The commands will contain the
the Action Pane. code that performs the actions. Refer to Commands for the Action Pane on page 212 for
details about creating these commands. Continuing the example, the following
commands and command lists are defined for the Leads list:
• DeleteLead
• EditLead
• NewLead
• QualifyLead
• ViewLead
• CL_ActionsGroup
• CL_GoToGroup
• CL_ModifyGroup
• CL_NewGroup
• CL_ReportsGroup
The script for each command contains code the will execute the action the user has
chosen. For example, the following is the script defined for the EditLead command.
In some cases, you may want to have the user verify the action before it is
performed. You can learn more about this in Verifying an action on page 219.
Add the Use the CreateListRibbonData procedure to add groups and actions to the Action
CreateListRibbonData Pane for the list you are creating. You will use the functions AddGroup() and
procedure. AddCommand() from the syListViewCmdBarObj form to add the groups and the
actions for each group.
The CreateListRibbonData procedure runs only when no Action Pane items exist for the list.
If you need to add additional items after the initial Action Pane items have been created, use
the technique described in Adding to the Action Pane on page 214.
The CreateListRibbonData procedure for the Leads list creates six groups and adds
the commands to those groups. It also adds the two user-defined groups, which by
default are not visible. The user can add additional commands to these groups
when they customize the Action Pane for the list.
in ListDictID nListDictID;
in ListID nListID;
nGroupSeq = 0;
{ Actions group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
nCmdID = resourceid(command CL_ActionsGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
260 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
{ Qualify Lead }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command QualifyLead),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Modify group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
nCmdID = resourceid(command CL_ModifyGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
{ Edit Lead }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command EditLead),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Delete Lead }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command DeleteLead),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ New group }
increment nGroupSeq;
nCmdID = resourceid(command CL_NewGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
{ New Lead }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command NewLead),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Restrictions group }
increment nGroupSeq;
call List_GetIDsForCoreCommand of form syListObj, LISTTYPE_CARD,
➥ LISTRIBBONGROUP_RESTRICT, nCmdDictID, nCmdFormID, nCmdID;
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
262 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Reports group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
nCmdID = resourceid(command CL_ReportsGroup);
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
{ Go To group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
nCmdID = resourceid(command CL_GoToGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nSeq = 0;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
{ View Lead }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command ViewLead),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Send To Excel }
increment nSeq;
call List_GetIDsForCoreCommand of form syListObj, LISTTYPE_CARD,
➥ LISTACTION_EXPORTTOEXCEL, nCmdDictID, nCmdFormID, nCmdID;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, nCmdID,
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
Add the To control access for the commands added to the Action Pane, the actions must be
RegisterCommands registered. The RegisterCommands procedure for the list performs this action. In
procedure. this procedure, you will use the List_RegisterGroup() and List_RegisterAction()
functions of the syListObj form to register each item you added to the Action Pane.
The following is the RegisterCommands procedure for the Leads list.
{ Actions }
List_RegisterGroup(list_object, command CL_ActionsGroup) of form syListObj;
List_RegisterAction(list_object, command QualifyLead,
➥ LISTCMDTYPE_MULTISELECT, ACTION_QUALIFYLEAD) of form syListObj;
{ Modify }
List_RegisterGroup(list_object, command CL_ModifyGroup) of form syListObj;
List_RegisterAction(list_object, command EditLead, LISTCMDTYPE_SINGLESELECT,
➥ ACTION_EDITLEAD) of form syListObj;
List_RegisterAction(list_object, command DeleteLead, LISTCMDTYPE_MULTISELECT,
➥ ACTION_DELETELEAD) of form syListObj;
264 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
{ New }
List_RegisterGroup(list_object, command CL_NewGroup) of form syListObj;
List_RegisterAction(list_object, command NewLead,
➥ LISTCMDTYPE_ALWAYSAVAILABLE, ACTION_NEWLEAD) of form syListObj;
{ Reports }
List_RegisterGroup(list_object, command CL_ReportsGroup) of form syListObj;
{ Go To }
List_RegisterGroup(list_object, command CL_GoToGroup) of form syListObj;
List_RegisterAction(list_object, command ViewLead, LISTCMDTYPE_SINGLESELECT,
➥ ACTION_VIEWLEAD) of form syListObj;
Add the The actions in the Action Pane are enabled or disabled automatically, based on the
CheckActionAccessFor number and specific type of lines the user has marked in the list. Microsoft
Record procedure. Dynamics GP tracks two counts for every action in the Action Pane. The “count for”
counter tracks the number of items marked to determine whether the single-select
or multi-select actions should be enabled. The “count against” counter tracks the
number items marked that would prevent an action from being enabled. If there are
any “count against” lines marked, the action will be disabled.
For example, assume that the Qualify action can be performed for the items selected
in the list. This action would be active as long as the user has marked one or more
items to qualify. However, if the user marked an item that had already been
qualified, the “counts against” counter would be incremented, causing the Qualify
action to be disabled.
in ListObjState list_object;
in integer nActionCmdTag;
out integer nAccessStatus;
Each time the procedure is called, a command tag is passed in. The procedure
specifies how the item marked or unarked in the list should be considered when
determining whether the action corresponding to that tag should be accessible. You
will use the 'Table Reference' component of the list object composite passed into the
procedure to determine which row is being marked or unmarked in the list.
The parameter value returned through the “out” parameter this trigger processing
procedure specifies how the marked row should be considered. The value
corresponds to one of the following constants:
Constant Description
LISTACTIONACCESS_COUNT_NEUTRAL The marked row won’t affect the count for the
action.
LISTACTIONACCESS_COUNT_FOR The marked row will increase or decrease the
“count for” counter by one.
LISTACTIONACCESS_COUNT_AGAINST The marked row will increase or decrease the
“count against” counter by one.
in ListObjState list_object;
in integer nActionCmdTag;
out integer nAccessStatus;
nAccessStatus = LISTACTIONACCESS_COUNT_NEUTRAL;
Add the ExecuteAction To execute the actions you have defined for your list, you will add the
procedure. ExecuteAction procedure. This procedure is called every time a user chooses an
action for the list. The value corresponding to the action is also passed into the
procedure. The procedure must contain the code to perform the action the user
chose.
The ExecuteAction script must also handle the default action for the list window.
The default action occurs when the user presses the Enter key or double-clicks on a
line in the list. The value corresponding to the constant DEFAULT_ACTION
indicates the default action.
Executing an action for a list can be an involved process, since the action can be
performed for multiple items marked in the list. Refer to Performing actions for
marked rows on page 222 for details about processing actions for multiple items.
266 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
The ExecuteAction procedure must also be able to handle any errors that occur
during action processing. Refer to Logging action status on page 223 and Acting on
action errors on page 226 for detailed information about how to log and act on errors
encountered as actions are processed.
The following is the ExecuteAction script for the Leads list in the sample integrating
application. Notice that the list object is passed into the procedure. The reference to
the main table contained in this object is used to find what row the user had marked
in the list for the single-select actions.
inout ListObjState list_object;
in long iAction;
case iAction
in [ACTION_NEWLEAD]
open form IG_Lead_Maintenance;
in [ACTION_EDITLEAD]
open form IG_Lead_Maintenance;
'Lead ID' of window 'Lead Maintenance' of form IG_Lead_Maintenance =
➥ 'Lead ID' of table (list_object:'Table Reference');
run script 'Lead ID' of window 'Lead Maintenance' of form
➥ IG_Lead_Maintenance;
in [ACTION_DELETELEAD]
call DeleteLeads of form ListObj_Leads, list_object;
in [ACTION_VIEWLEAD]
open form IG_Lead_Inquiry;
'Lead ID' of window IG_Lead_Inquiry of form IG_Lead_Inquiry =
➥ 'Lead ID' of table (list_object:'Table Reference');
run script 'Lead ID' of window IG_Lead_Inquiry of form
➥ IG_Lead_Inquiry;
in [ACTION_QUALIFYLEAD]
call QualifyLeads of form ListObj_Leads, list_object;
in [DEFAULT_ACTION]
open form IG_Lead_Maintenance;
'Lead ID' of window 'Lead Maintenance' of form IG_Lead_Maintenance =
➥ 'Lead ID' of table (list_object:'Table Reference');
run script 'Lead ID' of window 'Lead Maintenance' of form
➥ IG_Lead_Maintenance;
end case;
Information Pane
Add the The Information Pane for the list provides additional details about the row that is
GeneratePreviewPane currently selected in the list. When the user selects a row, the
XML procedure. GeneratePreviewPaneXML procedure for the list is called. This procedure builds an
XML file that displays detailed information about the selected row.
The layout of the Information Pane depends on the type of list being displayed. For
card lists, the Information Pane contains three columns. Within each column are a
series of label-value pairs that display information about the selected item. The
following illustration shows the Information Pane for the Leads card list.
The GeneratePreviewPaneXML procedure for the list is run each time a user selects
a row in the list. This procedure has the following parameters:
First, the title used for the Information Pane content is constructed. This value will
be passed out through the last parameter for the procedure. Then the
XMLDoc_Create procedure of the syListObj form starts the process of creating the
Information Pane content. To create the items in the header section, the
XMLDoc_AddHeaderField procedure of the syListObj form is used. This
procedure adds a data item to the end of the specified column. Finally, the
XMLDoc_Save procedure of the syListObje form completes the XML document
used for the Information Pane.
{Get the reference for the temporary table used by the list}
Leads_MSTR_Temp = list_object:'Table Reference';
{--Column 1--}
{Address}
sValue = 'Address 1' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "Address", sValue, 1;
sValue = 'Address 2' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "", sValue, 1;
{Phone 1}
call GetColumnName of form ListObj_Leads, resourceid(field 'Phone 1'), 0,
➥ sName;
268 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
{Phone 2}
call GetColumnName of form ListObj_Leads, resourceid(field 'Phone 2'), 0,
➥ sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Phone 2'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;
{Fax}
call GetColumnName of form ListObj_Leads, resourceid(field 'Fax'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Fax'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;
{--Column 2--}
{Lead Category}
call GetColumnName of form ListObj_Leads, resourceid(field
➥ 'Lead Business Category'), 0, sName;
sValue = itemname('Lead Business Category' of window State,
➥ 'Lead Business Category' of table(Leads_MSTR_Temp));
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;
{Contact}
call GetColumnName of form ListObj_Leads, resourceid(field 'Contact'), 0,
➥ sName;
sValue = 'Contact' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;
{Potential Revenue}
call GetColumnName of form ListObj_Leads, resourceid(field
➥ 'Potential Revenue'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp,
➥ resourceid(field 'Potential Revenue'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;
{--Column 3--}
{Qualified Lead}
call GetColumnName of form ListObj_Leads, resourceid(field 'Qualified Lead'),
➥ 0, sName;
sValue = itemname('Qualified Lead' of window State, 'Qualified Lead' of
➥ table(Leads_MSTR_Temp));
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;
{Qualification Date}
call GetColumnName of form ListObj_Leads, resourceid(field
➥ 'Qualification Date'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp,
➥ resourceid(field 'Qualification Date'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;
{Source}
call GetColumnName of form ListObj_Leads, resourceid(field 'Lead Source'), 0,
➥ sName;
sValue = 'Lead Source' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;
Business Analyzer
Beginning with Microsoft Dynamics GP 2010 R2, a list page can display the
Business Analyzer. The Business Analyzer displays SQL Server Reporting Services
(SSRS) reports that supplement the list data.
Add the The Business Analyzer is available only if it has been enabled for the list. The
CheckFactBoxEnabled CheckFactBoxEnabled procedure for the list is is used to do this. If the value true is
procedure. returned, the Business Analyzer will be available for the list. The following is the
CheckFactBoxEnabled procedure for the Leads list. It indicates that the Business
Analzyer is available for the list.
in ListDictID nListDictID;
in ListID nListID;
out boolean fEnabled;
fEnabled = true;
Add the To specify the initial set of SSRS reports that will be displayed for the Business
CreateListFactBoxData Analyzer, you must add the CreateListFactBoxData procedure to the list. This
procedure. procedure uses the CreateDefaultFactBox() function to add the default reports that
will be displayed in the Business Analyzer for the list. The following is the
CreateListFactBoxData procedure for the Leads list. It adds two reports that will be
available by default in the Business Analyzer for the Leads list.
in ListDictID nListDictID;
in ListID nListID;
increment nSeq;
nStatus = CreateDefaultFactBox(
nListDictID,
nListID,
nSeq,
"%Company%/Sales/Charts And KPIs/",
"Lead Potential Revenue",
LIST_PRIMARYVIEWID) of form syListViewFactBoxReportsObj;
270 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
increment nSeq;
nStatus = CreateDefaultFactBox(
nListDictID,
nListID,
nSeq,
"%Company%/Sales/Charts And KPIs/",
"Leads Per Salesperson",
LIST_PRIMARYVIEWID) of form syListViewFactBoxReportsObj;
Add the Load Some of the reports that are being displayed in the Business Analyer may have
FactBoxParameters parameters that control what data is displayed by the report. One of the parameter
procedure. values can come from the rows the user has marked or selected in the list. For
example, you might want to pass a parameter that contains the Lead IDs for the
leads that the user has marked in the Leads list. You can add the
LoadFactBoxParameters procedure to the list to set the values for this parameter.
The reports displayed in the Business Analyzer for the list don’t have to use the parameter. If
they don’t have a parameter with the specified name, the parameter is ignored.
There is a maximum total length for the parameters passed to the report for the
Business Analyzer. If you mark a very large number of items in the list, you might
exceed this limit. As the parameter list is built, the core list object will keep track of
the length. If it is exceeded, a message will be displayed in the status bar for the list
and no additional values will be added to the parameter.
The following example is the LoadFactBoxParameters procedure for the Leads list.
It adds an additional parameter that contains the Lead IDs for each lead that is
selected in the list.
inout ListObjState list_object;
inout reference tableRef;
in boolean fMultipleMarked;
if fMultipleMarked then
{ Look through the list of marked leads, and add each one. }
get first table(tableRef);
nStatus = err();
while nStatus <> EOF do
call FactBoxParameter_Add of form syListObj, list_object, LeadParam,
➥ 'Lead ID' of table(tableRef), fMultipleMarked, fParamTooLong;
if fParamTooLong then
exit while;
end if;
The following is the Initialize procedure for the Leads list in the sample integrating
application.
inout ListObjState list_object;
inout string sWindowTitle;
inout integer nStatus;
272 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
Add the Close When the user displays another page or list, the Close procedure for the list is run.
procedure. This procedure must perform any clean-up actions for the list, such as closing the
list object form, or removing data from temporary tables used for the list. The
following is the Close procedure for the Leads list in the sample integrating
application.
inout ListObjState list_object;
list_object:IsCreated = false;
close form ListObj_Leads;
List navigation
Define the command A list window is actually opened using a command that you define. Commands to
to open the list open lists must have the type DataList, and specify the form that provides the base
window. functionality for the list.
The command that opens the Leads list in the sample integrating application has
the following characteristics:
Add the command to A separate procedure in Microsoft Dynamics GP is used to create the items that
the Navigation Pane appear in each section of the Navigation Pane. The following table lists the
menu structure. procedures used for each:
A procedure trigger registered for one of these procedures is used to add the list
command to the appropriate location in the Navigation Pane menu structure. For
example, the following is the procedure trigger registration that adds the
Navigation Pane items for the sample integrating application.
The trigger processing procedure has the following parameters, which indicate the
command list to which commands should be added:
in CmdParentDictID ParentDictID;
in CmdParentFormID ParentFormID;
in CmdParentCmdID ParentCmdID;
in integer LoadMode;
The following is the trigger processing procedure that adds the ListObj_Leads
command to the Sales section of the Navigation Pane:
in CmdParentDictID ParentDictID;
in CmdParentFormID ParentFormID;
in CmdParentCmdID ParentCmdID;
in integer LoadMode;
{If the item was found, add the new item after it.}
if Seq <> 0 then
Seq = Seq + 1;
end if;
Status = AddCommandToMenu(ParentDictID,
ParentFormID,
ParentCmdID,
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command ListObj_Leads of form Command_IG_Sample),
true,
LoadMode);
274 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
Register the list The final step to making the list accessible is registering it. This is typically
command. performed in the form pre script for the command form that defines the list
navigation command. The registration process does the following:
Consider creating a constant for the list ID value. For instance, the constant
LISTID_LEADS is used for the Leads list in the sample integrating application.
Custom list views are added when the integration is installed, before the list has
even been accessed the first time. To add custom list views, you will register a
procedure trigger for the CreateDefaultListViews procedure of the syListObj form.
The following example shows this trigger registration for the sample integrating
application.
The trigger processing procedure that runs in response this trigger must determine
whether the primary and custom views have already been added. If they have, no
action should be taken. If no views have been added, the script must add the
primary view for the list. After the primary view is added, it must add each custom
view, specifying the unique characteristics of each view. The custom view can
specify a different set of columns to display, different items in the Action Pane, and
special filtering criteria for the data. If the custom view doesn’t specify its own set of
columns, Action Pane items, or filtering criteria, the settings from the primary list
view will be used.
Filtering criteria is the most common change made for custom list views. Microsoft
Dynamics GP uses a special syntax for defining the filtering criteria applied to a list.
The syntax can be complex. Don’t attempt to write the filtering expression
manually. Instead, in Microsoft Dynamics GP use the filter pane for the list to define
the filter criteria. When you save the list view, the filter criteria will be saved in the
SY07230 table in the DYNAMICS database. Copy the filter criteria from the
FilterCritera column of this table for use in the script that will add the custom list
view. For example, the following expression is the filtering criteria for the Leads list
that restricts the data displayed to show leads with a potential revenue of $50,000 or
greater. It was created using the filter pane for the Leads list, and then copied from
the SY07230 table.
The following example is the trigger processing procedure that adds the custom list
view for the Leads list in the sample integrating application. It uses the Exists()
function of the syListViewObj form to find out whether views for the Leads list
have been added. If they haven’t, it uses the CreateDefaultViewRecord() -- View
function to add the primary view, and the CreateDefaultCustomViewRecord()
function to add the custom view (named”High Revenue”). Finally, the procedure
specifies the characteristics of the custom view. The columns and Action Pane items
are unchanged from the primary view, so no script code is needed. New filter
criteria are applied for the custom view. Notice how the filter criteria shown
previously is converted into a string in the sanScript code. All quotes in this criteria
string are replaced with the QUOTE constant. Functions from the
syListViewFiltersObj form write the updated criteria for the custom list view.
276 IN T E G R AT I O N G U ID E
C H A PT E R 2 9 C A R D L IS T S
{Create the custom view record for the 'High Revenue' view}
nStatus = CreateDefaultCustomViewRecord(IG_PROD_ID, LISTID_LEADS,
➥ "High Revenue", 1, viewID) of form syListViewObj;
If you maintain date-specific information within your integration, you may want to
implement a transaction list to display that information. The sample integrating
application implements a Contact History list, which displays date-specific
information about customer contacts.
Checking access
Add the The CheckListAccess procedure for the transaction list form is used to control
CheckListAccess access to the transaction list. In releases prior to Microsoft Dynamics GP 10, this
procedure. procedure contained code to verify that the user has access to the primary form
used to manage the data that is displayed in the list. If the user didn’t have access to
the form, access to the card list was denied. Beginning with Microsoft Dynamics GP
10, security tasks are used to control access to card lists. Refer to Security task
operations on page 395 for information about creating security task operations that
control access to specific list features.
The CheckListAccess procedure can still be used to control access to a list. For
instance, you may not want to allow a list to be displayed if a specific module hasn’t
been registered. To grant access, the procedure should return true. Otherwise, the
procedure should return false.
in long nSubList;
inout boolean bSuccess;
bSuccess = true;
280 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
Add additional fields to Some additional fields from the Dynamics.dic dictionary must be added to the
the temporary table. temporary table. These are:
InfoValue This field is used for the information icon that can be displayed for
each row in the list. This field is required only if the information icon will be
displayed. You may want to add this field now, in the event it is needed later for
your list.
Marked To Process The field is used for the check mark displayed for each row.
It is required for every list.
Attaching tables
Attach tables to the The content of a transaction list comes from the temporary table that is defined for
transaction list. the list. Any of the other tables used to populate the temporary table must be
attached to the list form. Use the Form Definition window to attach these tables to
the transaction list form.
For the Contact History list in the sample integration, the ContactHistoryTrxTemp
table was created and attached to the ListObj_ContactHistoryTrx form. This is the
main table that will be used to display data in the list. The
IG_ContactHistory_MSTR table and the RM_Customer_MSTR table are also
attached, since they contain the data that will be added to the temporary table for
the list.
Table access
Assign a reference to The syTrxList form in the Dynamics.dic dictionary must be able to access the main
the main table. table used for your transaction list. A reference to the main table for the transaction
list provides this access. You create this reference using a global procedure for your
integration. For example, the following is the procedure in the sample integrating
application that creates a reference to the ContactHistoryTrxTemp table for the
Contact History list.
Add the The procedure that assigns the table reference must be called each time the
RegisterTableRef transaction list is opened. This in done using a trigger that will call the
Trigger procedure. AssignTableRef procedure you just created. The procedure trigger is created in the
RegisterTableRefTrigger procedure that is part of your transaction list form. The
following is the RegisterTableRefTrigger procedure for the Contact History list.
The tag for this trigger is automatically saved so that this trigger can be unregistered when
the list is closed or another list is displayed.
List columns
Add the The CreateListColumnsData procedure for the list form specifies which columns
CreateListColumns will be available for the list window. The CreateDefaultColumn() funtion is used to
Data procedure. add columns to a card list. When you add columns, you specify the following:
282 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
25{width},
0,
0, 0, { no format field }
0, {token ID}
0{sort seq}) of form syListViewColObj;
The column data for your list is stored in the sy07226 table in the DYNAMICS
database. As you create your list, you may need to reset the default columns that
appear for the list. To do this, you will need to delete the appropriate rows for your
list from the sy07226 table.
Add the Notice that the column display names are not part of the column definitions created
GetColumnName in the CreateListColumnsData procedure. The column names are used in various
procedure. locations in the list implementation, so they are defined in a separate procedure
named GetColumnName.
This procedure typically contains a case statement that returns the appropriate
column name, based on the resource ID passed into the procedure. The following is
the GetColumnName procedure for the Contact History list in the sample
integrating application.
in ColFieldID sFieldID;
in ColArrayIndex iColIndex;
out string sColName;
case sFieldID
in [resourceid('Customer Number' of table ContactHistoryTrxTemp)]
set sColName to "Customer ID";
in [resourceid('Customer Name' of table ContactHistoryTrxTemp)]
set sColName to "Customer Name";
in [resourceid('First Contact Date' of table ContactHistoryTrxTemp)]
set sColName to "First Contact";
in [resourceid('Last Contact Date' of table ContactHistoryTrxTemp)]
set sColName to "Last Contact";
in [resourceid('Contact Salesperson ID' of table ContactHistoryTrxTemp)]
set sColName to "First Contact Salesperson";
in [resourceid('Contact Salesperson ID 2' of table
➥ ContactHistoryTrxTemp)]
set sColName to "Last Contact Salesperson";
in [resourceid('Active' of table ContactHistoryTrxTemp)]
set sColName to "Active";
else
set sColName to "<<No Name>>";
end case;
List options
Add the Each list has numerous options that can be specified by the user, such as which
CreateListOptionsData sections of the list are displayed, and their corresponding sizes. These options are
procedure. stored in a table. A default set of options must be created for the list. This is done by
the CreateListOptionsData procedure. The following is the CreateListOptionsData
procedure for the Contact History list. The list has the ID value 2.
284 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
Add the You can create predefined selections that control what items are displayed in the
FillListOptionsDDL list. These predefined selections appear in the “Restrictions” group displayed in the
procedure. Action Pane for the list. Each item has an integer value associated with it, which is
used to uniquely identify the options. Typically form-level constants are created for
each option. For example, the following constants are defined for the
ListObj_ContactHistoryTrx form:
LISTOPTION_CONTACTSSALL: 1
LISTOPTION_CONTACTSACTIVE: 2
The items are added by the FillListOptionsDDL procedure each time the list is
displayed. The list object state variable for the transaction list is passed into this
procedure, which allows access to the content of the drop-down list.
The following is the FillOptionsDDL procedure for the Contact History list. It adds
two options to the list. Notice the constants are used to specify the data values for
each list item.
If you don’t want the user to be able to stop the data loading process for your transaction list,
you won’t need to have these procedures. Instead, you can load data into the transaction list
using the same technique used for the card list.
Add the LoadData The LoadData procedure actually loads the data into the temporary table. The name
procedure. given to this procedure typically indicates which table the data is being loaded into.
For example, the LoadData_ContactHistoryTrxTemp procedure is used to load data
in to the temporary table for the Contact History list.
If the transaction list will be displaying the Information Icon, this procedure should
also set the initial value of the InfoValue field that is part of the temporary table
definition. The InfoValue_SetState() function of the syListObj form in the
Dynamics.dic dictionary should be used to specify the values for the InfoValue
column. The icon of the highest-priorty state will be displayed for the list. The
tooltip for the icon will display all of the states that have been set.
• RM_Customer_MSTR
• IG_Contact_History_MSTR
Notice that it uses the OKCallBackScript callback from the list object, and that it also
keeps track of the total number of records added to the temporary table. The
procedure also sets the initial value of the Information Icon that is displayed for the
list.
inout ListObjState list_object;
inout long nRecCount;
286 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
increment iCount;
if iCount = 10 then {Check if we should continue}
call foreground with name list_object:OkCallBackScript in
➥ dictionary DYNAMICS, 'Window Title', fOk;
if not fOk then
abort script;
end if;
iCount = 0;
end if;
if nRecCount = 50 then
call foreground with name list_object:OkCallBackScript in
➥ dictionary DYNAMICS, 'Window Title', fOk;
if fOk then
call foreground with name list_object:FillListCallBackScript in
➥ dictionary DYNAMICS;
else
abort script;
end if;
end if;
Add the The LoadBackground procedure is called by the Refresh procedure (which will be
LoadBackground added later) to actually fill the temporary table in the background. This procedure
procedure. calls the LoadData procedure, filling the temporary table. The following is the
LoadBackground procedure for the Contact History list.
The following is the GetSortIndex procedure for the Contact History list in the
sample integrating application. Notice that pass-through sanScript is used to create
a virtual key for the main table used for the Contact History list.
in string sFieldName;
in ColSortOrder nSortOrder;
inout ListObjState list_object;
288 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
Add the SetRange The rows displayed in the list depend on several factors, such as the selection
procedure. option the user chose, the specified date range, or any search restrictions the user
has applied. The SetRange procedure applies the appropriate range to the main
table for the list, accounting for any predefined selections or search criteria the user
has specified.
The following is the SetRange procedure for the Contact History list. It creates a set
of range selection criteria based on the user’s predefined selection, the specified
date range, and any filter options specified through the Filter Pane at the top of the
list. Every column that can be displayed in the list must be included in the range
restriction. The range where statement is used to apply the range to the main table
for the list.
{Apply any range restrictions based on the Find text the user entered}
if not empty(list_object:'Find Text') then
if not empty(sRestriction) then
sRestriction = sRestriction + CH_SPACE + SQL_AND + CH_SPACE;
end if;
290 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
if fResetRange then
clear table(list_object:'Table Reference');
{ need to reset the range on the temp table }
call SetRange of form ListObj_ContactHistoryTrx, list_object;
end if;
{Display number of records in the list.}
nRecCount = countrecords(table(list_object:'Table Reference'));
field(list_object:RecCountStringRef) = str(nRecCount) + CH_SPACE +
➥ "Customers";
Add the Refresh The Refresh procedure controls the process of displaying or updating the data
procedure. displayed in the list. The type of action to be performed is passed into this
procedure. The procedure must set the range options appropriately, and call the
other procedures that are used during the display process.
The following is the Refresh procedure for the Contact History list.
fGetNewIndex = true;
in [REFRESHTYPE_FIND]
fReloadData = false;
fResetRange = true;
fGetNewIndex = false;
in [REFRESHTYPE_RESTRICT]
fReloadData = false;
fResetRange = true;
fGetNewIndex = false;
else { refresh type is invalid, so do nothing }
fReloadData = false;
fResetRange = false;
fGetNewIndex = false;
end case;
if fReloadData then
{Clear/truncate the temp table}
range clear table(list_object:'Table Reference');
nStatus = Table_Truncate(table(list_object:'Table Reference'));
assert nStatus = OKAY;
nRecCount = 0;
292 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
To have the Print This List or Send To Excel actions appear in the Action Pane for a list,
you must have the FormatField procedure defined first.
The FormatField procedure for the list is used to specify the formatting for fields in
the list. This procedure is automatically called as each field is displayed in the
Information Pane, used in the reports generated from the list, or exported to Excel.
The procedure has the following parameters:
in reference TableRef;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in integer nFormatFor;
out string sValue;
out integer nAlignment;
The table reference parameter provides access the current record in the temporary
table used for the list. The field and array index paramters indicate which field is
being displayed and may need formatting. The “format for” parameter will be set to
one of the following constants, indicating where the field value is to be used:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
The formatted value is passed back out of the procedure as a string. Consider using
the following functions defined for the syListObj form to help with formatting the
list data:
• List_FormatBoolean()
• List_FormatCurrency()
• List_FormatDate()
• List_FormatInteger()
• List_FormatPhone()
• List_FormatQuantity()
• List_FormatString()
• List_FormatTime()
You will also specify the alignment of the formatted data value. The last parameter
of the procedure must be set to one of the following constants to specify the
alignment:
Constant Description
ALIGN_LEFT Left-aligned
ALIGN_CENTER Center-aligned
ALIGN_RIGHT Right-aligned
The following example is the FormatField procedure for the Contact History
transaction list defined in the sample integrating application. It formats each of the
values that can appear in the list.
in reference TableRef;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in integer nFormatFor;
out string sValue;
out integer nAlignment;
local string s;
case nFieldID
in[resourceid(field 'Customer Number')]
sValue = List_FormatString('Customer Number' of table(TableRef),
➥ nFormatFor) of form syListObj;
in[resourceid(field 'Customer Name')]
sValue = List_FormatString('Customer Name' of table(TableRef),
➥ nFormatFor) of form syListObj;
in[resourceid(field 'First Contact Date')]
sValue = List_FormatDate('First Contact Date' of table(TableRef),
➥ nFormatFor) of form syListObj;
in[resourceid(field 'Last Contact Date')]
sValue = List_FormatDate('Last Contact Date' of table(TableRef),
➥ nFormatFor) of form syListObj;
in[resourceid(field 'Contact Salesperson ID')]
sValue = List_FormatString('Contact Salesperson ID' of
➥ table(TableRef), nFormatFor) of form syListObj;
in[resourceid(field 'Contact Salesperson ID 2')]
sValue = List_FormatString('Contact Salesperson ID 2' of
➥ table(TableRef), nFormatFor) of form syListObj;
in[resourceid(field 'Active')]
sValue = List_FormatBoolean('Active' of table(TableRef), nFormatFor)
➥ of form syListObj;
else
s = getmsg(6703);{Unknown [%1]}
substitute s, str(nFieldID);
sValue = s;
end case;
Filter tokens
Add the The filtering feature of the transaction list allows the user to create restrictions that
GetColumnTokens display specific rows in the list. Most fields in the list can be searched without any
procedure. additional coding required for the list. However, some fields (such as list boxes,
drop-down lists, visual switches, and radio groups) require additional coding to
define the tokens that can be used for filtering based on these fields.
294 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
The filter tokens provide a user-friendly representation of the data for that field,
making it easy to select the possible values for that field when defining a filter. For
example, the Contact History transaction list has a column for the Last Contact date.
This column is a date value and has several filter tokens that are automatically
created for it.
The core list code can automatically produce filter tokens for many list fields. For
the other fields that require filter tokens (typically list fields), you will add code to
the GetColumnTokens procedure you define for your list. This procedure has the
following parameters:
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
The following example is the GetColumnTokens procedure for the Contract History
transaction list. It defines the filter tokens for the Active column, which is based on
a check box.
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
{Inactive}
internal_ID = Columns_AddToken(list_object,
nColumnID,
"No", {Token name}
2, {Unique ID for this token}
"(ACTIVE = '0')") of form syListObj;
end if;
Action Pane
Define constants for The Action Pane allows the user to perform actions on the items selected in the list.
the actions. Adding groups and actions to the Action Pane is a multi-step process. You begin by
defining constants for the actions that you want to add to the Action Pane. For
instance, the following constants were defined for the Contact History list:
ACTION_UPDATECONTACT: 1
ACTION_EDITCUSTOMER: 2
Create commands and The next step involves creating commands for each action and command lists for
command lists for the each group that will appear in the Action Pane. The commands will contain the
the Action Pane. code that performs the actions. Refer to Commands for the Action Pane on page 212 for
details about creating these commands. Continuing the example, the following
commands and command lists are defined for the Contact History list:
• EditCustomer
• UpdateContact
• CL_ActionsGroup
• CL_GoToGroup
• CL_ReportsGroup
The script for each command contains code the will execute the action the user has
chosen. For example, the following is the script defined for the EditCustomer
command.
call ExecuteListAction of form syTrxList, ACTION_EDITCUSTOMER;
In some cases, you may want to have the user verify the action before it is
performed. You can learn more about this in Verifying an action on page 219.
Add the Use the CreateListRibbonData procedure to add groups and actions to the Action
CreateListRibbonData Pane for the list you are creating. You will use the functions AddGroup() and
procedure. AddCommand() from the syListViewCmdBarObj form to add the groups and the
actions for each group.
The CreateListRibbonData procedure runs only when no Action Pane items exist for the list.
If you need to add additional items after the initial Action Pane items have been created, use
the technique described in Adding to the Action Pane on page 214.
The CreateListRibbonData procedure for the Contact History list creates four
groups and adds the commands to those groups. It also adds the two user-defined
groups, which by default are not visible. The user can add additional commands to
these groups when they customize the Action Pane for the list.
296 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
in ListDictID nListDictID;
in ListID nListID;
nGroupSeq = 0;
{ Actions group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_ContactHistoryTrx);
nCmdID = resourceid(command CL_ActionsGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_ContactHistoryTrx);
{ Update Contact }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command UpdateContact),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Edit Customer }
increment nSeq;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, resourceid(command EditCustomer),
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Restrictions group }
increment nGroupSeq;
call List_GetIDsForCoreCommand of form syListObj, LISTTYPE_TRX,
➥ LISTRIBBONGROUP_RESTRICT, nCmdDictID, nCmdFormID, nCmdID;
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
{ Date Restriction }
increment nSeq;
call List_GetIDsForCoreCommand of form syListObj, LISTTYPE_TRX,
➥ LISTACTION_DATERESTRICT, nCmdDictID, nCmdFormID, nCmdID;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, nCmdID,
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
{ Reports group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_ContactHistoryTrx);
nCmdID = resourceid(command CL_ReportsGroup);
298 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
{ Go To group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_ContactHistoryTrx);
nCmdID = resourceid(command CL_GoToGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
nSeq = 0;
nParentDictID = nCmdDictID;
nParentFormID = nCmdFormID;
nParentCmdID = nCmdID;
{ Send To Excel }
increment nSeq;
call List_GetIDsForCoreCommand of form syListObj, LISTTYPE_TRX,
➥ LISTACTION_EXPORTTOEXCEL, nCmdDictID, nCmdFormID, nCmdID;
nStatus = AddCommand(nListDictID, nListID, LIST_PRIMARYVIEWID,
nParentDictID, nParentFormID, nParentCmdID,
nSeq,
nCmdDictID, nCmdFormID, nCmdID,
LISTACTIONPRIORITY_PRIMARY,
LISTACTIONBTNSIZE_LARGE,
""{caption},
true{visible}) of form syListViewCmdBarObj;
Add the To control access for the commands added to the Action Pane, the actions must be
RegisterCommands registered. The RegisterCommands procedure for the list performs this action. In
procedure. this procedure, you will use the List_RegisterGroup() and List_RegisterAction()
functions of the syListObj form to register each item you added to the Action Pane.
The following is the RegisterCommands procedure for the Contact History list.
{ Actions }
List_RegisterGroup(list_object, command CL_ActionsGroup) of form syListObj;
List_RegisterAction(list_object, command UpdateContact,
➥ LISTCMDTYPE_SINGLESELECT, ACTION_UPDATECONTACT) of form syListObj;
List_RegisterAction(list_object, command EditCustomer,
➥ LISTCMDTYPE_SINGLESELECT, ACTION_EDITCUSTOMER) of form syListObj;
{ Reports }
List_RegisterGroup(list_object, command CL_ReportsGroup) of form syListObj;
{ Go To }
List_RegisterGroup(list_object, command CL_GoToGroup) of form syListObj;
Add the The actions in the Action Pane are enabled or disabled automatically, based on the
CheckActionAccessFor number and specific type of lines the user has marked in the list. Microsoft
Record procedure. Dynamics GP tracks two counts for every action in the Action Pane. The “count for”
counter tracks the number of items marked to determine whether the single-select
or multi-select actions should be enabled. The “count against” counter tracks the
number items marked that would prevent an action from being enabled. If there are
any “count against” lines marked, the action will be disabled.
For example, assume that the Update Contact action can be performed when a
single item is marked in the list. This action would be active as long as the user has
marked exactly one item.
in ListObjState list_object;
in integer nActionCmdTag;
out integer nAccessStatus;
Each time the procedure is called, a command tag is passed in. The procedure
specifies how the item marked or unarked in the list should be considered when
determining whether the action corresponding to that tag should be accessible. You
will use the 'Table Reference' component of the list object composite passed into the
procedure to determine which row is being marked or unmarked in the list.
300 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
The parameter value returned through the “out” parameter this trigger processing
procedure specifies how the marked row should be considered. The value
corresponds to one of the following constants:
Constant Description
LISTACTIONACCESS_COUNT_NEUTRAL The marked row won’t affect the count for the
action.
LISTACTIONACCESS_COUNT_FOR The marked row will increase or decrease the
“count for” counter by one.
LISTACTIONACCESS_COUNT_AGAINST The marked row will increase or decrease the
“count against” counter by one.
in ListObjState list_object;
in integer nActionCmdTag;
out integer nAccessStatus;
nAccessStatus = LISTACTIONACCESS_COUNT_NEUTRAL;
Add the ExecuteAction To execute the actions you have defined for your list, you will add the
procedure. ExecuteAction procedure. This procedure is called every time a user chooses an
action for the list. The value corresponding to the action is also passed into the
procedure. The procedure must contain the code to perform the action the user
chose.
The ExecuteAction script must also handle the default action for the list window.
The default action occurs when the user presses the Enter key or double-clicks on a
line in the list. The value corresponding to the constant DEFAULT_ACTION
indicates the default action.
The default action for transaction lists is specified in the Initialize procedure for the list. This
procedure is described in Open and closing on page 304.
Executing an action for a list can be an involved process, since the action can be
performed for multiple items marked in the list. Refer to Performing actions for
marked rows on page 222 for details about processing actions for multiple items.
The ExecuteAction procedure must also be able to handle any errors that occur
during action processing. Refer to Logging action status on page 223 and Acting on
action errors on page 226 for detailed information about how to log and act on errors
encountered as actions are processed.
The following is the ExecuteAction script for the Contact History list in the sample
integrating application. Notice that the list object is passed into the procedure. The
reference to the main table contained in this object is used to find what row the user
had marked in the list for the single-select actions.
case iAction
in [ACTION_EDITCUSTOMER, DEFAULT_ACTION]
open form RM_Customer_Maintenance;
'Customer Number' of window RM_Customer_Maintenance of form
RM_Customer_Maintenance = 'Customer Number' of table
➥ (list_object:'Table Reference');
run script 'Customer Number' of window RM_Customer_Maintenance
➥ of form RM_Customer_Maintenance;
in [ACTION_UPDATECONTACT]
open form RM_Customer_Maintenance;
'Customer Number' of window RM_Customer_Maintenance of form
➥ RM_Customer_Maintenance = 'Customer Number' of table
➥ (list_object:'Table Reference');
run script 'Customer Number' of window RM_Customer_Maintenance
➥ of form RM_Customer_Maintenance;
Information Pane
Add the The Information Pane for the list provides additional details about the row that is
GeneratePreviewPane currently selected in the list. When the user selects a row, the
XML procedure. GeneratePreviewPaneXML procedure for the list is called. This procedure builds an
XML file that displays detailed information about the selected row.
The layout of the Information Pane depends on the type of list being displayed. For
transaction lists, the Information Pane contains up to three columns in the header
section. Within each column are a series of label-value pairs that display
information about the selected item. The layout also typically contains a set of line
items that describe details of the selected list item, such as the line items for a
transaction.
The following illustration shows the Information Pane for the Contact History
transaction list.
The GeneratePreviewPaneXML procedure for the list is run each time a user selects
a row in the list. This procedure has the following parameters:
inout ListObjState list_object;
inout string XMLFilePath;
inout string sTitle;
302 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
First, the title used for the Information Pane content is constructed. This value will
be passed out through the last parameter for the procedure. Then the
XMLDoc_Create procedure of the syListObj form starts the process of creating the
Information Pane content. To create the items in the header section, the
XMLDoc_AddHeaderField procedure of the syListObj form is used. This
procedure adds a data item to the end of the specified column.
Finally, the XMLDoc_Save procedure of the syListObje form completes the XML
document used for the Information Pane.
{Get the reference for the temporary table used by the list}
Contact_History_MSTR_Temp = list_object:'Table Reference';
{--Column 1--}
{Customer ID}
sValue = 'Customer Number' of table(Contact_History_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "Customer ID",
➥ sValue, 1;
{Last Contact}
call XMLDoc_AddLineItem of form syListObj, XMLState, RowValuesElement;
Business Analyzer
Beginning with Microsoft Dynamics GP 2010 R2, a list page can display the
Business Analyzer. Refer to Business Analyzer on page 270 for more information.
304 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
The following is the Initialize procedure for the Contact History list in the sample
integrating application.
inout ListObjState list_object;
out 'Window Title' sWdwTitle;
out integer nStatus;
nStatus = OKAY;
Add the Close When the user closes the list or displays another list, the Close procedure for the list
procedure. is run. This procedure must perform any clean-up actions for the list, such as closing
the list object form, or removing data from temporary tables used for the list. The
following is the Close procedure for the Contact History list in the sample
integrating application.
inout ListObjState list_object;
list_object:IsCreated = false;
close form ListObj_ContactHistoryTrx;
List navigation
Define the command A list window is actually opened using a command that you define. Commands to
to open the list open lists must have the type DataList, and specify the form that provides the base
window. functionality for the list.
The command that opens the Contact History list in the sample integrating
application has the following characteristics:
Add the command to A separate procedure in Microsoft Dynamics GP is used to create the items that
the Navigation Pane appear in each section of the Navigation Pane. The following table lists the
menu structure. procedures used for each:
A procedure trigger registered for one of these procedures is used to add the list
command to the appropriate location in the Navigation Pane menu structure. For
example, the following is the procedure trigger registration that adds the
Navigation Pane items for the sample integrating application.
The trigger processing procedure has the following parameters, which indicate the
command list to which commands should be added:
in CmdParentDictID ParentDictID;
in CmdParentFormID ParentFormID;
in CmdParentCmdID ParentCmdID;
in integer LoadMode;
306 IN T E G R AT I O N G U ID E
C H A PT E R 3 0 T R A N S A C TI O N L IS T S
{Add the Contact History command to access the Contact History list}
{Find the appropriate location to add the item, after Salespeople}
Seq = FindCommandInMenu(ParentDictID,
ParentFormID,
ParentCmdID,
DYNAMICS,
resourceid(form Command_Sales),
resourceid(command ListObj_Salespeople of form Command_Sales),
LoadMode,
"");
{If the item was found, add the new item after it.}
if Seq <> 0 then
Seq = Seq + 1;
end if;
{Add the Contact History command to access the Contact History list}
Seq = Seq + 1;
Status = AddCommandToMenu(ParentDictID,
ParentFormID,
ParentCmdID,
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command ListObj_ContactHistory of form Command_IG_Sample),
true,
LoadMode);
Register the list The final step to making the list accessible is registering it. This is typically
command. performed in the form pre script for the command form that defines the list
navigation command. The registration process does the following:
Consider creating a constant for the list ID value. For instance, the constant
LISTID_CONTACTHISTORY is used for the Contact History list in the sample
integrating application.
308 IN T E G R AT I O N G U ID E
Chapter 31: Report Lists
Microsoft Dynamics GP has several Report Lists that provide access to the reports
that are part of a specific series or type. For example, the Sales Report List provides
access to reports associated with the Sales series, the System Report List provides
access to all system reports, and so on. If you have created reports for your
integration, you will want to add them to the appropriate Report List to make them
easily accessible.
The sample integrating application adds reports to the “sales” series so they appear
in the Sales Report List, as shown in the following illustration.
Information about integrating with the Report List is divided into the following
sections:
• Report types
• Report series
• Integrating with Report List
• Adding Report List items
• Retrieving Report List item information
• Printing and viewing reports
• Custom actions
• Composite definitions
Report types
Several types of reports can be added to the Report List. The actions enabled in the
Action Pane are based on the report type. The following table lists the types of
reports and the corresponding constants:
Report series
Each Report List displays the reports that are part of a specific Microsoft Dynamics
GP report series or of a specific type. The following table lists the report series and
corresponding constants for the report series that are predefined by the core
Dynamics.dic dictionary:
Series Constant
Financial REPORTSERIES_FINANCIAL
Sales REPORTSERIES_SALES
Purchasing REPORTSERIES_PURCHASING
Inventory REPORTSERIES_INVENTORY
Payroll REPORTSERIES_PAYROLL
Project REPORTSERIES_PROJECT
System REPORTSERIES_SYSTEM
Company REPORTSERIES_COMPANY
When you add reports for your integration, you will add them to the appropriate
existing report series.
When a specific Report List is displayed, the reports that are part of the series for
that list are listed. Triggers are activated as the LoadData procedure builds the
temporary table for the report list. If your integration has reports that should be
displayed for the selected report series, you will use AddReport() function to add
your reports to the list.
310 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
As each item is added to the Report List, other triggers are activated that will
retrieve additional details about the report being added. For example, one trigger
retrieves the display name for the report. Refer to Retrieving Report List item
information on page 316 for more information.
Other triggers are activated when the user selects a report in the list and performs
an action such as viewing or printing. Your integration will have to handle these
requests for the reports you add to each Report List. Refer to Printing and viewing
reports on page 321 for details.
The following example is a portion of the Startup script for the sample integrating
application. It registers a procedure trigger that will add items to the Sales Report
List for the sample.
• You are adding SmartList favorites, and the Report Series ID parameter is equal
to the constant REPORTS_SMARTLISTONLY defined on the syReportList form.
This indicates the user is viewing the “SmartList Favorites” Report List.
The following table lists the types of reports that can be added, and indicates which
components of the syReportData composite must be set. The Xs indicate required
values, and the Os indicate optional values for each type. Some components of the
composite are used internally by the Report List implementation, and should not be
set.
SmartList Favorite
SQL Reporting
External
Simple
Other
Report Type X X X X X X X
Product ID X X X X X X X
Report Series DictID X X X X X X
Report Series ID X X X X X X
Report Category ID O O O O O O
Report ID X X X X X X X
Report Option ID X
Report Option Name X O
My Report Name O
VisibleTo O
User ID O
User Class O
Company ID O
String A 255 O O O O O O
Report Options Table Ref O
Report Names Table Ref O
DictID X X X
Resid X X X
When adding a report that uses a report options window, you will be using the
AddReport() function several times. The first time adds the template report entry,
with the report option name “<<New>>”. This entry in the Report List opens the
report options window for the report so the user can create a new report option.
Next, your code should loop through every report option that has been defined for
the report, and add an entry to the Report List.
When adding an item for SmartList favorites, you must supply the
ASI_Favorite_Type for the Report ID component of the syReportData composite.
The Report List will automatically add all of the SmartList favorites of that type for
the current user logged into Microsoft Dynamics GP. If you specify the name of a
specific favorite in the Report Option Name component, only that item will be
added to the Report List.
Example
The following example shows the trigger processing procedure for the sample
integrating application that adds the various report types to the Sales Report List.
Notice how the reports are added to the predefined Sales report series. Also note
how only the SmartList favorites are added when the SmartList Favorites Report
List is being displayed.
312 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
in ListObjState list_object;
in 'Report Series DictID' nSeriesDictID;
in 'Report Series ID' nSeriesID;
{Add items to the Sales series or if all reports are being requested}
if (nSeriesID = REPORTS_ALL of form syReportList) or
➥ ((nSeriesDictID = DYNAMICS) and (nSeriesID = REPORTSERIES_SALES)) then
{Simple Report}
clear field RptData;
RptData:'Report Type' = REPORTTYPE_SIMPLE;
RptData:'Product ID' = IG_PROD_ID;
RptData:'Report Series DictID' = DYNAMICS;
RptData:'Report Series ID' = REPORTSERIES_SALES;
RptData:'Report ID' = ReptID_LeadsSimple;
RptData:'Report Option Name' = "Leads";
RptData:'DictID' = IG_PROD_ID;
RptData:'Resid' = resourceid(report IG_Leads);
{Then add an entry for each option that has been defined.}
range clear table IG_Leads_ROPT;
'Report ID' of table IG_Leads_ROPT = ReptID_LeadsWithOptions;
clear 'Report Option Name' of table IG_Leads_ROPT;
range start table IG_Leads_ROPT by number 1;
fill 'Report Option Name' of table IG_Leads_ROPT;
range end table IG_Leads_ROPT by number 1;
{Then add an entry for each option that has been defined.}
range clear table IG_Leads_ROPT;
'Report ID' of table IG_Leads_ROPT = ReptID_LeadsList;
clear 'Report Option Name' of table IG_Leads_ROPT;
range start table IG_Leads_ROPT by number 1;
fill 'Report Option Name' of table IG_Leads_ROPT;
range end table IG_Leads_ROPT by number 1;
314 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
{SmartList Favorite}
clear field RptData;
RptData:'Report Type' = REPORTTYPE_SMARTLISTFAVORITE;
RptData:'Product ID' = IG_PROD_ID;
RptData:'Report Series DictID' = DYNAMICS;
RptData:'Report Series ID' = REPORTSERIES_SALES;
RptData:'Report ID' = SMARTLIST_OBJECTTYPE_LEADS;
RptData:'Report Option Name' = "";
RptData:'VisibleTo' = SMARTLIST_VISIBLETO_SYSTEM; {All users}
end if;
{SmartList Favorite}
clear field RptData;
RptData:'Report Type' = REPORTTYPE_SMARTLISTFAVORITE;
RptData:'Product ID' = IG_PROD_ID;
RptData:'Report Series DictID' = DYNAMICS;
RptData:'Report Series ID' = REPORTSERIES_SALES;
RptData:'Report ID' = SMARTLIST_OBJECTTYPE_LEADS;
RptData:'Report Option Name' = "";
RptData:'VisibleTo' = SMARTLIST_VISIBLETO_SYSTEM; {All users}
end if;
The following is a list of the procedure and function triggers that you can
implement. All of them are located on the syReportList form.
TRIGGER_GetReportResid
This procedure trigger is used to retrieve the dictionary ID and resource ID of a
report that has been added to a Report List. It is used when security access is
checked for the report. If access is denied for the current user, the report will not
appear in the Report List.
The following example shows the registration for this trigger from the sample
integrating application.
The following example shows the trigger processing procedure that looks up and
returns the dictionary ID and resource ID for a report. Note how the Product ID and
Report ID components of the syReportData composite are examined to determine
which report is being queried.
{Leads report}
if (RptData:'Report ID' = ReptID_LeadsSimple) or (RptData:'Report ID' =
➥ ReptID_LeadsWithOptions) then
RptData:'Resid' = resourceid(report IG_Leads);
RptData:'DictID' = IG_PROD_ID;
end if;
end if;
316 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
TRIGGER_GetReportCategoryName
This function trigger is used to retrieve the report category name to display for each
report added to a Report List. The following example shows the registration for this
trigger from the sample integrating application.
The following example shows the trigger processing function that returns the report
category name for the reports included with the sample integrating application.
Note how the Product ID of the syReportData composite is examined to find which
product contains the report.
in syReportData RptData;
TRIGGER_GetReportDisplayName
This function trigger is used to retrieve the name to display for each report added to
a Report List. The following example shows the registration for this trigger from the
sample integrating application.
The following example shows the trigger processing function that returns the report
display name for the reports included with the sample integrating application. Note
how the Product ID and Report ID of the syReportData composite are examined to
find which report is being queried.
in syReportData RptData;
TRIGGER_GetReportDestination
This procedure trigger is used to retrieve report destination information for reports
that use a report options window. The following example shows the registration for
this trigger from the sample integrating application.
You will use the Product ID and Report ID components of the syReportData
composite to determine whether your report is being queried. If it is, you will look
up the report option information, and then set the components of the
ReportDestOptions composite with the option settings retrieved. Refer to the
description of this composite for the list of values that can be set. The information in
the ReportDestOptions composite is passed to the procedure that actually runs the
report.
If the “Ask Each Time” component is set to true in the composite, the Report
Destination window will be displayed automatically when the report is printed
from the Report List. The other settings in the composite, such as the output
destinations, will be reflected in the Report Destination window. After the user
makes selections in the destination window, the settings made are reflected in the
ReportDestOptions composite.
If the “Ask Each Time” component isn’t set to true in the composite, the other
options in the composite are passed directly to the procedure that runs the report.
The following example is the trigger processing procedure that retrieves the report
options for the Leads or Leads List reports.
inout syReportData RptData;
inout ReportDestOptions RptDest;
{The user asked for a report that uses a report option. Read the option
information and fill in the ReportDestOptions composite.}
318 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
{It's the Leads or Leads List report which uses a areport option.
Look up the option.}
{Don't look up <<New>> report option}
if (RptData:'Report Option Name' <> "") and (RptData:'Report Option
➥ Name' <> getmsg(7487)) then
TRIGGER_GetOptionsWindowIDs
This procedure trigger indicates which report options window to open for reports
that use report options. The following example shows the registration for this
trigger from the sample integrating application.
l_result = Trigger_RegisterProcedure(script TRIGGER_GetOptionsWindowIDs of
➥ form syReportList, TRIGGER_AFTER_ORIGINAL, script
➥ IG_ReportList_GetOptionsWindowIDs);
if l_result <> SY_NOERR then
warning "Procedure trigger registration failed.";
end if;
You will use the Product ID and Report ID components of the syReportData
composite to determine which report is being queried. If it is your report and uses
an options window, return your product ID and the resource ID of the form that
defines the report options window.
The following example is the trigger processing procedure that retrieves the ID of
the report options window used for the Leads and Leads List reports.
The Report List starts the process of opening the report options window for your
report. You must provide a form-level procedure on your report option form that
will be called by the Report List. This procedure must be named
“OpenOptionFromList” and take one “in” parameter of type syReportData. The
procedure will open the report options window. It will also use the information
passed into the procedure through the syReportData composite to determine which
report option should be displayed.
The following is the form-level procedure that was added to the IG_Leads_Reports
form for the sample integrating application. Note that it examines the report option
information passed in through the syReportData composite. If a specific report
option name is named, that option is displayed in the window.
Procedure: OpenOptionFromList
in syReportData rptData;
{Based on the data passed in, display the appropriate report option.}
'Report ID' of window 'Leads Report Options' = rptData:'Report ID';
if (rptData:'Report Option Name' <> "") and (rptData:'Report Option Name' <>
➥ getmsg(7487)) then
'(L) Report Options' of window 'Leads Report Options' =
➥ rptData:'Report Option Name';
run script '(L) Report Options' of window 'Leads Report Options';
end if;
320 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
TRIGGER_GetSmartListObjectSeries
This procedure trigger is used only for SmartList favorites. It is used to retrieve
information about a selected SmartList favorite in the Report List. The trigger
processing procedure must have the following parameters:
in DictID nObjectDictID;
in 'Report ID' nObjectID;
inout 'Report Series DictID';
inout 'Report Series ID' nSeriesID;
inout 'Series Name' sSeriesName;
Use the DictID and Report ID parameters to determine whether the SmartList
favorite belongs to your application. If it does, set the other parameters accordingly.
If you don’t use this trigger, the SmartList items for your integration will be
assigned to the System series.
TRIGGER_GetProcessIDs
This procedure trigger is used only for reports that can be sent to a process server.
The trigger processing procedure must have the following parameters:
Use the syReportData composite to find the identity of the report. If it’s your report
and can be sent to a process server, the trigger processing script must supply the
Process DictID and Process ID values.
The trigger processing procedure must handle both of these cases for your reports.
It must have the following parameters:
in syReportData RptData;
in ReportDestOptions RptDestOpts;
in boolean fPreview;
The fPreview flag is a boolean value passed into the procedure that is true if the user
chose View or false if the user chose Print. If View was chosen, the report should be
displayed on the screen. For reports that use report options, override any
destination settings for the option and print the report to the screen.
If Print was chosen, the action required depends on the type of report. Simple
reports should always be printed to the printer. For reports that use report options,
the destination should be set as indicated by the ReportDestOptions composite that
was passed into the trigger processing procedure. The values for this composite
were set when the report option was retrieved for the report. They may have been
updated by the user if the “Ask Each Time” flag had been set for the report option.
For reports that use report options, you should always retrieve the option specified
in the syReportData composite. Use the information in the report option to control
sorting, restrictions, and other characteristics for the report.
For reports that print from a window, the trigger processing procedure must open
the window from with the report will be run.
The following example is the trigger processing procedure that handles viewing
and printing reports for the sample integrating application. It demonstrates how to
print a simple report to the screen or to the printer. It also shows how a report that
uses a report option processed. Finally, it demonstrates how a report generated from
an window is processed.
in syReportData RptData;
in ReportDestOptions RptDestOpts;
in boolean fPreview;
322 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
{Did the user ask for a preview (to View the report)?}
if fPreview = true then
{Print the report using the options, but always to the screen}
ToScreen = true;
ToPrinter = false;
ExportType = 0;
ExportName = "";
else
ToScreen = RptDestOpts:'Print to Screen';
ToPrinter = RptDestOpts:'Print to Printer';
ExportType = RptDestOpts:'Export Type';
ExportName = RptDestOpts:'File Export Name';
end if;
Custom actions
Most actions the user will need to perform for a report in a Report List are
automatically added to the Action Pane. In some cases you might want to create
your own custom actions, such as when you add an “other” report type to a Report
List.
Adding and processing custom actions for a Report List is done using the same
techniques and for card lists or transaction lists. Refer to Chapter 27, “Action Pane,”
for details about adding to the Action Pane for a list.
Composite definitions
Several composites are used when working with Report Lists. Use the information
about these composites as you write scripts for your Report List integration.
syReportData
The syReportData composite contains information about a specific report in the
Report List.
324 IN T E G R AT I O N G U ID E
C H A P T E R 3 1 R E P O R T L IS T S
ReportDestOptions
The ReportDestOptions composite is used to pass report destination information
into the procedure that displays or prints reports.
ListObjState
The ListObjState composite provides access to the Report List window. The
following are the components of this composite used for the Report List:
• Chapter 32, “SmartList Overview,” explains how the SmartList works, and
describes how you can integrate with it.
• Chapter 33, “Adding to SmartList Objects,” describes how to add new columns
and Go To items to existing SmartLists.
• Chapter 34, “Creating New SmartList Objects,” describes how to create new
SmartList objects for your integration.
328 IN T E G R AT I O N G U ID E
Chapter 32: SmartList Overview
SmartList is a powerful tool that allows users to drill into the data contained in the
accounting system. By integrating with SmartList, you can make the data for your
integration available for users to query. Information about SmartList is divided into
the following sections:
• SmartList object type ID, which is an integer that uniquely identifies the
SmartList object
• A list of all of the columns that can be displayed by the SmartList object
• Go To links that allow the user to perform actions on the selected row
When a user chooses to SmartList object type to display, appropriate records are
read based on the SmartList object definition and displayed in the SmartList
window. Users can customize the search by doing the following:
• Choose columns they want to display, as well as the position order of the
columns
If the SmartList object is optimized for SQL Server, a SQL query is used to select the
records to be displayed in the SmartList. Otherwise, SmartList will manually search
the tables used for the SmartList object and display each matching row in the
SmartList.
Integration types
Two types of integrations are possible with SmartList. You can add new columns
and Go To items to existing SmartList objects. For example, the following
illustration shows two new columns added to the Customers SmartList object by
the sample integrating application. An additional Go To item was also to this
SmartList object.
You can also create new SmartList objects that provide access to the data for your
integration. For instance, the following illustration shows the SmartList displaying
lead information using the Leads SmartList object defined in the sample integrating
application.
330 IN T E G R AT I O N G U ID E
C H A P T E R 3 2 S M A R T LI S T O V E R V I E W
Integration technique
Creating a SmartList integration is a rather complex task. You will add several items
to your integrating application’s dictionary during the process. These include the
following:
Global variables
If you will be creating a new SmartList object for your integration, you will need to
create a global variable that will hold the key values for the row that is being added
to the SmartList.
Global procedures
You will add several global procedures with special names that will be called
automatically by the SmartList. These procedures will supply SmartList with
information needed to display data, perform Go To actions, and so on. All of these
procedures will begin with the word Explorer, which is the internal name used for
SmartList.
The Explorer procedures you add to your dictionary will be shared by all of the
SmartList objects you create, as well as the new columns and Go To items you add
to existing SmartList objects. The code you add to these procedures must use the
parameters passed into the procedure to know which SmartList object is requesting
information.
For example, “Explorer_Get_Table_Name” is one of the procedures you will add for
your SmartList integration. This procedure returns the technical name of a table that
contains the data for a specific column. The procedure has the following
parameters:
Notice the parameters that specify the SmartList object and field being queried. You
will use these parameters to know when one of your SmartList objects or columns is
being queried.
You will learn about the specific procedures in Chapter 33, “Adding to SmartList Objects,”
and Chapter 34, “Creating New SmartList Objects.”
Testing
You will have better results if you complete your SmartList integration code before
testing it. All of the SmartList procedures work together, so any missing procedures
will cause runtime errors.
The SmartList column and Go To records are stored in tables in the system database.
As you test, you may need to manually remove SmartList columns and Go To items
that you added for your integration. If incorrect parameter values were used when
you added these items, subsequent attempts to re-add the corrected items will fail
because the records already exist. The column information is stored in the
ASITAB20 table, while the Go To information is stored in the ASIEXP60 table.
Explorer procedures
Your integration will call several procedures defined in the SmartList dictionary.
These procedures perform actions like creating new SmartList objects, adding or
removing columns from a SmartList object, and so on. All of these procedures
beginwith the word Explorer, which is the internal name used for SmartList.
Since these procedures are defined in another third-party dictionary, you must call
them using the call with name statement. When using this statement, the procedure
names are passed in as strings, and there is no compile-time checking. Be sure to
type them carefully and watch for runtime errors.
SmartList objects
This section lists the SmartList objects that are defined for Microsoft Dynamics GP.
You can add additional columns and Go To items to these objects. The constant used
to refer to the object, along with the tables and join information for the object are
listed.
Account Summary
Object type value 13
Constant SMARTLIST_OBJECTTYPE_ACCOUNTSUMMARY
Tables GL10110 - GL_Account_SUM_MSTR
GL10111 - GL_Account_SUM_HIST
GL00100 - GL_Account_MSTR
Joins GL10110 left-outer join to GL00100
GL10111 left-outer join to GL00100
332 IN T E G R AT I O N G U ID E
C H A P T E R 3 2 S M A R T LI S T O V E R V I E W
Account Transactions
Object type value 12
Constant SMARTLIST_OBJECTTYPE_ACCOUNTTRANSACTIONS
Tables GL10001 - GL_TRX_LINE_WORK
GL20000 - GL_YTD_TRX_OPEN
GL30000 - GL_Account_TRX_HIST
MC40200 - MC_Currency_SETP
GL00100 - GL_Account_MSTR
GL10000 - GL_TRX_HDR_WORK
Joins GL10001 left-outer join to MC40200
GL10001 left-outer join to GL00100
GL10001 left-outer join to GL10000
GL20000 left-outer join to GL00100
GL20000 left-outer join to GL10000
GL30000 left-outer join to GL00100
Accounts
Object type value 1
Constant SMARTLIST_OBJECTTYPE_ACCOUNTS
Tables GL00100 - GL_Account_MSTR
Joins None
Bank Transactions
Object type value 22
Constant SMARTLIST_OBJECTTYPE_BANKTRANSACTIONS
Tables CM20300 - CM_Recipt
CM20200 - CM_Transaction
Joins None
Customer Addresses
Object type value 15
Constant SMARTLIST_OBJECTTYPE_CUSTOMERADDRESSES
Tables RM00102 - RM_Customer_MSTR_ADDR
RM00101 - RM_Customer_MSTR
SY01200 - coINetAddrs
Joins RM00102 left-outer join to RM00101
RM00102 left-outer join to SY01200
Customer Items
Object type value 24
Constant SMARTLIST_OBJECTTYPE_CUSTOMERITEMS
Tables SOP60300 - sopCustomerItemXref
IV00101 - IV_Item_MSTR
RM00101 - RM_Customer_MSTR
RM00103 - RM_Customer_MSTR_SUM
Joins SOP60300 left-outer join to IV00101
SOP60300 left-outer join to RM00101
SOP60300 left-outer join to RM00103
Customers
Object type value 2
Constant SMARTLIST_OBJECTTYPE_CUSTOMERS
Tables RM00101 - RM_Customer_MSTR
Joins None
Employee Summary
Object type value 32
Constant SMARTLIST_OBJECTTYPE_EMPLOYEESUMMARY
Tables UPR00100 - UPR_MSTR
UPR00900 - UPR_Employee_SUM
UPR00901 - UPR_Employee_Tips_SUM
UPR00300 - UPR_MSTR_Tax_Info
UPR00900 - UPR_Employee_SUM
Joins UPR00100 left-outer join to UPR00900
UPR00100 left-outer join to UPR00901
UPR00100 left-outer join to UPR00300
UPR00900 left-outer join to UPR00901
Employees
Object type value 5
Constant SMARTLIST_OBJECTTYPE_EMPLOYEES
Tables UPR00100 - UPR_MSTR
UPR00300 - UPR_MSTR_Tax_Info
UPR00102 - uprMstrAddress
Joins UPR00100 left-outer join to UPR00300
UPR00100 left-outer join to UPR00102
Inventory Transactions
Object type value 19
Constant SMARTLIST_OBJECTTYPE_INVENTORYTRANSACTIONS
Tables IV10001 - IV_TRX_WORK_LINE
IV40201 - IV_UofM_SETP_HDR
IV10000 - IV_TRX_WORK_HDR
IV30300 - IV_TRX_HIST_LINE
IV30200 - IV_TRX_HIST_HDR
IV00101 - IV_Item_MSTR
Joins IV10001 left-outer join to IV00101
IV10001 left-outer join to IV10000
IV30300 left-outer join to IV00101
IV30300 left-outer join to IV30200
IV00101 left-outer join to IV40201
334 IN T E G R AT I O N G U ID E
C H A P T E R 3 2 S M A R T LI S T O V E R V I E W
Item Quantities
Object type value 11
Constant SMARTLIST_OBJECTTYPE_ITEMQUANTITIES
Tables IV00102 - IV_Item_MSTR_QTYS
IV00103 - IV_Item_MSTR_VNDR
PM00200 - PM_Vendor_MSTR
IV00101 - IV_Item_MSTR
IV40201 - IV_UofM_SETP_HDR
Joins IV00102 left-outer join to IV00103
IV00102 left-outer join to PM00200
IV00102 left-outer join to IV00101
IV00101 left-outer join to IV40201
Items
Object type value 4
Constant SMARTLIST_OBJECTTYPE_ITEMS
Tables IV00101 - IV_Item_MSTR
Joins None
Landed Cost ID
Object type value 30
Constant SMARTLIST_OBJECTTYPE_LANDEDCOSTID
Tables IV41100 - ivLandedCost
Joins None
Multidimensional Analysis
Object type value 14
Constant SMARTLIST_OBJECTTYPE_MDA
Tables DTA10200 - DTA_Transaction_Codes_WORK
DTA10100 - DTA_Transaction_Groups_WORK
GL00100 - GL_Account_MSTR
Joins DTA10200 left-outer join to DTA10100
DTA10200 left-outer join to GL00100
Payables Transactions
Object type value 9
Constant SMARTLIST_OBJECTTYPE_PAYABLESTRANSACTIONS
Tables PM10000 - PM_Transaction_WORK
MC020103 - MC_PM_Transactions
PM00200 - PM_Vendor_MSTR
PM00201 - PM_Vendor_MSTR_SUM
PM20000 - PM_Transaction_OPEN
PM30200 - PM_Paid_Transaction_HIST
Joins PM10000 left-outer join to MC020103
PM10000 left-outer join to PM00200
PM10000 left-outer join to PM00201
PM20000 left-outer join to MC020103
PM20000 left-outer join to PM00200
PM20000 left-outer join to PM00201
PM30200 left-outer join to MC020103
PM30200 left-outer join to PM00200
PM30200 left-outer join to PM00201
Payroll Transactions
Object type value 10
Constant SMARTLIST_OBJECTTYPE_PAYROLLTRANSACTIONS
Tables UPR10302 - UPR_TRX_Batch_Detail
UPR00100 - UPR_MSTR
UPR00300 - UPR_MSTR_Tax_Info
UPR00102 - uprMstrAddress
Joins UPR10302 left-outer join to UPR00100
UPR10302 left-outer join to UPR00300
UPR00100 left-outer join to UPR00102
Prospects
Object type value 17
Constant SMARTLIST_OBJECTTYPE_PROSPECTS
Tables SOP00200 - SOP_Prospect_MSTR
Joins None
336 IN T E G R AT I O N G U ID E
C H A P T E R 3 2 S M A R T LI S T O V E R V I E W
Purchase Orders
Object type value 7
Constant SMARTLIST_OBJECTTYPE_PURCHASEORDERS
Tables POP10100 - POP_PO
PM00200 - PM_Vendor_MSTR
PM00201 - PM_Vendor_MSTR_SUM
RM00101 - RM_Customer_MSTR
RM00103 - RM_Customer_MSTR_SUM
POP30100 - POP_POHist
Joins POP10100 left-outer join to PM00200
POP10100 left-outer join to PM00201
POP10100 left-outer join to RM00101
POP10100 left-outer join to RM00103
POP30100 left-outer join to PM00200
POP30100 left-outer join to PM00201
POP30100 left-outer join to RM00101
POP30100 left-outer join to RM00103
Receivables Transactions
Object type value 8
Constant SMARTLIST_OBJECTTYPE_RECEIVABLESTRANSACTIONS
Tables RM10301 - RM_Sales_WORK
RM00101 - RM_Customer_MSTR
MC020102 - MC_RM_Transactions
RM00103 - RM_Customer_MSTR_SUM
RM20101 - RM_OPEN
RM30101 - RM_HISTORY
Joins RM10301 left-outer join to RM00101
RM10301 left-outer join to MC020102
RM10301 left-outer join to RM00103
RM20101 left-outer join to RM00101
RM20101 left-outer join to MC020102
RM20101 left-outer join to RM00103
RM30101 left-outer join to RM00101
RM30101 left-outer join to MC020102
RM30101 left-outer join to RM00103
Receivings Transactions
Object type value 27
Constant SMARTLIST_OBJECTTYPE_RECEIVINGSTRANSACTIONS
Tables POP10300 - POP_Receipt
PM00201 - PM_Vendor_MSTR_SUM
POP10306 - POP_ReceiptUserDefined
POP30300 - POP_ReceiptHist
Joins POP10300 left-outer join to PM00201
POP10300 left-outer join to POP10306
POP30300 left-outer join to PM00201
POP30300 left-outer join to POP10306
338 IN T E G R AT I O N G U ID E
C H A P T E R 3 2 S M A R T LI S T O V E R V I E W
Sales Transactions
Object type value 6
Constant SMARTLIST_OBJECTTYPE_SALESTRANSACTIONS
Tables SOP10100 - SOP_HDR_WORK
SOP10106 - sopUsrDefWorkHist
RM00101 - RM_Customer_MSTR
RM00103 - RM_Customer_MSTR_SUM
SOP30200 - SOP_HDR_HIST
Joins SOP10100 left-outer join to SOP10106
SOP10100 left-outer join to RM00101
SOP10100 left-outer join to RM00103
SOP30200 left-outer join to SOP10106
SOP30200 left-outer join to RM00101
SOP30200 left-outer join to RM00103
Vendor Addresses
Object type value 16
Constant SMARTLIST_OBJECTTYPE_VENDORADDRESSES
Tables PM00300 - PM_Address_MSTR
PM00200 - PM_Vendor_MSTR
SY01200 - coINetAddrs
Joins PM00300 left-outer join to PM00200
PM00300 left-outer join to SY01200
Vendor Items
Object type value 23
Constant SMARTLIST_OBJECTTYPE_VENDORITEMS
Tables IV00103 - IV_Item_MSTR_VNDR
IV00101 - IV_Item_MSTR
PM00200 - PM_Vendor_MSTR
Joins IV00103 left-outer join to IV00101
IV00103 left-outer join to PM00200
Vendors
Object type value 3
Constant SMARTLIST_OBJECTTYPE_VENDORS
Tables PM00200 - PM_Vendor_MSTR
PM00201 - PM_Vendor_MSTR_SUM
PA00001 - paCustomerVendorMSTR
RM00101 - RM_Customer_MSTR
Joins PM00200 left-outer join to PM00201
PM00200 left-outer join to PA00001
PM00200 left-outer join to RM00101
340 IN T E G R AT I O N G U ID E
Chapter 33: Adding to SmartList Objects
You can add additional columns and Go To items to existing SmartList objects.
Information about adding these items is contained in the following sections:
• Columns
• Go To items
Columns
Additional columns you add to a SmartList object will reference data related to the
object. For example, the sample integrating application adds columns to the
Customers SmartList object that track customer contact history information. The
new columns appear identical to those that exist for the object.
The trigger processing procedure that runs when the trigger is activated will add
the new columns to the Customer SmartList object. Use the
Explorer_Add_Column_To_Object procedure in the SmartList dictionary to add
the new columns. When you add a column, you specify the following:
The following trigger processing procedure from the sample integrating application
shows how two columns are added to the Customers SmartList object.
342 IN T E G R AT I O N G U ID E
C H A P T E R 3 3 AD DI NG T O S M AR TL IST OBJE CT S
The IN_Master_ID parameter will contain the values of the key fields for the
primary key of the main table for the SmartList object. You will use these key fields
to retrieve the appropriate record from your table for the row being displayed in the
SmartList. Refer to SmartList objects on page 332 for a list of the primary tables that
correspond to the SmartList object types.
The field values passed in though the IN_Master_ID parameter will be padded with
spaces to each field’s specified length. For example, a field with the STR30 datatype
will be padded to a length of 30. Your code must parse the string into the individual
field values.
After your code has retrieved the appropriate record from your table, it must set the
inout parameters for the column you added. The value of the IO_String parameter
must be set to the string value you want displayed in the SmartList. If necessary,
you can apply formatting to this string. For instance, you could use the format()
function to apply formatting to a currency value.
Your code must set the IO_Datatype parameter, which specifies the underlying
datatype for the column. Then it must set the value of the corresponding parameter
for the datatype. For example, if the column displays a currency value, you will set
the IO_Datatype parameter to SMARTLIST_DATATYPE_CURRENCY and set the
IO_Currency parameter to the actual currency value for the column.
344 IN T E G R AT I O N G U ID E
C H A P T E R 3 3 AD DI NG T O S M AR TL IST OBJE CT S
in integer IN_Object_DictID;
in integer IN_Object_Type;
in integer IN_FieldDictID;
in integer IN_FieldID;
inout anonymous field IO_From_DDL;
inout anonymous field IO_To_DDL;
The IO_From_DDL and IO_To_DDL parameters contain references to the two drop-
down lists that appear in the Search window. Your code must fill these drop-down
lists with the values for the list field of the column the user selected. List fields must
be window fields to have their static values read by sanScript code. You will need to
place an instance of the list field on a hidden window so its static values can be
accessed. A hidden window on a command form is a good place to add the hidden
list field.
346 IN T E G R AT I O N G U ID E
C H A P T E R 3 3 AD DI NG T O S M AR TL IST OBJE CT S
in integer IN_Object_DictID;
in integer IN_Object_Type;
in integer IN_FieldDictID;
in integer IN_FieldID;
inout anonymous field IO_From_DDL;
inout anonymous field IO_To_DDL;
local integer i;
SQL optimization
SmartList can perform optimized searches when used with SQL Server. To take
advantage of this optimization for the columns you have added, you must indicate
that you have added the necessary procedures to support the optimization. These
additional procedures will be called by SmartList as it searches data in the new
columns you have added.
Since SQL Server is supported for all products, we recommend that you support SQL
optimization for the columns you add to existing SmartList objects.
Add the To indicate that the new columns you have added support SQL optimization, you
Explorer_Optimize_ will add the Explorer_Optimize_For_SQL procedure to your integration. This
For_SQL procedure. procedure should return true if you support optimization for the object, and false if
you do not.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field;
inout boolean IO_Optimize;
• Table technical name of the table that stores the data for the column
• ID of the dictionary containing the table that stores the data for the column
• Type of list field used for the column (if applicable)
This information is used when generating the SQL query used to search for
matching records.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field;
inout string IO_Table_Name;
inout integer IO_Table_Dict_ID;
inout integer IO_DDL_Type;
348 IN T E G R AT I O N G U ID E
C H A P T E R 3 3 AD DI NG T O S M AR TL IST OBJE CT S
Several types of joins are supported, but virtually all joins needed for SmartList are left-
outer joins.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
inout integer l_Doc_Status;
If you don’t have field names that change based on the document type, this
procedure should return the empty string. This causes the original field name to be
used.
clear OUT_Field_Name;
Go To items
Go To items in SmartList provide quick navigation to the windows in the
accounting system that allow you to view of modify the selected item. You can add
additional Go To items to existing SmartList objects.
350 IN T E G R AT I O N G U ID E
C H A P T E R 3 3 AD DI NG T O S M AR TL IST OBJE CT S
The trigger processing procedure that runs when the trigger is activated will add
the new Go To items to the Customer SmartList object. Use the
Explorer_Add_GoTo_Item procedure in the SmartList dictionary to add the new
Go To items. When you add a Go To item, you specify the following:
The following trigger processing procedure from the sample integrating application
shows how an additional Go To item is added to the Customers SmartList object.
Processing Go To items
Add the The additional Go To items you add must be processed by the procedure named
Explorer_GoTo_Button Explorer_GoTo_Button that you will add to your dictionary. This procedure must
procedure. have the following parameters:
The procedure will examine the values passed into these parameters to determine
whether it must process the Go To item. If it should, the list view field for the Smart
List is passed in as an anonymous field. This allows the code to find the currently-
selected line and perform the specified action for that item.
352 IN T E G R AT I O N G U ID E
Chapter 34: Creating New SmartList Objects
You can create new SmartList objects that provide access to data for your
integration. Information abuot creating these objects is contained in the following
sections:
The following example is a portion of the Startup script for the sample integrating
application. It registers a focus trigger for the ASI_Explorer form which is the main
form for the SmartList. Notice that the trigger is registered by name, since the form
is located in the SmartList dictionary, not the core dictionary.
The trigger processing procedure that runs in response to this trigger performs
several tasks. It uses the Explorer_Add_Object procedure to define the new
SmartList object. It also adds columns and Go To items to the new object. To
simplify the code, these actions are usually performed in separate procedures.
The following is the trigger processing procedure that creates the Leads SmartList
object for the sample integrating application. Each new SmartList object you create
must have an ID that is unique for your product. This ID will be used throughout
the code for the new SmartList object, so you will want to create a constant for the
ID. For the Leads object, the constant SMARTLIST_OBJECTTYPE_LEADS was
created. The columns and Go To items for the new SmartList object are added in
separate procedures.
SmartList security
Each SmartList object has a corresponding security task operation in Microsoft
Dynamics GP. This allows the administrator to control access to each SmartList.
Consider adding your SmartList to existing security tasks so users assigned to those
tasks can access it. Refer to Chapter 36, “Security,” for more information.
Object name
Add the The name for a SmartList object will appear throughout the SmartList user
Explorer_Get_Object_ interface. The Explorer_Get_Object_Name procedure will be called by the SmartList
Name procedure. each time the object’s name is needed. This procedure should return the name of the
object, including a trailing space at the end.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
inout string IO_Object_Name;
clear IO_Object_Name;
if IN_Object_Dict_ID = IG_PROD_ID then
if IN_Object_Type = SMARTLIST_OBJECTTYPE_LEADS then
IO_Object_Name = "Leads ";
end if;
end if;
Object columns
Use the Explorer_Add_Column_To_Object procedure in the SmartList dictionary
to add the columns to the new SmartList object. When you add a column, you
specify the following:
354 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
{Lead ID}
call with name "Explorer_Add_Column_To_Object" in dictionary SMARTLIST,
IG_PROD_ID, {dictionary}
SMARTLIST_OBJECTTYPE_LEADS, {object}
IG_PROD_ID, {found where}
resourceid(field 'Lead ID'), {field id}
"Lead ID", {display name}
technicalname(field 'Lead ID'), {column name}
true, {Included in the default query}
SMARTLIST_DATATYPE_STRING,
1, {Not a radio group}
false, {Not advanced lookup field}
false, {Not user defined field}
display_sequence,
field_sequence,
l_error;
if l_error <> OKAY and l_error <> DUPLICATE then
set l_message to getmsg(22003);
substitute l_message, "Explorer_Add_Column_To_Object", str(l_error);
error l_message;
end if;
{Lead Name}
call with name "Explorer_Add_Column_To_Object" in dictionary SMARTLIST,
IG_PROD_ID, {dictionary}
SMARTLIST_OBJECTTYPE_LEADS, {object}
IG_PROD_ID, {found where}
resourceid(field 'Lead Name'), {field id}
"Lead Name", {display name}
technicalname(field 'Lead Name'), {column name}
true, {Included in the default query}
SMARTLIST_OBJECTTYPE_LEADS,
1, {Not a radio group}
false, {Not advanced lookup field}
false, {Not user defined field}
display_sequence,
field_sequence,
l_error;
if l_error <> OKAY and l_error <> DUPLICATE then
set l_message to getmsg(22003);
substitute l_message, "Explorer_Add_Column_To_Object", str(l_error);
error l_message;
end if;
356 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
If you were integrating with an existing SmartList object, you would use the
IN_Master_ID parameter which would contain the key information needed to
retrieve the record with fields to display. Because this is a new SmartList object, this
parameter will not be set. Instead, a global variable named SmartList_Master_ID is
used to pass the key information into this procedure. You must add this global
variable to your integrating application. It has the following characteristics:
The keyable length for this global variable must be long enough to support the
longest key values you will pass to the procedure to retrieve each row of data for
your SmartList object.
After your code has used the key information from the SmartList_Master_ID global
variable to retrieve the appropriate record from your table, it must set the inout
parameters for the column you added. The value of the IO_String parameter must
be set to the string value you want to be searchable by the SmartList. If necessary,
you can apply formatting to this string. For instance, you could use the format()
function to apply formatting to a currency value.
Your code must set the IO_Datatype parameter, which specifies the underlying
datatype for the column. Then it must set the value of the corresponding parameter
for the datatype. For example, if the column displays a currency value, you will set
the IO_Datatype parameter to SMARTLIST_DATATYPE_CURRENCY and set the
IO_Currency parameter to the actual currency value for the column.
{Handle columns for new SmartList objects that are not SQL-optimized}
if IN_Object_Dict_ID = IG_PROD_ID then
if IN_Object_Type = SMARTLIST_OBJECTTYPE_LEADS then
{Read the record for the row being populated}
358 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
360 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
in integer IN_Object_DictID;
in integer IN_Object_Type;
in integer IN_FieldDictID;
in integer IN_FieldID;
inout anonymous field IO_From_DDL;
inout anonymous field IO_To_DDL;
The IO_From_DDL and IO_To_DDL parameters contain references to the two drop-
down lists that appear in the Search window. Your code must fill these drop-down
lists with the values for the list field of the column the user selected. List fields must
be window fields to have their static values read by sanScript code. You will need to
place an instance of the list field on a hidden window so its static values can be
accessed. A hidden window on a command form is a good place to add the hidden
list field.
in integer IN_Object_DictID;
in integer IN_Object_Type;
in integer IN_FieldDictID;
in integer IN_FieldID;
inout anonymous field IO_From_DDL;
inout anonymous field IO_To_DDL;
local integer i;
This procedure is directly adding items to the list view that the user will see, any formatting
to apply (such as currency formatting) must be done in this procedure.
in integer IN_Total_SubItems;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in long IN_Record_Count;
inout table IG_Leads_MSTR;
local long n;
local integer l_Count;
local string l_Field_As_String;
local long l_Field_As_Integer;
local date l_Field_As_Date;
local currency l_Field_As_Currency;
local time l_Field_As_Time;
local integer l_Datatype;
local boolean b_Success;
set l_Count to 1;
362 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
➥ table IG_Leads_MSTR);
l_Field_As_Integer = 'Lead Business Category' of table
➥ IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_DDL;
in [resourceid(field 'Potential Revenue')]
l_Field_As_String = format('Potential Revenue' of table
➥ IG_Leads_MSTR, true, true, 2, SYSTEMNEG);
l_Field_As_Currency = 'Potential Revenue' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_CURRENCY;
in [resourceid(field 'Contact')]
l_Field_As_String = 'Contact' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Address 1')]
l_Field_As_String = 'Address 1' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Address 2')]
l_Field_As_String = 'Address 2' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'City')]
l_Field_As_String = 'City' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'State')]
l_Field_As_String = 'State' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Zip')]
l_Field_As_String = 'Zip' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Phone 1')]
l_Field_As_String = FormatPhoneNumber('Phone 1' of table
➥ IG_Leads_MSTR);
l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
in [resourceid(field 'Phone 2')]
l_Field_As_String = FormatPhoneNumber('Phone 2' of table
➥ IG_Leads_MSTR);
l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
in [resourceid(field 'Fax')]
l_Field_As_String = FormatPhoneNumber('Fax' of table
➥ IG_Leads_MSTR);
l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
in [resourceid(field 'Salesperson ID')]
l_Field_As_String = 'Salesperson ID' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Qualified Lead')]
{Need a "helper" window field to get the qualification status}
'Qualified Lead' of window Dummy of form Command_IG_Sample =
➥ 'Qualified Lead' of table IG_Leads_MSTR;
l_Field_As_String = itemname('Qualified Lead' of window Dummy of
➥ form Command_IG_Sample, 'Qualified Lead' of table
➥ IG_Leads_MSTR);
l_Field_As_Integer = 'Qualified Lead' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_DDL;
in [resourceid(field 'Qualification Date')]
l_Field_As_String = str('Qualification Date' of table
➥ IG_Leads_MSTR);
l_Field_As_Date = 'Qualification Date' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_DATE;
increment l_Count;
end while;
This procedure sets the SmartList_Master_ID global variable that was described in
Retrieving column values on page 357.
This procedure will also be called when the SmartList object is used with a reminder
in Microsoft Dynamics GP. When you create a SmartList favorite, it can also be
saved as a reminder that appears on the home page. When used for a reminder, a
summary containing the total number of records, or the total of the values of a
specific column is returned from the procedure. When the summary is being
generated, the user stop action and the maximum number of records setting for the
SmartList query are ignored. This ensures that all records in the table are examined
for the summary.
in integer IN_Total_SubItems;
in Explorer_BOOL_List IN_Searching;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
in Explorer_INT_List IN_Datatype;
in Explorer_INT_List IN_Type;
in Explorer_STR30_List IN_Search_From;
in Explorer_STR30_List IN_Search_To;
in Explorer_BOOL_List IN_Match_Case;
364 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
in integer IN_Global_Search_Type;
in Explorer_Field_Comparison IN_Field_Comparison;
in Explorer_Start_Comp_Field_ID IN_Start_Comp_Field_ID;
in Explorer_Start_Comp_Field_Dict IN_Start_Comp_Field_Dict;
in Explorer_End_Comp_Field_ID IN_End_Comp_Field_ID;
in Explorer_End_Comp_Field_Dict IN_End_Comp_Field_Dict;
in boolean IN_GetSummary;
in integer IN_Summary_Type; {0 = Number of records, 1 = Total of Column}
inout long IO_SummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_ColumnTotal;
{This is the traditional SmartList code that works for all database types}
set l_Record_Count to 0;
set l_Key to 1;
call with name "Explorer_Check_Stop_Processing" in dictionary SMARTLIST,
➥ b_Stop;
IN_Field_Comparison,
IN_Start_Comp_Field_ID,
IN_Start_Comp_Field_Dict,
IN_End_Comp_Field_ID,
IN_End_Comp_Field_Dict,
b_Found;
366 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
if b_Found then
increment l_Record_Count;
if IN_Summary_Type = 1 then
{ A total is being requested for the specified field }
clear IO_Currency;
call Explorer_Get_Field_As_String_From_Table,
IO_String,
IG_PROD_ID,
SMARTLIST_OBJECTTYPE_LEADS,
IN_nSummaryFieldDictID,
IN_nSummaryFieldID,
(IN_Searching[1] or IN_Searching[2] or IN_Searching[3] or
➥ IN_Searching[4]),
'Lead ID' of table IG_Leads_MSTR,
IO_Datatype,
IO_Long,
IO_Date,
IO_Currency,
IO_Time;
• Whether all of the records for the SmartList object are being displayed, or search
criteria are specified so that only certain records are displayed.
in boolean IN_GetSummary;
in integer IN_SummaryType; {0 = Number of records, 1 = Total of Column}
inout long IO_nSummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_cyColumnTotal;
local integer i;
local Explorer_BOOL_List l_Searching;
local Explorer_INT_List l_Datatype;
368 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
call SmartList_GetLeadRecords,
IN_Total_Sub_Items,
l_Searching,
IN_Dict_List,
IN_Field_List,
IN_Field_Dict_ID,
IN_Field,
l_Datatype,
IN_Type,
IN_Search_From,
IN_Search_To,
IN_Match_Case,
IN_Global_Search_Type,
IN_Field_Comparison,
IN_Start_Comp_Field_ID,
IN_Start_Comp_Field_Dict,
IN_End_Comp_Field_ID,
IN_End_Comp_Field_Dict,
IO_Max_Records,
IN_GetSummary,
IN_SummaryType,
IO_nSummaryCount,
IN_nSummaryFieldDictID,
IN_nSummaryFieldID,
IO_cyColumnTotal;
end if;
If SQL optimization has been implemented for the SmartList object and the user has
specified search criteria, the Explorer_Process_SQL_Data procedure will be called
instead. The SmartList will have generated a SQL results set that contains the key
values of the records that match the search criteria. This results set is passed into the
Explorer_Process_SQL_Data procedure, where the current row will be retrieved
and displayed in the SmartList.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Total_SubItems;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in long IN_Record_Count;
inout long SQL_Context;
SQL optimization
SmartList can perform optimized searches when used with SQL Server. To take
advantage of this optimization, you must indicate that your new SmartList object is
optimized for SQL, and provide several additional procedures that will be used by
SmartList when it searches the data for the new object.
Since SQL Server is supported for all products, we recommend that you make your new
SmartList objects optimized for SQL Server.
370 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field;
inout boolean IO_Optimize;
• Table technical name of the table that stores the data for the column
• ID of the dictionary containing the table that stores the data for the column
• Type of list field used for the column (if applicable)
This information is used when generating the SQL query used to search for
matching records.
Several types of joins are supported, but virtually all joins needed for SmartList are left-
outer joins.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
inout integer l_Doc_Status;
372 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
If you don’t have field names that change based on the document type, this
procedure should return the empty string. This causes the original field name to be
used.
clear OUT_Field_Name;
Go To items
Go To items in SmartList provide quick navigation to the windows in the
accounting system that allow you to view of modify the selected item. You can add
additional Go To items to new SmartList objects you create.
Adding Go To items
Use the Explorer_Add_GoTo_Item procedure in the SmartList dictionary to add
the Go To items. When you add a Go To item, you specify the following:
The following procedure from the sample integrating application that adds the Go
To items for the Leads SmartList object created by the sample. Notice how the
separator item is added to the list.
374 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
Processing Go To items
Add the The Go To items you add must be processed by the procedure named
Explorer_GoTo_Button Explorer_GoTo_Button that you will add to your dictionary. This procedure must
procedure. have the following parameters:
The procedure will examine the values passed into these parameters to determine
whether it must process the Go To item. If it should, the list view field for the Smart
List is passed in as an anonymous field. This allows the code to find the currently-
selected line and perform the specified action for that item.
For example, the following code is part of the procedure that adds to the Report List
for the sample integrating application. This code makes favorites for the new Leads
SmartList object available in the Report List.
{SmartList Favorite}
clear field RptData;
RptData:'Report Type' = REPORTTYPE_SMARTLISTFAVORITE;
RptData:'Product ID' = IG_PROD_ID;
RptData:'Report Series DictID' = IG_PROD_ID;
RptData:'Report Series ID' = 1;
RptData:'Report ID' = SMARTLIST_OBJECTTYPE_LEADS;
RptData:'Report Option Name' = "";
RptData:'VisibleTo' = SMARTLIST_VISIBLETO_SYSTEM;
376 IN T E G R AT I O N G U ID E
C H A P T E R 3 4 C R E A T I N G N EW S M A R TL I S T O B J E C T S
By default, SmartList objects you create will be listed with the “3rd Party” series
assigned to them. To have the SmartList items assigned to a different series, you
must create a procedure trigger for the GetSmartListObjectSeries procedure of the
syReportList form. The following example shows this trigger from the sample
integrating application.
The trigger processing procedure examines which SmartList object is being added
to the Report List. If it’s the Leads object, the series is set to “Sales”.
in DictID nObjectDictID;
in 'Report ID' nObjectID;
inout 'Report Series DictID' nSeriesDictID;
inout 'Report Series ID' nSeriesID;
inout 'Series Name' sSeriesName;
• Explorer_Fill_Range_DDLs_From_Field_ID
• Explorer_Get_Datatype
• Explorer_Get_DDL_Type
• Explorer_Get_Field_As_String_From_Table
• Explorer_Get_Object_Name
• Explorer_Get_Records_Background
• Explorer_Get_SQL_Field_Info
• Explorer_Get_SQL_Join_Info
• Explorer_Get_SQL_Override_Field_Name
• Explorer_Get_SQL_Query_Fields
• Explorer_Get_Table_Name
• Explorer_Get_User_Defined_Prompt
• Explorer_GoTo_Button
• Explorer_Optimize_For_SQL
• Explorer_Process_SQL_Data
Explorer_Fill_Range_DDLs_From_Field_ID
This procedure is called to retrieve all of the valid selections in a list field. The
values are used in the Search window for SmartList.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_FieldID;
inout anonymous field IO_From_DDL;
inout anonymous field IO_To_DDL;
IN_FieldID – An integer specifying the resource ID of the field for which list values
are being retrieved.
Explorer_Get_Datatype
This procedure is called by SmartList whenever it must determine the datatype for a
column or field. Based on the parameter values passed in, the procedure must
return the datatype for specified column or field.
IO_Datatype – An integer that must be set by the procedure to indicate the datatype
of the specified column or field. The value corresponds to one of the following:
IN_Field_ID – An integer specifying the resource ID of the field for which the
datatype is being retrieved.
380 IN T E G R AT I O N G U ID E
C H A P T E R 3 5 S M A R T LI S T P R O C E D U R E R E FE R E N C E
Explorer_Get_DDL_Type
This procedure is called for list columns added to a SmartList object. If the list field
for the column is 0-based (radio groups) the value 0 should be returned. If the list
field for the column is 1-based (all other types of list fields) the value 1 should be
returned.
OUT_DDL_Type – An integer that must be set by the procedure to indicate the type
of list field for the field. The value 0 indicates a 0-based list, while the value 1
indicates a 1-based list.
IN_Field_ID – An integer specifying the resource ID of the field for which the list
type is being retrieved.
Explorer_Get_Field_As_String_From_Table
This procedure returns the string representation and the underlying data in the
native datatype for a column. It is used when displaying data for additional
columns added to core SmartList objects. It is also used in the iterative fallback
searching code for SmartList objects that are not SQL-optimized.
IO_String – A string that must be set by the procedure to indicate the string
representation of the data in the specified field or column.
IN_Field_ID – An integer specifying the resource ID of the field for which the string
representation is being retrieved.
IO_Datatype – An integer that must be set by the procedure that specifies the field or
column’s underlying datatype. The value corresponds to one of the following:
IO_Long – If the underlying datatype of the column is an integer or long integer, the
procedure should set this parameter to the field’s native integer or long integer
value.
IO_Date – If the underlying datatype of the column is a date, the procedure should
set this parameter to the field’s native date value.
382 IN T E G R AT I O N G U ID E
C H A P T E R 3 5 S M A R T LI S T P R O C E D U R E R E FE R E N C E
IO_Time – If the underlying datatype of the column is a time, the procedure should
set this parameter to the field’s native time value.
Explorer_Get_Object_Name
This procedure retrieves the name of the specified SmartList object. For proper
display, the name should have a trailing space.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
inout string IO_Object_Name;
IO_Object_Name – A string that must be set by the procedure to indicate the name of
the specified SmartList object. For proper display, the name should have a trailing
space.
Explorer_Get_Records_Background
This procedure begins the process of retrieving and displaying records for a
SmartList object. It is called when no search criteria have been specified. It is also
called when search criteria are specified, but the SmartList object has not been
optimized for SQL Server. Most of the parameters for this script will simply be
passed to other SmartList procedures.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
in Explorer_INT_List IN_Type;
in Explorer_STR30_List IN_Search_From;
in Explorer_STR30_List IN_Search_To;
in Explorer_BOOL_List IN_Match_Case;
in integer IN_Global_Search_Type;
in integer IN_Total_Sub_Items;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in Explorer_Field_Comparison IN_Field_Comparison;
in Explorer_Start_Comp_Field_ID IN_Start_Comp_Field_ID;
in Explorer_Start_Comp_Field_Dict IN_Start_Comp_Field_Dict;
in Explorer_End_Comp_Field_ID IN_End_Comp_Field_ID;
in Explorer_End_Comp_Field_Dict IN_End_Comp_Field_Dict;
in Explorer_Start_Date_Token_DDL IN_Date_Token_From;
in Explorer_End_Date_Token_DDL IN_Date_Token_To;
inout long IO_Max_Records;
in boolean IN_GetSummary;
in integer IN_SummaryType;
inout integer IO_nSummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_cyColumnTotal;
IN_Field – An array of four integers containing the resource IDs of the fields that are
being searched.
IN_Type – An array of four integers that represent the type of search being
performed on each search field.
IN_Search_From – An array of four strings that the search fields will be compared to.
IN_Search_To – An array of four strings that the search fields will be compared to.
IN_Total_Sub_Items – An integer that specifies the total number of subitems that will
appear in the SmartList.
IN_Dict_List – Any array of 256 integers that contain the product IDs of the fields to
be added to the SmartList.
IN_Field_List – An array of 256 integers that contain the resource IDs of the fields to
be added to the SmartList.
384 IN T E G R AT I O N G U ID E
C H A P T E R 3 5 S M A R T LI S T P R O C E D U R E R E FE R E N C E
IN_Date_Token_From – An array of four integers that contain the starting date token.
IN_Date_Token_To – An array of four integers that contain the ending date token.
IN_GetSummary – A boolean. The value true indicates the procedure is being called
to generate a custom reminder. Records are not being added to the SmartList
window. Instead, record counts or column totals are being returned.
IO_cyColumnTotal – A currency containing the total of the column for the records
found when a column total summary is being generated for a reminder.
Explorer_Get_SQL_Field_Info
This procedure retrieves information about the table and field used for a column in
the SmartList object. The information is used in the query generated while
searching the data for the SmartList object.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field;
inout string IO_Table_Name;
inout integer IO_Table_Dict_ID;
inout integer IO_DDL_Type;
IO_Table_Name – A string that must be set by the procedure to indicate the technical
name of the table that contains the specified field.
IO_DDL_Type – An integer that must be set by the procedure to indicate the type of
list field used for the field. The value 0 indicates a 0-based list, while the value 1
indicates a 1-based list. If the field isn’t a list, specify the value 1.
Explorer_Get_SQL_Join_Info
This procedure is used for SQL-optimized SmartList objects to indicate how any
additional tables used for the object are related to the main table. The procedure
must create at least one record by calling Explorer_Set_SQL_Join_Info to be
optimized.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
inout integer Doc_Type;
IN_Field – An array of four integers containing the resource IDs of the fields that are
being searched.
386 IN T E G R AT I O N G U ID E
C H A P T E R 3 5 S M A R T LI S T P R O C E D U R E R E FE R E N C E
Explorer_Get_SQL_Override_Field_Name
This procedure is used in special cases where a field name changes, depending
upon the document types. For example, in the Inventory Work table, the field
identifying a document is called IV Document Number. In the Inventory History
table it is called Document Number. This procedure will examine the document
type and supply the correct name for the field.
Explorer_Get_SQL_Query_Fields
This procedures specifies which fields are the key fields to use for a query of a SQL-
optimized SmartList object. The procedure Explorer_Set_SQL_Query_Field is
called once for each field that is part of the key for the query.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
Explorer_Get_Table_Name
This procedure retrieves the technical name of the table that contains the field
definition used for a SmartList column.
IN_Field_ID – An integer specifying the resource ID of the field for which the table
name is being retrieved.
Explorer_Get_User_Defined_Prompt
This procedure is called when the columns for a SmartList object have been created
with the user-defined flag set to true. The procedure must look up the name to use
for the column.
OUT_Display_Name – A string that must be set by the procedure to the name to use
for the column.
388 IN T E G R AT I O N G U ID E
C H A P T E R 3 5 S M A R T LI S T P R O C E D U R E R E FE R E N C E
IN_Field_ID – An integer specifying the resource ID of the field for which a user-
defined prompt is being used.
Explorer_GoTo_Button
This procedure processes the Go To actions that were added to a SmartList object.
IN_ListView – A reference passed into the procedure that allows access to the List
View field in the SmartList window. This field must be accessed to determine the
current selection.
Explorer_Optimize_For_SQL
This procedure indicates whether a specific SmartList object has been optimized for
SQL Server. The procedure will be called multiple times, once for each field the user
includes in the SmartList search.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field;
inout boolean IO_Optimize;
IO_Optimize – A boolean that must be set by the procedure to specify whether the
SmartList object or additional columns are optimized for SQL Server. The value true
indicates the object is optimized, while false indicates it is not.
Explorer_Process_SQL_Data
This procedure is called when a SmartList object optimized for SQL Server is used,
and search criteria have been specified. The SmartList will generate a SQL results
set that contains the key values for the records to be displayed. This results set is
passed into this procedure where it can be used to display the appropriate records.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Total_SubItems;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in long IN_Record_Count;
inout long SQL_Context;
IN_Dict_List– An array of 256 integers containing the product IDs for the fields that
are to be displayed as columns in the SmartList.
IN_Field_List – An array of 256 integers containing the resource IDs for the fields
that are to be displayed as columns in the SmartList.
SQL_Context – A long integer containing a reference to the SQL results set that
contains the key values for the items to be displayed.
390 IN T E G R AT I O N G U ID E
PART 8: APPLICATION SERVICES
Part 8: Application Services
Several services are available within Microsoft Dynamics GP that your integrating
application can use. The following items are discussed:
• Chapter 36, “Security,” describes how to use the security features in Microsoft
Dynamics GP.
• Chapter 37, “Home Pages,” explains how to integrate with Home Pages dis-
played in Microsoft Dynamics GP.
• Chapter 38, “Setup Checklist,” describes how to integrate setup windows with
the Setup Checklist.
• Chapter 39, “Online Help,” explains how to implement online help for your
integrating application.
392 IN T E G R AT I O N G U ID E
Chapter 36: Security
Security in the Microsoft Dynamics GP application is controlled at several levels.
Your integration with Microsoft Dynamics GP should use the security features
provided to ensure that the application remains secure. Information about security
is divided into the following sections:
You should consider creating new tasks that provide access to the resources needed
to complete the actions provided by your integrating application. For instance, the
sample integrating application creates a task that controls access to lead
management functionality.
You may also want to create additional roles that include the tasks you’ve defined,
making it easy for the Microsoft Dynamics GP system administrator to grant access
to your integration. Your integrating application should not assign roles to specific
users. That should be done only by the system administrator.
In the trigger processing procedure, the security tasks, security task operations, and
security roles for the integrating application are created.
The reports available in the various security setup windows in Microsoft Dynamics GP are a
good way to verify that the security data for your integrating application has been installed
correctly.
Security tasks
Security tasks are groups of operations that users can perform in Microsoft
Dynamics GP. Microsoft Dynamics GP contains numerous predefined tasks. One
task in Microsoft Dynamics GP has special significance. The DEFAULTUSER task
contains all of the operations that every user of the system can perform. If you have
resources in your integration that every user should be able to access, you will add
them to the DEFAULTUSER task.
Task ID This value uniquely identifies the security task. When creating new
security tasks, be sure to follow the naming convention used for the predefined
tasks in Microsoft Dynamics GP. The task names use the following convention:
Type_Module_Sequence
The Type indicates the type of task. Typically, it will be ADMIN, CARD, INQ, RPT,
or TRX. The Module indicates the module or application for which the task is
defined. The Sequence is a numeric value that differentiates similar tasks.
Task Name This is the name that is displayed for the task. It should be
descriptive, indicates what sort of tasks it is providing access to.
Task Description The description provides additional detail about exactly what
resources the security task provides access to.
394 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
taskID = "CARD_IGSAMPLE_01";
status = CreateSecurityTask(taskID, {ID}
"Maintain leads", {Name}
"Maintain lead information and setup.", {Description}
CATEGORY_SALES of form sySecurityRoleEntry)
of form sySecurityTask;
You can use the Exists() -- Security Task function to find out whether a task has been
defined.
Task ID This is the ID of the security task to which an operation is being added.
You can add operations to your own tasks, or to existing Microsoft Dynamics GP
tasks.
Product ID This specifies the dictionary that contains the resource for which a
security operation is being added.
Resource type This indicates the type of resource for which a security operation
is being added. The value corresponds to one of the following constants:
Contant Value
TABLETYPE 1
FORMTYPE 2
REPORTTYPE 23
SECURITYTYPE_LISTS 900
SECURITYTYPE_SMARTLISTOBJECT 1000
Security ID The security ID is a long integer value that identifies the specific
resource for which a security operation is being added. The following table lists the
security resource types and the corrensponding security ID values:
To build the security ID for a list, use the BuildDictSpecificID() function. The
following constants are defined for the portions of the list for which security can be
controlled:
Constant Description
LISTSECURITYTYPE_LIST The base list
LISTSECURITYTYPE_PREVPANE The information pane for the list
LISTSECURITYTYPE_CUSTOMIZE The customization capability for the list
Use one of these constants as the product ID (first parameter) for the
BuildDictSpecificID() function. Use the unique integer identifier you assigned to
the list as the action (second parameter).
taskID = "CARD_IGSAMPLE_01";
{Leads report}
status = AddSecurityTaskOperation(taskID,
IG_PROD_ID,
REPORTTYPE,
resourceid(report IG_Leads))
of form sySecurityTaskOperations;
396 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
{Leads SmartList}
status = AddSecurityTaskOperation(taskID,
SMARTLIST,
1000, {Use constant SECURITYTYPE_SMARTLISTOBJECT in GP 10 SP1 and later}
BuildDictSpecificID(IG_PROD_ID, SMARTLIST_OBJECTTYPE_LEADS))
of form sySecurityTaskOperations;
You can use the Exists() -- Security Task Operation function to find out whether a
security operation has already been added to a security task.
Security roles
Each user in Microsoft Dynamics GP is assigned to one or more security roles. Each
security role contains a set of security operations that can be accessed by users in
that role.
Role ID This value uniquely identifies the security role. The role ID should be in
uppercase.
Role Name This is the name that is displayed for the security role. It should be
descriptive, indicating what sort of tasks it is providing access to.
Role Description The description provides additional detail about exactly what
resources the security role provides access to.
You can use the Exists() -- Security Role function to find out whether a security role has
already been created.
You can use the Exists() -- Security Task Role function to find out whether a security task
has already been added to a security role.
Microsoft Dynamics GP provides the Security() function that you can use to check
the security access for a form, report, or table. The following example shows how
this function is used to find whether the current user has access to the
IG_Contact_History form.
local integer dict_ID = 3333;
local integer result;
398 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
To exclude a form from the security check, set the Title property of the main
window for the form to the value ~internal~. Use this for forms that must be
opened, but won’t display windows, such as command forms.
To exclude any type of resource (including forms) from security checks, register a
function trigger for the ExcludeFromSecurity() function of the sySecurityTaskEntry
form. This function is called each time a resource is accessed, allowing the script to
determine whether the resource should be excluded from security. The following
example shows the trigger registration for this function:
local integer l_result;
The following is the trigger processing function that excludes items from security
checks for the sample integrating application. If the specific resource indicated by
the parameters passed to the function should be excluded from security checks, the
procedure sets the return value of the function to true. Notice that the function first
checks the return value passed into the function. If it has the value true, other code
has (such as core Dynamics GP code) has determined that the item should be
excluded from security checks. Thus, no action needs to be performed by this
function.
in integer dict_ID;
in long security_ID;
in integer security_restype;
{If the resource has already been excluded, then don't do further processing.}
if exclude = false then
{Is it our resource to check?}
if dict_ID = IG_PROD_ID then
{Is it an item to exclude?}
if security_restype = FORMTYPE then
if security_ID = resourceid(form IG_Lead_Inquiry) then
exclude = true;
end if;
end if;
end if;
end if;
We recommend using this function to remove security data, rather than removing the items
directly from the tables that store the security data.
The following is the trigger processing procedure that adds a new security resource
type to the list of types in the Security Task Setup window. Notice how the ID for
the security resource type is saved as the data value for the list item.
400 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
When specifying the value for the security item type, be sure to use values other than those
defined by the core Dynamics GP product. Values below 100 are reserved for Dynamics GP.
in integer dict_ID;
The following is the trigger processing procedure that adds the series items for the
new security resource type. Notice how the ID for each series is saved as the data
value for the list item.
in integer dict_ID;
in long security_type;
{Set the security resource type use by the core Dynamics GP code}
Restype of window syTaskEntry of form sySecurityTaskEntry = 100;
end if;
end if;
end if;
The following is the trigger processing procedure that adds the items for the new
security resource type that are in the selected series. It must set up the database
infrastructure for the Security Task Entry window. For each item, the procedure
does the following:
• It call the Get() function to retrieve the status of that task, which indicates
whether the task had previously been marked and saved by the user.
• Based on the status, the LoadListView procedure to add the task to the list in
the appropriate state.
in integer dict_ID;
in integer security_type;
in integer security_series;
if security_series = 1 then
{Look up the security status of each item as it is added, so
that the marked or unmarked state can be set}
402 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
if security_series = 2 then
{Series 2 Item 1 -- ID is 201}
call SetIndex of form sySecurityTaskOperations,
TaskOperationsState,
'Security Task ID' of window syTaskEntry of form
➥ sySecurityTaskEntry,
IG_PROD_ID,
201,
security_type;
To retrieve the security type name, register a procedure trigger for the
GetResourceTypeforTaskSetupReport() global function. The following example
shows the registration for the function trigger that retrieves the type for a security
task.
l_result = Trigger_RegisterFunction(function
➥ GetResourceTypeforTaskSetupReport, TRIGGER_AFTER_ORIGINAL, function
➥ IG_Security_GetType);
if l_result <> SY_NOERR then
warning "Function trigger registration for retrieving task type failed.";
end if;
The following is the trigger processing procedure that retrieves the name for a
security resource type.
function returns string sType;
404 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
To retrieve the series name for a security task, register a procedure trigger for the
GetResourceSeriesforTaskSetupReport() global function. The following example
shows the registration for the function trigger that retrieves the series for a task.
l_result = Trigger_RegisterFunction(function
➥ GetResourceSeriesforTaskSetupReport, TRIGGER_AFTER_ORIGINAL, function
➥ IG_Security_GetSeries);
if l_result <> SY_NOERR then
warning "Trigger registration for retrieving task series failed.";
end if;
The following is the trigger processing procedure that retrieves the series name for a
security task.
function returns string sSeries;
To retrieve the name for an operation, register a procedure trigger for the
GetResourceNameforTaskSetupReport() global function. The following example
shows the registration for the function trigger that retrieves the name for a security
operation.
l_result = Trigger_RegisterFunction(function
➥ GetResourceNameforTaskSetupReport, TRIGGER_AFTER_ORIGINAL, function
➥ IG_Security_GetOperationName);
if l_result <> SY_NOERR then
warning "Trigger registration for retrieving operation name failed.";
end if;
The following is the trigger processing procedure that retrieves the name for a
security operation.
function returns string sName;
System password
Access to certain system-level actions in controlled through the use of the system
password, which was defined when Microsoft Dynamics GP was installed. When a
user tries to access one of these restricted actions, a password dialog is displayed,
prompting them for the system password. The user must supply the appropriate
system password to continue.
The following example is the form pre script for the IG_Sample_Setup form. It uses
the GetValidSystemPassword() function to restrict access to the setup window for
the sample integrating application.
result = GetValidSystemPassword();
406 IN T E G R AT I O N G U ID E
C H A P T E R 3 6 S EC U R IT Y
Database security
Microsoft Dynamics GP uses security features provided by SQL Server to help
maintain security of data in the accounting system. Each user added to Microsoft
Dynamics GP is also a SQL user. To maintain security, it’s important to grant only
the SQL access privileges that are necessary for specific user to perform tasks in the
accounting system.
You might also choose to use the syUserInRole() function to determine what SQL
Server privileges the current user has. If the user is in a SQL Server role that has the
necessary privileges to perform the SQL task, such as creating tables, you can allow
the operation to proceed. Otherwise, your application should prevent the user from
accessing the functionality, or display an appropriate error message indicating the
lack of privileges.
You can make content for your integration available for use on Home Pages. You
can also add items to the template Home Page for each role in Microsoft Dynamics
GP. When a user chooses that role, your items will be included on the initial Home
Page constructed for them.
• Roles
• Adding additional roles
• Adding to Home Page templates
• Adding Quick Links
• Adding reports
• Metric overview
• SSRS metrics
• OWC metrics
• Creating OWC metrics
• Writing an OWC metric procedure
• Making OWC metrics available
• OWC Metric chart reference
Roles
Several roles have been defined in Microsoft Dynamics GP. Each user selects a role
that best describes the tasks they perform in the system. The initial content
displayed on the user’s Home Page is based on the role they selected. The following
table lists the roles defined and the corresponding constant used to refer to the role.
You will use these constants when adding Home Page items for your integration.
Role Constant
Accounting Manager ROLE_ACCOUNTINGMGR
Accounts Payable ROLE_ACCOUNTPAYABLES
Accounts Receivable ROLE_ACCOUNTRECV
Bookkeeper ROLE_BOOKKEEPER
Certified Accountant ROLE_CERTACCOUNTANT
Collections Manager ROLE_COLLECTIONSMGR
Customer Service Rep ROLE_CUSTSVCREP
Dispatcher ROLE_DISPATCHER
Human Resources ROLE_HR
IT Operations Manager ROLE_ITOPSMGR
Materials Manager ROLE_MATERIALSMGR
None ROLE_NONE
Operations Manager ROLE_OPSMGR
Order Processor ROLE_ORDERPROCESSOR
Payroll ROLE_PAYROLL
Role Constant
Production Manager ROLE_PRODMGR
Production Planner ROLE_PRODPLANNER
Purchasing Agent ROLE_PURCHAGENT
Purchasing Manager ROLE_PURCHMGR
Shipping and Receiving ROLE_SHIPPINGRECVING
Shop Supervisor ROLE_SHOPSUPERVISOR
Warehouse Manager ROLE_WAREHOUSEMGR
in long iIndustry;
410 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
The industry the user selected will be passed as a parameter for the trigger
processing procedure. The value will correspond to one of the following constants:
Industry Constant
Education INDUSTRY_EDUCATION
Finacial Services INDUSTRY_FINANCIALSERVICES
Government INDUSTRY_GOVERNMENT
Healthcare INDUSTRY_HEALTHCARE
Manufacturing INDUSTRY_MANUFACTURING
Media & Entertainment INDUSTRY_MEDIAENTERTAINMENT
Non Profit INDUSTRY_NONPROFIT
Other INDUSTRY_OTHER
Retail INDUSTRY_RETAIL
Services INDUSTRY_SERVICES
Telecommunications INDUSTRY_TELECOM
Transportation & Logistics INDUSTRY_TRANSPORTATION
Utilities INDUSTRY_UTILITIES
Wholesale & Distribution INDUSTRY_WHOLESALE
When specifying the integer value that indentifies a new role, use the following
guidelines:
• The value you pick must not conflict with other integrating applications, so try
to pick a value that is unique for your integration. For instance, consider using
the product ID for your integrating application.
The sample integrating application uses its product ID 3333 to identify the role it adds to
Microsoft Dynamics GP.
The process of building a Home Page requires using several procedures and
functions defined on the Home Page forms for Microsoft Dynamics GP. These are
described in << Ref goes here>>. Refer to the example for the Create() function to
see the IG_HomePage_BuildHomePage trigger processing procedure. for the
sample integrating application. This procedure builds the Home Page when the
user has chosen the “Lead Generation” role.
The trigger processing precedure that runs in response to this trigger will add the
new role to the list of roles the user can select from when sharing a list view. The
following example is the IG_Lists_AddRole trigger processing procedure that adds
a new role to this list.
local long nItemIndex;
• Quick Links
• Reports
• Metrics
When a user chooses that role, any items you add to the template will be included
on that user’s initial Home Page.
Users who have already chosen a role before your integration was installed will have to
manually add items to their Home Page.
412 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
The following is a portion of the Startup script for the sample integrating
application. It registers two procedure triggers that will add Home Page items to the
templates for the Customer Service Rep and Operations Manager roles.
The trigger processing procedures will actually add the items to the Home Page
template for the specific role. The trigger processing procedure to add Quick Links
and metrics must have the following parameters:
in integer iIndustry;
in integer iUserRole;
The trigger processing procedure to add report items must have the following
parameter:
in integer iUserRole;
The commands that you will use to add the various types of items are described in the
following sections.
Refer to Part 11, Script The AddQuickLink procedure of the syHomePageQuickLinks form is used to add
Reference, for a quick links to a Home Page template. You will use this command in the trigger
complete description processing procedure that adds Home Page items for your integration.
of the procedure.
The following example is a portion of the IG_HomePage_SetupRoles trigger
processing procedure that runs when a new Home Page is created for a user. The
AddQuickLink procedure is called to add a link that opens the Lead Maintenance
window in the sample.
in integer iIndustry;
in integer iUserRole;
414 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
Adding reports
The My Reports section on a Home Page allows users to easily access any reports
they have added to their “My Reports” list. Any reports in your application that
you have added to the Report List will be available for users to add to their Home
Page. Refer to Chapter 31, “Report Lists,” for information about adding to the
Report List.
It’s possible to add reports to the Home Page template for a role, but we suggest
that you limit the number of reports that you add. The “My Reports” list is designed
to be customized by the user, and shouldn’t be filled with reports that the user
won’t access regularly.
If you do add reports to the Home Page template for a role, adding simple reports
without report options may be the best choice. Reports that have report options
may not be defined at the time the reports are added to the Home Page template.
Refer to Part 11, Script The AddMyReport() function is used to add reports to a Home Page template. The
Reference, for a following example is the IG_HomePage_SetupReports trigger processing procedure
complete description for the sample integrating application. This script runs in response to the user
of this function. choosing to add reports for the Customer Service or Operations Manger role. It
adds the Leads simple report to the user’s My Reports list.
in integer iUserRole;
Metric overview
Metrics provide a graphical view of key data that is relevant to a specific role. Two
technologies are used to display metrics:
In a default installation of Microsoft Dynamics GP, the OWC metrics are displayed
on the home page. If SQL Server Reporting Services are deployed for Microsoft
Dynamics GP, then SSRS reports are used for the metrics.
Beginning with Microsoft Dynamics GP 2010 R2, the ability to configure which type of
metric you use has changed. After you deploy SSRS reports for Microsoft Dynamics GP, you
must use SSRS reports for the metrics on the home page.
SSRS metrics
The SSRS metrics are based on Microsoft SQL Server Reporting Services (SSRS)
reports that you create using tools like SQL Server Business Development Studio.
The user can select which SSRS reports they want to display as metrics in Microsoft
Dynamics GP.
Size
The space available for the metric on the home page is limited. Be sure that your
metric can fit within the area, and still be readable.
Location
When you deploy your SSRS reports to the Report Server, be sure that they are
placed in the correct location so that they can be found. The SSRS report must be
deployed to this location:
Replace company and series with the company database name and the series name.
For example, if you were deploying sales-related reports for the sample company,
you would deploy reports to this location:
OWC metrics
The chart control available with the Office Web Components (OWC) is used to
display the OWC metric data. Information displayed by the metric typically comes
from SQL queries issued to retrieve data from the application’s tables.
Metric ID
Each metric you create for your product must have a unique integer ID. We
recommend that you create a constant for this ID. For example, the constant
METRIC_TOP5LEADS represents the unique ID for a metric in the sample
integrating application.
Metric chart
The chart for a metric has several characteristics that define how it displays data.
Each chart can have the following:
Chart type The type of chart to display. Constants for the various chart types are
available in Dexterity. Refer to OWC Metric chart reference on page 424 for a complete
list of the chart types supported.
Category label The category label is displayed at the bottom of the chart,
describing the categories of data being charted.
Value label The value label is displayed on the left side of the chart, describing
the values that are being charted.
416 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
Data series with labels Up to 10 data series can be displayed on a chart, along
with labels for each series.
Legend A chart legend that describes each series is shown when the first data
series displayed on the chart has a label provided for it.
The following illustration shows a chart for a metric. The characteristics of the chart
are indicated by the labels applied.
Metric procedure
A separate procedure is used to retrieve the data used to generate the metric.
Typically, pass-through SQL is used to retrieve the data from the application’s
tables. This data is passed back to the Home Page through parameters required for
the metric procedure. You will learn more about this in Writing an OWC metric
procedure on page 421.
Displaying a metric
Each metric that a user adds to their Home Page is processed (data is retrieved)
when the Home Page is loaded or refreshed. The first metric in the user’s list of
metrics is displayed on the page. Other metrics are displayed when the user chooses
them from the list.
Adding a metric
Refer to Part 11, Script The AddMetric procedure of the syHomePageMetric form is used to add metrics to
Reference, for a a Home Page template. You will use this command in the trigger processing
complete description procedure that adds Quick Links and metrics for your integration.
of this procedure.
The following example is a portion of the IG_HomePage_SetupRoles trigger
processing procedure that runs when a new Home Page is created for a user. The
AddMetric procedure is used to add the “Top 5 Leads” metric to the Home Page.
in integer iIndustry;
in integer iUserRole;
Metric name
The name for a metric is maintained separately from the metric. You must add a
global procedure named MetricGetName that will be called each time the metric’s
name is displayed. Based on the Metric ID passed into the procedure, the
appropriate metric name should be returned. The procedure must have the
following parameters:
inout string sMetricName;
in 'Metric ID' iMetricID;
in DictID iDictID;
The following example is the MetricGetName procedure for the sample integrating
application. It returns the name of the metric defined for the sample.
Metric security
Since metrics can display sensitive data, it’s important to secure them so only
authorized users can view their content. To control access to metrics, you must add
a global procedure named MetricHasAccess to your application. Based on the
Metric ID passed in, this procedure must determine whether the current user has
access. Typically, the procedure will examine security settings for forms that access
the same data as the metric. It will return true if the user has access to those forms,
or false if they don’t. The procedure must have the following parameters:
inout boolean bAccess;
in 'Metric ID 'iMetricID;
in DictID iDictID;
418 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
prod_id = IG_PROD_ID;
Executing a metric
When a Home Page is loaded or refreshed, Microsoft Dynamics GP will execute all
of the metrics that have been added to that page. To execute the metrics you have
defined for your integration, you must add a global procedure named
MetricExecute to your application. This procedure will be called, and the ID of the
metric to execute will be passed in. The procedure must gather the data required for
the metric and return it through the following set of required parameters:
The MetricExecute procedure will call the appropriate procedure specific to the
metric to be run. This metric-specific procedure will gather the data for the metric
and return it to the MetricExecute procedure through the inout parameters.
For example, the following is the MetricExecute global procedure for the sample
integrating application. The Microsoft Dynamics GP application will call the
MetricExecute procedure, requesting that the “Top 5 Leads” metric be processed. In
turn, the MetricExecute procedure calls the Metric_Top5Leads procedure which
actually assembles the data for the metric and passes it back to MetricExecute. (You
will learn more about this procedure in Writing an OWC metric procedure on
page 421.)
420 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
Notice that only the parameters used for the metric must be passed to the metric procedure.
For instance, since only one series is plotted by the “Top 5 Leads” metric, only one series
data array is passed.
• Querying capabilities of SQL Server are useful for metrics, such as “order by”
and “top” clauses.
Tools like Query Analyzer provided with SQL Server can be used to refine the query before
using it in the sanScript procedure. This will save time as you develop your metrics.
Guidelines
When writing your metric procedure, consider the following guidelines:
• Make any SQL query you use as efficient as possible. The metric will be run
each time the Home Page is loaded or refreshed, so a slow query will make the
application less responsive.
• Always close any pass-through SQL connections you open to avoid wasting
system resources. Consider using the SQL_GetConnection() function of the
XSQLExec form in Microsoft Dynamics GP to retrieve and use the pass-through
SQL connection already maintained by the Microsoft Dynamics GP application.
Example
The following example is the metric procedure for the “Top 5 Leads” metric in the
sample integrating application. The global procedure is named Metric_Top5Leads.
It is called by the MetricExecute global procedure, uses pass-through SQL to
assemble the data for the metric, and returns the data through the inout parameters
for the procedure.
inout integer iNumCategories;
inout integer iNumSeries;
inout string sChartType;
inout string sCategoryAxis;
inout string sValueAxis;
inout string sCategories[12];
inout currency iSeries1Values[12];
{Chart Information}
sChartType = CHART_TYPE_COLUMNCLUSTERED;
sCategoryAxis = "Leads";
sValueAxis = "Potential Revenue";
iNumSeries = 1;
iNumCategories = 5;
422 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
index = index + 1;
SQL_status = SQL_FetchNext(SQL_connection);
end while;
The trigger processing procedure that runs in response to trigger must do the
following:
• Check the security access for each of your metrics you want to add to the list.
You can use the MetricHasAccess procedure that you have already added to
your application.
• If the user has access, the metric’s name must be retrieved. You can use the
MetricGetName procedure that you already added to your application.
• Verify that the metric hasn’t already been added to the list. If it hasn’t, the
metric can be added.
The following is the trigger processing procedure that makes the “Top 5 Leads”
metric available in the Metric Details window. The metric list uses the list view
control, so ListView functions are used to add the item. Notice how two additional
subitems are added to the list view to keep track of the product ID and metric ID.
{ Top 5 Leads }
call MetricHasAccess, bAccess, METRIC_TOP5LEADS, IG_PROD_ID;
if bAccess then
call MetricGetName, sName, METRIC_TOP5LEADS, IG_PROD_ID;
if empty(sName)= false then
if not ExistsforMetricID('User ID' of globals,
➥ METRIC_TOP5LEADS, IG_PROD_ID) of form syHomePageMetric then
nItemIndex = ListView_ItemAdd('(L) AvailableMetrics' of
➥ window MetricCustomize of form syHomePageMain, sName, 0);
ListView_ItemSetIntSubitem('(L) AvailableMetrics' of
➥ window MetricCustomize of form syHomePageMain,
➥ nItemIndex, COL_DICTID of form syHomePageMain, IG_PROD_ID);
ListView_ItemSetIntSubitem('(L) AvailableMetrics' of
➥ window MetricCustomize of form syHomePageMain,
➥ nItemIndex, COL_METRICID of form syHomePageMain,
➥ METRIC_TOP5LEADS);
end if;
end if;
end if;
424 IN T E G R AT I O N G U ID E
C H A P T E R 3 7 H O M E P AG E S
Information about integrating with Setup Checklist is divided into the following
sections:
The Setup Checklist provides a single location to access the setup tasks in Microsoft
Dynamics GP. Setup for a large application like Microsoft Dynamics GP can be an
involved process, so the Setup Checklist window provides features to assign setup
tasks to specific users and track the setup progress. A special HTML Help pane
displays online help information for each setup task as it is completed.
By integrating with the Setup Checklist, the setup for your application can utilize
these features.
An integrating application can add both types of items. The categories in the Setup
Checklist correspond to command lists in the application. The individual items
correspond to commands in the application that are used to open setup windows.
The items in each category should be listed in the suggested order that the setup
tasks be performed.
Each node in the Setup Checklist tree is uniquely identified by the following:
Dictionary ID This is the ID of the dictionary that contains the command used
for the category or item.
Command Form ID This is the resource ID of the form that contains the
command used for the category or item.
Command ID This is the resource ID of the command used for the category or
item.
Top-level node
The constant SETUPCHECKLIST_TOPLEVEL is used to specify the dictionary ID,
command form ID, and command ID of the top-level node in the Setup Checklist
tree. This node isn’t visible in the tree. You will use this constant when adding items
that appear in the first level of the tree.
First-level nodes
The core set of first-level nodes displayed in the Setup Checklist tree use the same
command list definitions as the Setup submenu that appears in the Tools menu.
428 IN T E G R AT I O N G U ID E
C H A P T E R 3 8 S ET U P C HE C K L IS T
This is a list of the first-level nodes added by the core Microsoft Dynamics GP application.
Other integrating products may have added first-level nodes to the Setup Checklist tree.
Creating commands
Create a command or command list for each item or category you want to add to
the Setup Checklist. If you already created commands that you added to the Setup
menu, you can re-use those same commands for the Setup Checklist.
The following is the trigger processing procedure that adds Setup Checklist items
for the sample integrating application. Notice how a range is set up to determine
whether Setup Checklist items have been added previously. If they haven’t, items
are added. The FindSetupChecklistItem() function is used to locate the
“Customer” item in the Sales category of the tree. The item is added in the position
following the Customer item.
{Examine whether the Setup Checklist items have already been added}
range clear table sySetupChecklistMstr;
range table sySetupChecklistMstr where physicalname(CmdDictID of table
➥ sySetupChecklistMstr) + "=" + str(IG_PROD_ID);
get first table sySetupChecklistMstr;
430 IN T E G R AT I O N G U ID E
C H A P T E R 3 8 S ET U P C HE C K L IS T
Topic to display
Your code indicates the topic to display by supplying the AddSetupChecklistItem()
function with the complete HTML filename of the topic. Be sure that the name
includes the .htm extension. For example, the topic to display for the Contact
History setup item is “ContactHistorySetup.htm”.
You can’t use a help context number to specify the topic to display, because the specific
HTML Help API being used for the Setup Checklist doesn’t support it.
Topic guidelines
Be aware that the docked HTML Help pane used for the Setup Guide is narrow. Try
to design the help topics to work well in this narrow pane that has limited space.
• Don’t use unnecessary text andkeep the topic as short as possible. Long topics
require scroll bars to be displayed, taking up more screen space.
• Avoid HTML items that cause a lot of horizontal scrolling, such as wide tables
or graphics.
432 IN T E G R AT I O N G U ID E
Chapter 39: Online Help
Before implementing Microsoft Dynamics GP uses Microsoft HTML Help to display information online.
help for an integrating How you implement help for integrating applications is very similar to how you
application, be sure to implement help for stand-alone Dexterity applications. Therefore, this information
review Dexterity’s will focus primarily on issues that are specific to third-party applications that
online help capabilities integrate with Microsoft Dynamics GP. It includes the following information:
described in Chapter 8,
“HTML Help,” in the • Third-party help responsibilities
Stand-Alone • Using the Microsoft Dynamics GP help model
Application Guide. • Implementing a help system
• Writing a help processing procedure
• Registering the help processing procedure
• Help button
• Creating help source files
• Help issues for integrating applications
The information provided also assumes that you’ll support online help in a manner
similar to Microsoft Dynamics GP. This includes providing window-level context-
sensitivity, and implementing a similar appearance.
Alternate windows
If you distribute alternate windows in your application, the Microsoft Dynamics GP
help system will continue to provide help for the window and all fields originally
displayed in the window. However, your application’s help system will be
responsible for providing field help for all global and local third-party fields you’ve
added.
Third-party windows
Your application’s help system is responsible for displaying help topics for your
windows. This includes any third-party fields added to the window, and any
Microsoft Dynamics GP fields added to the window.
Due to limitations in determining the active application, we recommend that you don’t
implement help for alert message dialogs that are generated from procedure or function
scripts.
To see this model, examine the Develop.chm sample help file included with
Dexterity. For detailed information about the help model, examine the
DevelopHelpSample.zip archive. This archive contains the source files used to
create the sample help file. You can use these source files in the help file for your
application to reproduce the look and feel of the Microsoft Dynamics GP help.
Pay special attention to the GP.css file, which is the cascading style sheet used to
format the information displayed in the help file. This is the same style sheet used to
format Microsoft Dynamics GP help. You can use this cascading style sheet directly
in your help file. You may also choose to create your own style sheet based on the
styles defined in the GP.css style sheet.
434 IN T E G R AT I O N G U ID E
C H A P T E R 3 9 O N L I N E H E L P
The runtime engine automatically calls the appropriate help processing procedure,
depending on whether the user chooses a third-party or main application item:
The following script is the help processing procedure for the sample integrating
application:
{--------------------------------------------------------------
Script name: IG_Help_Processing
Description: Processes online help for the sample application.
--------------------------------------------------------------}
local integer help_type, result;
local long context_number;
local string help_path_and_file;
case help_type
in [HELP_TYPE_WHATS_THIS_MODE, HELP_TYPE_HELP_KEY,
➥ HELP_TYPE_WHATS_THIS_WIN]
{Get the context number for the current window.}
context_number = WinHelp_GetWindowContextNumber();
{Call the help engine, displaying the help for the window.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTEXT, context_number);
in [HELP_TYPE_DIALOG_HELP]
{Process the help for modal dialogs.}
{Get the context number for the item chosen.}
context_number = WinHelp_GetFieldContextNumber();
{Call the help engine, displaying help for the modal dialog.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTEXT, context_number);
in [HELP_TYPE_CONTENTS]
{Invoke the Contents topic.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTENTS, 0);
in [HELP_TYPE_SEARCH]
{Invoke the search engine.}
result = WinHelp_Search(help_path_and_file, "");
else
{Invoke the Contents topic.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTENTS, 0);
end case;
The following is part of the Startup procedure for the sample integrating
application:
Help button
Most windows in Microsoft Dynamics GP contain a Help button that appears in the
lower-right or lower-left corner of the window. Clicking this button performs the
same action as choosing About This Window from the Help menu.
If you provide online help for a window, be sure the window has a visible Help
button. This provides a visual cue for the user, indicating that help is available. To
add a help button, complete the following procedure:
436 IN T E G R AT I O N G U ID E
C H A P T E R 3 9 O N L I N E H E L P
TabStop False
Tooltip Help About This Window (F1)
Appearance 3D Highlight
BackColor System - Button Face
Border True
Style Graphic Only
result=Menu_Invoke(MENU_ACTION_HELPWINDOW);
File Description
Help project file (.HHP) Contains information about how the help compiler generates the
help file. You may want to use the sample help project included in
the DevelopHelpSample.zip archive.
Contents file (.HHC) Contains the table of contents for the help file. This can be created
with the HTML Help Workshop, or with your help authoring
software.
Keyword file (.HHK) Contains the list of keywords for the help file. This can be created
with the HTML Help Workshop, or with your help authoring
software.
HTML content files (.HTM) Contains the help information, in HTML format. These are created
with your help authoring software.
Map file (.h) Contains a list of the context numbers and their corresponding help
alias entries. We recommend that you use the CHAMP tool included
with Dexterity to generate a map file for your integrating
application.
Alias file (.h) Contains a list of the values in the map file, and the corresponding
.htm file that contains the context-sensitive help information.
Cascading style sheet Describes the formatting that is applied to the .htm files displayed in
(.css) the compiled help file. We recommend that you use the GP.css style
sheet included in the DevelopHelpSample.zip archive.
Graphics files such as .GIFs are also typically part of a help file. You’ll create these graphics
files separately and reference them in the .htm files.
We recommend that you use CHAMP, the Context-sensitive Help Assistant and
Map Program, to create the map file for your integrating application. CHAMP is
included in the Samples directory that is installed with Dexterity. Refer to the
documentation included with CHAMP for more information about using this tool.
Context-sensitivity
We recommend that you implement window-level context-sensitivity for your
integrating applications. Because of the large number of fields typically found in
Dexterity-based applications, field-level context-sensitivity quickly becomes
difficult to manage.
Alternate windows
Dexterity does not support context-sensitive help for a Microsoft Dynamics GP
global field you add to a Microsoft Dynamics GP window. We recommend that you
add a new local field to the Microsoft Dynamics GP window instead of adding a
Microsoft Dynamics GP global field.
To avoid context ID conflicts in the situations listed above, set the UseUniqueHelp
property to True for all Microsoft Dynamics GP fields you use in your window.
Then be sure you set the UseUniqueHelp property to False for all of your fields.
438 IN T E G R AT I O N G U ID E
Chapter 40: Unified Communications
If either Microsoft Office Communicator or Microsoft Lync is running on the same
system as Microsoft Dynamics GP, the Microsoft Dynamics GP client can integrate
with some of the Unified Communications capabilities provided by Communicator
or Lync. Microsoft Dynamics GP can display presence information for specific
entities such as customers or vendors. Actions can be added to Communicator or
Lync to allow tasks to be performed within Microsoft Dynamics GP. Information
about integrating with Unified Communications is divided into the following
sections:
• Presence overview
• Adding presence support to a window
• Adding actions to Communicator or Lync
Presence overview
In Microsoft Dynamics GP, presence is supported for the following entities:
• Customer
• Vendor
• Employee
• Salesperson
Each of these entities can have a SIP (Session Initiation Protocol) address that is
used to allow multimedia connections over Internet Protocol. The SIP address is
specified in the Messenger Address field of the Internet Information window in
Microsoft Dynamics GP. When Microsoft Office Communicator or Microsoft Lync is
running on the same system an Microsoft Dynamics GP, the SIP address is used to
retrieve presence information for the entity.
If your integration displays fields for which presence is supported, you can display
the presence indicator for those fields. You can also add presence support for your
own fields.
Adding fields
To add the fields needed for presence support, complete the following steps:
Editable False
BackColor Yellow
Visible False
Editable False
BackColor Yellow
Visible False
SetChangeFlag False
TabStop False
Appearance 2D Border
Border False
Size-Height 18
Size-Width 18
Style TextOnly
440 IN T E G R AT I O N G U ID E
C H A P T E R 4 0 U N I F I E D C O M M U N I C A T I O N S
Attaching scripts
To add the scripts needed for presence support, complete the following steps:
• The field is set to -1 and the change script is run. In this case, all of the
presence triggers are unregistered.
• The field is set to the index of the presence indicator for a specific field and
the change script is run. In these cases, the presence trigger for only that
specific presence trigger is unregistered.
If the name of the form or window contains spaces, be sure to enclose the name in single
quotes. Otherwise, the presence fields cannot be accessed.
The following example shows this script for the Lead_Inquiry window in the
sample integrating application.
{Specify the technical name of the form and window that contains the
fields for which presence is being tracked.}
form_name = "IG_Lead_Inquiry";
window_name = "IG_Lead_Inquiry";
case PresenceChangeEventTrigger
in [-1]
{Unregister all of the presence triggers for the window}
call Unregister of form Dummy_Presence_Form, form_name,
➥ window_name, 1, Label_Presence[1], 'Salesperson ID',
➥ CO_INETADDRS_SALESPERSON, "", IG_PROD_ID;
in [1]
{Unregister a specific presence trigger for the window}
call Unregister of form Dummy_Presence_Form, form_name,
➥ window_name, 1, Label_Presence[1], 'Salesperson ID',
➥ CO_INETADDRS_SALESPERSON, "", IG_PROD_ID;
end case;
{Specify the technical name of the form and window that contains the
fields for which presence is being tracked.}
form_name = "IG_Lead_Inquiry";
window_name = "IG_Lead_Inquiry";
{Retrieve the SIP address for the salesperson and store it in the array
element}
Label_Presence[1] = GatherSIP(CO_INETADDRS_SALESPERSON, 'Salesperson ID',
➥ "");
{Perform the action that was chosen from the button drop list}
call Activate of form Dummy_Presence_Form, "", "", 0, Label_Presence[1],
➥ convo_title, PB_Presence_Button[1], "", "", "", IG_PROD_ID;
{Clear and then register the presence fields for the window}
PresenceChangeEventTrigger = -1;
run script PresenceChangeEventTrigger;
run script Label_Presence[1];
442 IN T E G R AT I O N G U ID E
C H A P T E R 4 0 U N I F I E D C O M M U N I C A T I O N S
The following example shows the portion of code added to the browse buttons
for the Lead Maintenance form in the sample integrating application to update
the presence when a new record is displayed.
The following example shows the code that was added to the change script for
the Salesperson ID field in the Lead Maintenance window of the sample
integrating application. This code updates the presence status for the new value
when the user changes the value of the Salesperson ID field.
Defining an action
To add an action to Communicator or Lync, you must add a key containing several
values to the Windows Registry. To do this, complete the following steps:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Communicator\Session
Manager\Apps\
The name of the key is important. How this name sorts alphabetically with the other
GUID entries determines its position in the menus built by Communicator or Lync.
MainWindowRightClick;ConversationWindowContextual
Name A string that specifies the name displayed for the action.
Path A string specifying the action to perform. Typically, this will be a call to
the Dynamics GP Protocol Handler. The following is an example of a call to the
protocol handler:
dgpp://UnifiedCommunications/Dynamics?ProductID=3333&ActionType=OPEN&
FunctionName=OpenNewLead&UserSIP=%user-id%
SmallIcon A string value that indicates the path of the icon to display. If the
icon can’t be found, a default icon is displayed. Two icons are included with
Microsoft Dynamics GP for the Unified Communication integration:
• NewDocument_16x16_72.png
• ViewRecord_16x16_72.png
The Visual Studio Tools add-in that will respond to the action must reference the
Microsoft.Dynamics.GP.DrillBackWcfService assembly, found in the AddIns folder
of a Microsoft Dynamics GP installation.
In the Initialize() section of the add-in code, you will create a service instance. You
will also add an event handler to process static URI events. In the event handler,
you need to parse the query string that is passed in through the URL to determine
whether it is your action that needs to be processed. Special routines in the .NET
Framework can help you process the query string.
444 IN T E G R AT I O N G U ID E
C H A P T E R 4 0 U N I F I E D C O M M U N I C A T I O N S
The following C# code example is a Visual Studio Tools add-in that handles the
action for the sample integrating application. Note the following items in the code:
• In the event handler for the static URI, the query string from the URL is parsed
to retrieve the individual key values that were passed in.
• The key values are examined. If the product ID and operation match the
predefined values, then the operation to open the Lead Maintenance form is
run.
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Text;
using System.Web;
using Microsoft.Dexterity.Bridge;
using Microsoft.Dexterity.Applications;
using Microsoft.Dynamics.GP.ServiceIntegration.DrillBackService;
namespace SampleGPHandler
{
public class GPAddIn : IDexterityAddIn
{
// Variable for the service instance
DynamicsGPDrillBack ServiceInstance;
{
ProductId=KeyPairs.GetValues(key).GetValue(0).ToString();
}
if (key == "ActionType")
{
ActionType=KeyPairs.GetValues(key).GetValue(0).ToString();
}
else if (key == "FunctionName")
{
FunctionName=KeyPairs.GetValues(key).GetValue(0)
.ToString();
}
else if (key == "UserSIP")
{
UserSIP = KeyPairs.GetValues(key).GetValue(0).ToString();
}
}
446 IN T E G R AT I O N G U ID E
PART 9: PACKAGING YOUR APPLICATION
Part 9: Packaging Your Application
Once you’ve developed and tested your integrating application, you finish the
development process by packaging your application for delivery to customers. This
portion of the documentation explains this process. The following topics are
discussed:
• Chapter 42, “Making Installation Files,” explains the processes for writing
installation scripts, creating a chunk file, testing the installation process, and
delivering additional components.
448 IN T E G R AT I O N G U ID E
Chapter 41: Building An Application
Once you’ve completed application development, you can prepare your application
for delivery to customers. Since you cannot ship your development dictionary, you
must prepare a separate dictionary containing all resources you created in your
development dictionary, and any Microsoft Dynamics GP forms or reports you’ve
customized (alternate forms and reports).
You will build this dictionary using Dexterity Utilities. The following checklist
outlines the process of building your dictionary:
✔ Step Description
1 Extract your application using the Extract utility.
2 Transfer alternate forms and reports using Transfer Dictionary Module utility.
3 Add product information using the Product Information utility.
4 Create installation files following the instructions in Chapter 42, “Making
Installation Files.”
Information about building your application is divided into the following sections:
The extraction process does not remove any resources from your development dictionary. It
simply copies new resources to the extracted dictionary.
The following illustration shows a development dictionary and the process for
building a third-party dictionary.
Development dictionary
Aged Trial Balance report
Customers report
Main product resources Customer Class Setup form
(resource IDs < 22,000) Customer Maintenance form
Cash Receipts Entry form
Core Resources
Extracted dictionary
Extract Utility
Lead Maintenance Lead Maintenance
Third-party resources
Lead Report Lead Report
(resource IDs >= 22,000)
Third-party Core Resources Third-party Core Resources
Use the following steps to extract your application from your development
dictionary.
1. Make a backup
Before you begin the extract process, be sure to make a backup of your
development dictionary and store it in a safe location. If errors occur during the
process of building your application dictionary, restore the backup and attempt
the process again.
If you use any Microsoft Dynamics GP resources in creating your application, you
should not edit your extracted dictionary using Dexterity. The extracted dictionary
contains references to resources in Microsoft Dynamics GP; Dexterity has no provisions
for handling these references, and you could corrupt your dictionary.
The following illustration shows a development dictionary and the process for
transferring alternate forms and reports to a third-party dictionary.
Development dictionary
Aged Trial Balance report
Customers report
Alternate form
Customer Class Setup form
and report Transfer Dictionary
Customer Maintenance form
Module Utility
Extracted dictionary
Cash Receipts Entry form
Customers Report
Core Resources
Customer Maintenance form
Lead Maintenance Lead Maintenance
Lead Report Lead Report
Third-party Core Resources Third-party Core Resources
450 IN T E G R AT I O N G U ID E
C H A P T E R 4 1 B U I LD IN G A N A P PL IC A T IO N
Use the following steps to transfer alternate forms and reports to your extracted
dictionary.
Repeat this process until all the alternate forms and reports you’re delivering
appear in the Destination Dictionary Module list. Click Close when you’ve
finished transferring form and report modules.
If you do not use the Auto-Chunk utility to package your application, be sure you use
the Update Series Resources utility to update resource lists in the extracted dictionary
for transferred alternate forms and reports. Chapter 42, “Making Installation Files,”
explains how to use the Auto-Chunk utility.
Use the following steps to add product information. Open your extracted dictionary
as an editable dictionary, then choose Product Information from the Utilities menu
to open the Product Information window.
452 IN T E G R AT I O N G U ID E
C H A P T E R 4 1 B U I LD IN G A N A P PL IC A T IO N
To avoid conflicts with forms and reports dictionaries from other integrating
applications, include your product ID in the name. For example, the forms dictionary
for the sample integrating application is F3333.DIC.
• Execute installation scripts that can perform setup tasks during the installation.
2
0
Microsoft Dynamics GP
3333
Sample Integrating App.
Windows
:C:Dynamics GP/Dynamics.dic
:C:Dynamics GP/Data/Forms.dic
:C:Dynamics GP/Data/Reports.dic
:C:Dynamics GP/Develop.dic
:C:Dynamics GP/Data/F3333.DIC
:C:Dynamics GP/Data/R3333.DIC
Once you’ve modified the launch file, you can move your application dictionary to
the location you specified in the launch file, and launch Microsoft Dynamics GP.
Using macros
Many steps are involved in building your application. You will find that you repeat
these steps several times as you develop your integration. We recommend that you
use the macro capability with Dexterity Utilities, and record a macro to automate
the building process. In addition to speeding the building process, a macro helps
ensure that you don’t skip a build step, or made an incorrect selection during the
process.
454 IN T E G R AT I O N G U ID E
Chapter 42: Making Installation Files
Once you’ve developed and tested your application in the development dictionary,
then built your application using Dexterity Utilities, finish the development process
by packaging your application for delivery to customers. Information about making
installation files is divided into the following sections:
Installation Script
You indicate the installation script for your application when building a chunk
dictionary for your extracted application dictionary, using either the Auto-Chunk or
Create Chunk Dictionary utilities. When the chunk dictionary installs, or
“unchunks” in the same location as the Microsoft Dynamics GP dictionary, it
automatically runs the installation script you’ve indicated.
Installation scripts are rarely used for integrations with recent versions of Microsoft
Dynamics GP.
You write an installation script just like an ordinary procedure. However, it’s
important to keep in mind when the installation script actually runs. The
installation script is run only one time when the chunk dictionary is installed. It is
never run again.
You cannot check values of any Microsoft Dynamics GP global variables using an
installation script. Microsoft Dynamics GP sets the values of global variables after your
installation script runs.
The installation script runs before any user has logged into the system. This is as
issue for SQL Server, because a user must be logged in before any table operations
can be performed. To avoid the SQL Login window being displayed during
installation, any operations that access tables must be delayed until the user has
logged into the system. Typically this is done using a procedure trigger for the
Add_Successful_Login_Record procedure in Microsoft Dynamics GP. The
following example shows the registration for this trigger.
• It automatically updates the launch file with product information you applied
to the extracted dictionary. Without a chunk dictionary, the user must edit the
launch file manually to add product information.
• It allows you to attach an installation script, which you can use to complete any
setup or installation tasks. Refer to Writing installation scripts on page 455 for
more information.
Refer to Chapter 7, There are two methods of creating a chunk dictionary. The simplest and
“Dictionary Utilities,” recommended method is to create a single chunk dictionary using the Auto-Chunk
of the Dexterity utility. The section Using the Auto-Chunk utility on page 456 explains how to use this
Utilities manual for utility.
information about
using the Create Chunk The second method of creating a dictionary chunk uses the Create Chunk
Dictionary utility. Dictionary utility. The main advantage of this utility is that you can break up your
application into several smaller chunk dictionaries that will be merged into one
application dictionary during installation. This is especially useful if your
installation program doesn’t support file segmenting.
Due to a historical limitation imposed by early versions of Windows, the name of the
chunk dictionary must not exceed 13 characters, including the .cnk extension. If the
name exceeds 13 characters, the chunk cannot be accessed by the runtime engine and
will not be unchunked.
456 IN T E G R AT I O N G U ID E
C H A P T E R 4 2 M A K I N G I N S TA L L A T I O N F I L E S
Dictionary Enter the name of the dictionary created once the installation is
complete. For the sample integrating application, this is DEVELOP.DIC. Do not
enter the name of the Dynamics.dic dictionary.
Module This selection indicates which module the Major Version, Minor
Version and Build Number information is associated with. (These are the fields
below the Module field.) The setting in the Module field is used when the
version numbers and build number are retrieved from the dictionary.
Major Version/Minor Version Enter the major and minor version numbers
for your application. For instance, if your application is version 1.3, enter a 1 for
the major number and a 3 for the minor number. If you’d like, you can use the
same version number scheme used by Microsoft Dynamics GP. You can retrieve
these numbers from your application dictionary and display them in your
application’s About box.
The values you choose for the major version and minor version are significant.
If a Microsoft Dynamics GP installation contains a dictionary for a previous
version of your product, the dictionary chunk you are creating will unchunk
only if the major version and minor version numbers in the chunk match those
in the existing dictionary. If the version numbers don’t match, an error
indicating the issue will be written to the InstallErrors.txt file in the Microsoft
Dynamics GP installation folder. The dictionary chunk won’t be deleted.
Build Number Enter the build of the current version of the dictionary. You
can retrieve this build number and display it in your application’s About box.
If you have multiple dictionary chunks with the same major version and minor
version values, the build number is used to determine the order in which the
dictionary chunks are unchunked. The chunks with lower build number values
are unchunked first.
If an installation contains a dictionary for which the major and minor version
numbers match those of the dictionary chunk, the build number will be
examined. If the build number of the chunk is the same or greater than the build
number of the dictionary, the chunk will be unchunked. If the build number of
the chunk is lower, it will not be unchunked, and a message indicating the issue
will be written to the InstallErrors.txt file in the Microsoft Dynamics GP
installation folder. The dictionary chunk will be deleted.
Refer to the previous Starting/Ending Script These fields specify which installation scripts
section, Writing (procedures) run when the chunk dictionary unchunks. Installation scripts are
installation scripts, for procedures you write in the development dictionary that perform setup tasks
more information when your application installs with Microsoft Dynamics GP. To specify a
about installation starting or ending script, mark the corresponding check box and click the
scripts. lookup button for the starting or ending script. A list of the procedures in your
extracted application dictionary will appear. Choose the installation script.
The installation scripts run only after the chunk dictionary unchunks. The
starting script runs first, then the ending script runs. If you have a single main
installation script (similar to the IG_Install_Main installation script for the
sample integrating application), simply indicate the main installation script as
the starting script, and don’t indicate an ending script.
4. Make a backup.
Make a backup of the chunk dictionary. At this point, you should test the chunk
dictionary following the instructions in Testing the installation process on
page 458.
458 IN T E G R AT I O N G U ID E
C H A P T E R 4 2 M A K I N G I N S TA L L A T I O N F I L E S
• Be sure your application dictionary has product information before you cre-
ate chunk dictionaries.
• Verify that the version numbers and build number you applied to the dic-
tionary chunk are correct. They must follow the rules described in Using the
Auto-Chunk utility on page 456. Check the InstallErrors.txt file in the
Microsoft Dynamics GP installation folder for any errors reported during
the unchunking process.
• Before installing, be sure the launch file contains the correct information for
Microsoft Dynamics GP to launch without your integrating product.
• Be sure each chunk dictionary contains the [Core] System Core Tables and
the [Core] System Install resources.
• If you receive permission errors, be sure the dictionary chunk file isn’t
locked. Also verify that another instance Microsoft Dynamics GP isn’t
already running, accessing the dictionary being updated.
After installation, a single application dictionary will have replaced the chunk
dictionary or dictionaries. The chunk also will have updated the launch file with the
correct location of the integrating dictionary.
✔ Step Description
1 Use the detailed upgrade procedure to transfer third-party resources to the new
version of the Dynamics.dic dictionary.
2 Review Microsoft Dynamics GP changes and make any necessary changes in
your application.
3 Redo any customizations made for alternate forms and reports.
4 Test your application with the new version of Microsoft Dynamics GP.
5 Build an update chunk dictionary that you can deliver to customers.
To install the Source Code Control Server, locate the SETUP.EXE file in the
DSCCS folder included with the Dexterity installation. Run the setup. During
the installation, the control panel for the Dexterity Source Code Control Server
will be displayed. Select the provider type you are using.
• If you have chosen Visual SourceSafe as the provider, specify the location of
the SRCSAFE.INI. This tells the Dexterity Source Code Control Server
where the source code control provider is located.
• If you have chosen the Generic provider, specify the Root directory. This is
the location that will store the contents of your dictionary when it is
checked into source code control. Typically, this is a directory on the same
machine that is running the Dexterity Source Code Control Server.
Continuing the example, the Dexterity Source Code Control Server was
installed, and the Generic provider was selected. The “SCC” directory was
created, and will be used as the root directory.
• If you are using Visual SourceSafe, use the administrative tools to create a
project. You will also need to create a user and set access rights for the
project.
• If you are using the Generic provider, create a directory inside of the root
directory you specified in the previous step. This directory will store the
contents of your integrating application.
Continuing the example, a directory named “Sample” was created inside the
SCC directory.
For this procedure, we recommend that you use a copy of your development dictionary.
462 IN T E G R AT I O N G U ID E
C H A P T E R 4 3 U P DA T IN G A N A P PL IC A T IO N
User Name Enter the user name you were assigned when the source code
control provider was set up. If you are using the Generic provider, you don’t
need to supply a user name.
Password Enter the password you were assigned when the source code
control provider was set up. If you are using the Generic provider, you don’t
need to supply a password.
Project Name Enter the name of the project you want to use in the
repository. You can click the lookup button to view a list of projects available in
the repository.
Temp File Location Many temporary files are created as resources are
checked into and out of the repository. Specify the location where you want
these temporary files placed. The location you choose should have at least twice
as much disk space available as the size of the dictionary you will be storing in
the repository.
The settings used for the example are shown in the following illustration. Since
the Generic provider is being used, a user name and password are not needed.
Be sure you have marked all of the options at the bottom of the window.
To be sure you have set the source code control options correctly, click the
Validate Connection button. A dialog will be displayed, indicating whether a
connection could be established with the source code control provider.
Click Insert All to check in all of the source files for your integrating application.
Supply a check in comment. The content of the comment isn’t critical, but is
required to check in files to the repository. Typically, the comment will indicate
this is the initial check in operation.
11. Specify the location of an original dictionary for the new release.
Now that you are working with dictionary for the new release, you must
specify the location of an unmodified original dictionary for the new release of
Microsoft Dynamics GP.
Open the Options window in Dexterity and display the Source Control options.
Use the Original Dictionary lookup button to specify the location of an
unmodified Dynamics.dic dictionary for the new release.
• Update All
• Run SCC Error Report
• Run Compile Error Report - Detailed
• Use Index File
464 IN T E G R AT I O N G U ID E
C H A P T E R 4 3 U P DA T IN G A N A P PL IC A T IO N
Next, the Resources to Update window will be displayed. Be sure all of the
items are marked, and click OK. As the update operation is performed, a
progress dialog will be displayed.
• Deleted strings
• String collisions
• Deleted resources
• Resource name conflicts
Deleted strings
If your application references strings that are no longer part of the Dynamics.dic
dictionary, Dexterity will automatically add new string resources to the dictionary.
No developer intervention is required.
String collisions
If your application contains strings that now part of the Dynamics.dic dictionary, a
warning will be logged during the update operation. Dexterity will automatically
use the string resource in the Dynamics.dic dictionary. No developer intervention is
required.
Deleted resources
Your application may be referencing resources that no longer exist in the
Dynamics.dic dictionary. For example, a field you reference may no longer be
included in the dictionary. To deal with resources that have been deleted, you will
need to either use a different resource or create your own version of the resource.
Then you will have to open each resource (such as forms or reports) that use the
resource you created and replace the [Not Found] instances with an instance of the
new resource.
If you have chosen to use a new resource that can be referred to directly in scripts,
you will need to use the Search and Replace capability in Dexterity to replace all
occurrences of the previous resource name with the new resource name. Be sure to
compile all scripts after the search and replace operation.
There are special considerations to keep in mind when changing the names of resources
in dictionaries that are stored under source code control. Refer to Renaming resources
on page 462 of Volume 1 of the Dexterity Programmer’s Guide for complete information
about renaming resources.
466 IN T E G R AT I O N G U ID E
C H A P T E R 4 3 U P DA T IN G A N A P PL IC A T IO N
• Update All
• Run SCC Error Report
• Run Compile Error Report - Detailed
• Use Index File
• Update All
• Run SCC Error Report
• Run Compile Error Report - Detailed
• Use Index File
Next, the Resources to Update window will be displayed. Be sure all of the
items are marked, and click OK. As the update operation is performed, a
progress dialog will be displayed.
Because the resource with the name conflict wasn’t included in the Index File,
you shouldn’t receive any errors when performing the update operation.
4. Lock the source file containing the resource that caused the name
conflict.
In Dexterity, lock the source file containing the resource that caused the name
conflict. For instance, if a field resource caused the name conflict, lock the
source file that contains all of the fields.
5. Check in the source file containing the resource that caused the
name conflict.
In Dexterity, check in the source file that you locked in the previous step. This
creates a revision of the source file that will not contain the resource that caused
the conflict.
• Update All
• Run SCC Error Report
• Run Compile Error Report - Detailed
• Use Index File
468 IN T E G R AT I O N G U ID E
C H A P T E R 4 3 U P DA T IN G A N A P PL IC A T IO N
Converting data
Refer to Chapter 60, If you change any of your application’s tables in the process of updating your
“Updating an application, data from the previous version of your application will likely be
Application,” in Volume incompatible. This requires that you convert data at the customer site to the new
1 of the Dexterity table definition for the updated version of your application. Changes that make
Programmer’s Guide existing data incompatible include:
for more information
• Adding or deleting fields from a table definition
about writing a table
• Changing the storage size of a table field
conversion procedure.
• Adding or deleting table keys
• Changing table keys
In addition, if your table uses Microsoft Dynamics GP fields and the storage size of
one of the fields changes, you’ll need to convert the data for that table.
If you have any alternate reports in your application, you will need to remake those
modifications. This is necessary because the new version of the report you
customized may include new resource or changes to the layout.
Do not transfer alternate forms or reports from your previous development dictionary to
the updated version of your development dictionary. This will replace the original form or
report in the Dynamics.dic dictionary and invariably result in application errors.
Once your updated application is ready for packaging, complete the following
steps:
To create a chunk that contains all your application’s resources, use the same
procedure you used when packaging your application using the Auto-Chunk
utility. Refer to Building a chunk dictionary on page 456 for information about
using the Auto-Chunk utility.
Forms dictionary
During the unchunking process, resources in the forms dictionary are updated to
make them compatible with the application dictionary. If the user has made any
modifications to forms, as many of those changes as possible will be preserved.
470 IN T E G R AT I O N G U ID E
C H A P T E R 4 3 U P DA T IN G A N A P PL IC A T IO N
Reports dictionary
Updating the reports dictionary is a two-step process. During the unchunking
process, resources in the reports dictionary are updated to make them compatible
with the application dictionary. The second part of the updating process must be
performed by executing the Dict_UpdateReportsDictionary() function. This
portion of the report update uses an “input” file that describes how to handle
database changes that affect reports. You can also run this portion of the update
without using an input file. This is beneficial, because the second portion of the
report update performs some “cleanup” operations on the reports dictionary.
• Chapter 45, “Installer Template,” explains how to use the WiX installer template
to create an installer for your integration.
474 IN T E G R AT I O N G U ID E
Chapter 44: Windows Installer Overview
When distributing an integration to your customers, consider creating an installer
with Windows Installer Services. Provided with Windows, this set of services makes
installing and maintaining applications much easier. Information about Windows
Installer is divided into the following sections:
We suggest that you use the Windows Installer to create an installer for your
Microsoft Dynamics GP integration. Users will have a consistent experience
installing your integration, as well as the other benefits of the Windows Installer.
Several products are available for creating an installer based on Windows Installer
Services. They include:
Any of these products could be used to create an installer for your integrating
application. For Microsoft Dynamics GP, a shared-source toolset named WiX is used
to create the installer. A sample WiX template is included with this documentation.
It provides an example of how to install a basic integration.
To begin working with Windows Installer Services, we recommend that you install
the Windows Installer SDK. This is included in the Windows Platform SDK, and
can be downloaded from the Microsoft Developer Network (MSDN®) web site. Go
to msdn.microsoft.com and search for “Platform SDK”.
If you have limited experience creating installers, the quickest path to a successful
installer will be to use the WiX template provided with this documentation. This
template is described in detail in Chapter 45, “Installer Template.”
WiX
WiX (Windows Installer XML) is a toolset that is used to create installers based on
Windows Installer Services. XML source files are used to specify the characteristics
of the installer being created. WiX provides a large feature set and can be used to
create sophisticated installation routines.
The sample installer templates were written for WiX release 3. They were tested with build
3.0.5419.0 of WiX.
WiX is available under Microsoft’s Shared Source Licensing Program. You can learn
more about this program at the following site:
http://www.microsoft.com/resources/sharedsource/default.mspx
WiX is still in active development, with new features being added. Quality of the
WiX toolset has reached a level that production installers can be created with it. You
can download the latest version of the WiX toolset from this location:
http://sourceforge.net/projects/wix
After installing the WiX toolset, you should add the folder that contains the WiX
binary files to the PATH environment variable on your system. This allows the WiX
tools be accessed easily from the command prompt.
GUIDs
Globally-unique IDs (GUIDs) are used throughout the process of creating installer
or patched. You will need to generate GUIDs as you create your installer. The
GUIDGen tool, included with the Platform SDK, is a good choice. You can also use
SQL Server to generate GUIDs.
476 IN T E G R AT I O N G U ID E
Chapter 45: Installer Template
A WiX installer template is included with the samples for Dexterity. You can use this
template to create an installer for your integration. Information about using this
template is provided in the following sections:
You can use this template to install your integration. Since it uses the standard WiX
toolset, you can enhance your installer with any other capabilities provided by WiX.
The following are the basic steps needed to create an installer using the WiX
template provided:
Creating an installer
To create an installer using the WiX template, complete the following steps. As an
example, the steps needed to create the installer for the sample integrating
application are described.
Rename the Template.wxl file to match the new name for the template project.
For this example, the file was rename to Develop.wxl to match the name chosen
for the project file.
478 IN T E G R AT I O N G U ID E
C H A P T E R 4 5 IN S TA LL E R T E M P LA TE
Upgrade code This value is a GUID that identifies the product. This value
remains constant throughout the life of the product. The same value must be
used in every version of the product that is released.
Version A string that indicates the major, minor, build, and revision numbers
for the release. The major, minor, and build numbers are significant for
comparing versions. Be sure to use them consistently for releases of your
product. For example, version 9.0 build 1 revision 0 of a product would have
the following version string: '9.0.1.0'
Cabinet file name This string specifies the name of the cabinet (.cab) file
that will be used for the installer. Use a value that corresponds to the installer
you’re creating. For example, the cabinet file for the sample installer is
“Develop.cab”.
<ComponentRef Id='Develop.cnk'/>
<ComponentRef Id='Develop.chm'/>
Product ID This should be the integer product ID you use for your
integrating application.
Feature By default, this will be “Template”. If you changed the feature name
in the .wxs project file, you must change this setting to match the name you
chose.
Product information The last group of entries in this file specifies the
product information for the integrating application. These entries must match
the information that you specified in the Product Information window in
Dexterity Utilities when you created your dictionary chunk. For instance, the
following entries are used for the sample integrating application’s installer.
<Data Column="PRODID">3333</Data>
<Data Column="NAME">Sample Integrating App.</Data>
<Data Column="APPDIC">Develop.dic</Data>
<Data Column="FRMDIC">F3333.dic</Data>
<Data Column="RPTDIC">R3333.dic</Data>
InstallToUpgrade For this value, specify the Upgrade Code for your
integration, with no dashes, prepended with the letters “UC”.
The template installer moves the previous version of the dictionary to the “Data” folder
and renames it to include the “Prev_” prefix. The dictionary can then be used when
upgrading the forms and reports dictionaries.
480 IN T E G R AT I O N G U ID E
C H A P T E R 4 5 IN S TA LL E R T E M P LA TE
FormsDictionary This value specifies the name of the forms dictionary for
the integration.
candle filename.wxs
Replace filename with the name of your installer project file. The command
should process, create a .wixobj object file, and not display any errors. If errors
are displayed, correct them and compile again.
Replace filename with the name of your installer project file. Replace locfile with
the name of the localization file used for your project. Again, no errors should
be reported.
[Setup]
PROD_NAME=Sample Integrating Application
PROD_SHORT_NAME=Sample Integrating Application
INSTALL=Develop.msi
It’s important that you use the version of the Setup.msi file that matches the
version of Microsoft Dynamics GP your integrating application works with. For
example, if you are integrating with version 11.0 of Microsoft Dynamics GP, the
version information for Setup.msi you use should indicate this. To see the
version that Setup.msi works with, position the pointer over the Setup.msi icon
and display the tooltip. The version will be indicated in the comment.
Launch the installer by running Setup.msi, not the installer file you created. Launching
your .msi file directly will cause an error.
<INST01>{7FE7E638-52F5-437f-BE57-A64F0BE549A8}</INST01>
<INST02>{462D0913-E2F2-4869-A29C-844BEFD8D30D}</INST02>
The set of 50 GUIDs must be changed each time you change the product code for your
application.
482 IN T E G R AT I O N G U ID E
C H A P T E R 4 5 IN S TA LL E R T E M P LA TE
Replace filename with the name of the installer file you created. You will see the
processing occur as each transform is applied to the installer file. The completed
.msi file will be somewhat larger after all of the transforms have been added.
• Patch overview
• Creating a patch
Patch overview
If you use the Windows Installer to install your integrating application, you must
use patches created with Windows Installer to apply updates for your integration.
Patches are typically used for small changes, like code corrections. They’re typically
not used for large changes like table structure changes. Patches are easily applied by
the user or by the automatic update process in Microsoft Dynamics GP.
Patch files have the additional advantage of being included in the “repair”
operations that can be performed by Windows Installer. A repair operation will
automatically re-apply any patches that have been installed for your integration,
ensuring that the most current version is being used after a repair.
This is why when you use Windows Installer for your integration, you shouldn’t manually
update an installation with dictionary chunk (.cnk) files. The repair process won’t include
any of the updates you applied manually.
When you create patch, you will begin by creating a full build of your updated
integrating application. Be sure that you’re incrementing only the build number for
the updated version. The major and minor version numbers should remain
unchanged. New installations of your integration will use the full installer for the
updated version of your integration. Existing installations of your integration will
use the install patch to move to the updated version of your integration.
A WiX template project for a patch is included in the Installer folder within the
Samples folder of the Dexterity install. The following are the basic steps needed to
create an installer patch using the WiX template provided:
Creating a patch
To create a patch using the WiX template, complete the following steps. As an
example, the steps needed to create a patch for the sample integrating application
are described.
486 IN T E G R AT I O N G U ID E
C H A P T E R 4 6 P A TC HE S
Replace file with the name of the MSI file you’re extracting. Replace path with
the path to the folder where you want the extracted files to be placed. Replace
logfile with the name of the log that will contain status information about the
process.
For example, the following two commands are used to extract the baseline and
updated installers for the sample integration:
After the extraction, the log files will have been created and the folders will
have the contents of the two installers.
Output path This string specifies the name given to the patch file, as well as
the location it will be placed.
UpgradeImage This element specifies the locations of the two installers that
will be compared to create the patch. For the UpgradeImage src attribute,
specify the installer file in the “New Version” folder. For the TargetImage src
attribute, specify the installer file in the “Base Version” folder. For example, the
following is the UpgradeImage element for the sample patch:
Target product codes These GUID values identify the individual instances
of your integration installed on a Microsoft Dynamics GP system. The first
TargetProductCode must be set to the Product Id GUID specified at the
beginning of the original installation’s .wxs file. The remaining 50 GUIDs must
be set to the 50 GUIDs used in the Transform.xml file used for multiple-instance
support.
candle filename.wxs
Replace filename with the name of your patch project file. The command should
process, create a .wixobj object file, and not display any errors. If errors are
displayed, correct them and compile again.
light filename.wixobj
Replace filename with the name of your patch project file. Again, no errors
should be reported.
You may want to consider adding the location of this file to the PATH environment
variable.
Replace PCPfile with the name of the .pcp file you created in the previous step.
Replace patch with the name you want to use for the patch file. Replace logfile
with the name of the log to which results will be written.
488 IN T E G R AT I O N G U ID E
C H A P T E R 4 6 P A TC HE S
For example, the following command is used to create the patch for the sample
integration:
You will receive a warning indicating the versions of the two installers do not
match. That’s OK for this patch, so click Yes to proceed.
When you launch Microsoft Dynamics GP, the updated code will be merged in.
492 IN T E G R AT I O N G U ID E
Area Page scripts
The following scripts are used when defining a new Area Page for an integrating
application:
• AddCategory
• AddCommand
• AddContentArea
• AddItems
• Create
• Display
AddCategory
Description The AddCategory procedure of the syAreaPageXML form adds a category to the
current content area of the Area Page. It also adds the commands from the specified
command list to the category.
• command_list – The command list that contains the commands to be added to the
category.
• display_name – A string parameter that specifies the title displayed for the category.
• expanded – A boolean that specifies whether the category is expanded. The value
true specifies that it is, while false specifies that it is not.
Comments The following illustration shows a category that is added to a content area for an
Area Page for Microsoft Dynamics GP.
Examples The following example adds the Inventory category to the current content area of
the Area Page being defined.
494 IN T E G R AT I O N G U ID E
A R E A P A G E S C R I P T S A D D C O M M A N D
AddCommand
Description The AddCommand method defined for the syAreaPageXML form adds a single
command to the current content area.
Examples The following example adds individual commands to the various content areas for
an the Area Page in the sample integrating application.
{Reports}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(451) {Reports}, IMAGE_REPORTS of form syAreaPageXML, true, 1;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Reports
➥ of form Command_IG_Sample;
{Inquiry}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(4426) {Inquiry}, IMAGE_INQUIRY of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Inquiry
➥ of form Command_IG_Sample;
{Setup}
call AddContentArea of form syAreaPageXML, XMLState, getmsg(860) {Setup},
➥ IMAGE_SETUP of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command
➥ IG_Contact_History_Setup of form Command_IG_Sample;
end if;
AddContentArea
Description The AddContentArea method defined for the syAreaPageXML form adds a top-
level content area to the Area Page.
• display_name – A string parameter that specifies the title displayed for the content
area. Consider using one of the getmsg() function and one of the following message
values to retrieve the string to display for the standard content areas:
• image – A string parameter that specifies the relative path to the image to be
displayed for the content area. The path is relative to the Background folder found
in the Microsoft Dynamics GP installation. Use one of the following constants
defined for the syAreaPageXML form to specify the image for the standard content
areas:
• expanded – A boolean that specifies whether the content area is expanded. The value
true specifies that it is, while false specifies that it is not.
• column – An integer that specifies the column the content area is located in. Indicate
column 1 or column 2.
496 IN T E G R AT I O N G U ID E
A R E A P A G E S C R I P T S A D D C O N T E N T A R E A
Comments The following illustration shows the Cards content area that was added to an Area
Page for Microsoft Dynamics GP. It contains one item.
Examples The following example adds the Cards content area to the Area Page being defined.
The content area is added to column 1.
end if;
AddItems
Description The AddItems method defined for the syAreaPageXML form adds the items
defined by a command list to the current content area. Unlike the AddCategory
procedure, the items are not part of a collapsible category.
• command_list – The command list that contains the commands to be added to the
content area.
Examples The following example adds the items from the CL_Purchasing_Reports command
list to the content area for the Area Page being defined.
end if;
498 IN T E G R AT I O N G U ID E
A R E A P A G E S C R I P T S C R E A T E
Create
Description The Create procedure defined for the syAreaPageXML form creates a new Area
Page.
• display_name – A string parameter that specifies the title displayed at the top of the
Area Page.
Examples The following example creates and displays an Area Page for the sample integrating
application.
{Reports}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(451) {Reports}, IMAGE_REPORTS of form syAreaPageXML, true, 1;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Reports
➥ of form Command_IG_Sample;
{Inquiry}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(4426) {Inquiry}, IMAGE_INQUIRY of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Inquiry
➥ of form Command_IG_Sample;
{Setup}
call AddContentArea of form syAreaPageXML, XMLState, getmsg(860) {Setup},
➥ IMAGE_SETUP of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command
➥ IG_Contact_History_Setup of form Command_IG_Sample;
end if;
Display
Description The Display procedure defined for the syAreaPageXML form displays an Area
Page.
Examples The following example creates and displays an Area Page for the sample integrating
application.
{Reports}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(451) {Reports}, IMAGE_REPORTS of form syAreaPageXML, true, 1;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Reports
➥ of form Command_IG_Sample;
{Inquiry}
call AddContentArea of form syAreaPageXML, XMLState,
➥ getmsg(4426) {Inquiry}, IMAGE_INQUIRY of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command IG_Lead_Inquiry
➥ of form Command_IG_Sample;
{Setup}
call AddContentArea of form syAreaPageXML, XMLState, getmsg(860) {Setup},
➥ IMAGE_SETUP of form syAreaPageXML, true, 2;
call AddCommand of form syAreaPageXML, XMLState, command
➥ IG_Contact_History_Setup of form Command_IG_Sample;
end if;
500 IN T E G R AT I O N G U ID E
Command scripts
The following scripts are used when working with commands for an integrating
application:
• Command_HideAndDisable
• Command_ShowAndEnable
Command_HideAndDisable
Comments By using a common procedure for hiding and disabling commands, Microsoft
Dynamics GP can control what action is performed for the command. For example,
Microsoft Dynamics GP can choose to display the commands, but leave them in the
disabled state so they cannot be used. This can be useful so that all commands can
be seen.
Examples The following example is the form pre script for a command form. It checks the
security access for the integration. If access should not be granted, it disables the
commands for the integration.
502 IN T E G R AT I O N G U ID E
C O M M A N D S C R I P T S C O M M A N D _ S H O W A N D E N A B L E
Command_ShowAndEnable
Comments By using a common procedure for showing and enabling commands, Microsoft
Dynamics GP can control what action is performed for the command. For example,
Microsoft Dynamics GP can choose to display the commands, but leave them in the
disabled state so they cannot be used. This can be useful so that all commands can
be seen.
Examples The following example checks the security access for the integration. If access
should be granted, it shows and enables the commands for the integration.
• AddMetric
• AddMyReport()
• AddNew
• AddQuickLink
• AddSection
• AddSubSection
• Create()
• Commit()
• Destroy
• Exists()
• Get()
• Release
• SetIndex
• SetUserRole
AddMetric
Description The AddMetric procedure of the form syHomePageMetric form adds a metric item
to the template Home Page for a user.
Parameters • user_ID – A string specifying the ID of the current user for which the metric is being
added.
• dict_ID – The ID of the dictionary that contains the definition of the metric.
• metric_ID – An integer that specifies the ID of the metric being added. Typically a
constant is used for the metric ID.
Comments This procedure simply adds the metric to the Home Page template. Other scripts
must be added to your dictionary to process the metric.
Examples The following example trigger processing procedure uses the AddMetric procedure
to add a metric to the Home Page template for the Operations Manager role. The
constant METRIC_TOP5LEADS was defined to identify the metric.
in integer iIndustry;
in integer iUserRole;
506 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S A D D M Y R E P O R T ()
AddMyReport()
Description The AddMyReport() function of the syMyReportsObj form adds a report item to
the My Reports section of the template Home Page for a user.
Return value An integer indicating whether the report item was added. The constant value OKAY
indicates it was, while any other value indicates it was not.
Comments When you add a report using this function, it will also be included in the Report List
displayed for the user.
Examples The following example trigger processing procedure uses the AddMyReport()
function to add a simple report item to the Home Page template for a role. Notice
how the items in the syReportData composite are filled in to indicate which report is
being added.
in integer iUserRole;
AddNew
Description The AddNew procedure of the syHomePage form starts the process of adding a
Home Page for a user.
• UserID – A string that specifies the user for which the new Home Page is being
created.
• Display – A boolean that specifies whether the Home Page will be displayed by
default for the user. The value true indicates the page will be displayed, while false
indicates it will not.
• Refresh – A boolean that specifies whether the Home Page will be automatically
refreshed at the standard one-hour interval. The value true indicates the page will
be refreshed, while false indicates it will not.
• UserRole – An integer that specifies the role for which the Home Page is being
created. This typically corresponds to the constant value created for the new role.
508 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S A D D Q U I C K L I N K
AddQuickLink
Parameters • UserID – A string specifying the ID of the current user for which the Quick Link is
being added.
• TypeID – An integer specifying the type of link being added. The value corresponds
to one of the following constants that are defined as part of the syHomePageMain
form:
Constant Description
QL_COMMAND A standard command action
QL_EXTERNAL A link to an external action
QL_WEBPAGE A link to a web page
• CmdID – For command links, the resource ID of the command to use for the link.
For the other types of links, specify 0.
• CmdFormID – For command links, the resource ID of the command form that
contains the definition of the command used for the link. For the other types of
links, specify 0.
• CmdDictID – For command links, the ID of the dictionary that contains the
command you are using for the link. For the other types of links, specify 0.
• DisplayName – A string specifying the name to display for the Quick Link.
• TargetString1 – A target string for the Shortcut Bar. Specify the empty string.
• TargetString2 – A target string for the Shortcut Bar. Specify the empty string.
• TargetString3 – A target string for the Shortcut Bar. Specify the empty string.
• TargetLong1 – A target long integer for the Shortcut Bar. Specify the value 0.
• TargetLong2 – A target long integer for the Shortcut Bar. Specify the value 0.
• TargetLong3 – A target long integer for the Shortcut Bar. Specify the value 0.
• TargetLong4 – A target long integer for the Shortcut Bar. Specify the value 0.
• TargetLong5 – A target long integer for the Shortcut Bar. Specify the value 0.
Examples The following example shows the AddQuickLink procedure being used to add a
command link to a Home Page template.
local string sUserID;
The following example shows the AddQuickLink procedure being used to add an
external link to a Home Page template.
The following example shows the AddQuickLink procedure being used to add a
web page link to a Home Page template.
510 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S A D D S E C T I O N
AddSection
Description The AddSection procedure of the syHomePageLayout form adds a section to the
Home Page being created for a user.
Parameters • UserID – A string that specifies the user for which the new Home Page is being
created.
• SectionID – A constant defined for the syHomePageMain form that specifies which
section is being added to the Home Page. The value corresponds to one of the
following constants:
Constant Description
METRICS The Metrics section of the Home Page
MYREPORTS The My Reports section of the Home Page
OUTLOOK The Outlook section of the Home Page
QUICKLINKS The Quick Links section of the Home Page
TODO The To Do section of the Home Page
• ColumnNumber – An integer specifying the column into which the section will be
placed. Use the value 1 or 2 for the column number.
• Visible – A boolean specifying whether the section will be displayed. The value true
indicates the section will be displayed, while the value false indicates the section
will be hidden.
Comments You must define all sections for the Home Page. If you don’t want a section to be
shown, use the Visible parameter to set its state to hidden.
AddSubSection
Parameters • UserID – A string that specifies the user for which the new Home Page is being
created.
Constant Description
METRICS The Metrics section of the Home Page
MYREPORTS The My Reports section of the Home Page
OUTLOOK The Outlook section of the Home Page
QUICKLINKS The Quick Links section of the Home Page
TODO The To Do section of the Home Page
• SubSectionID – A constant defined for the syHomePageMain form that specifies the
sub-section being added. The value corresponds to one of the following constants:
• Visible – A boolean specifying whether the sub-section will be displayed. The value
true indicates the sub-section will be displayed, while the value false indicates the
sub-section will be hidden.
• UserDefined – A string parameter that isn’t currently used. Use the empty string ("")
for this parameter.
Comments You must define all sub-sections for the Home Page. If you don’t want a sub-section
to be shown, use the Visible parameter to set its state to hidden.
512 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S C R E A T E ()
Create()
Description The Create() function of the syHomePage form populates the state object for a
Home Page.
• table HomePageTable – The syHomePage table, which stores information about the
Home Page for each user in Microsoft Dynamics GP.
Return value An integer indicating the status of the operation. The value corresponding to the
constant OKAY indicates the operation completed successfully. Any other value
indicates the operation failed.
The procedure uses the Create() function to create the state object for the Home
Page. The Exists() function is used to determine whether the user already has a
Home Page defined. If one hasn’t been defined, the AddNew procedure is used to
create one. If a Home Page already exists for the user, the SetIndex procedure, Get()
function, and SetUserRole procedure are used to retrieve the existing entry. The
AddSection and AddSubSection procedures are called to define the Home Page
content. Quick Links and Metrics are added. Finally, the Release and Destroy
procedures dispose of the Home Page object.
in integer iIndustry;
in integer iUserRole;
{Add Metrics}
call AddMetric of form syHomePageMetric,
sUserID,
IG_PROD_ID,
METRIC_TOP5LEADS;
end if;
514 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S C O M M I T ()
Commit()
Description The Commit() function of the syHomePage form commits the settings for the Home
Page.
Return value An integer indicating the status of the operation. The value corresponds to one of
the following constants:
Destroy
Description The Destroy procedure of the syHomePage form disposes of the state object for the
Home Page.
516 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S E X I S T S ()
Exists()
Description The Exists() function of the syHomePage form indicates whether a Home Page has
been created for the specified user in Microsoft Dynamics GP.
Parameters • UserID – A string that specifies the user for which the Home Page creation state is
being determined.
Return value A boolean. The value true indicates a Home Page exists for the user, while the value
false indicates one does not.
Get()
Description The Get() function of the syHomePage form retrieves the settings for the specified
item from the Home Page table.
Return value An integer indicating the result of the operation. The value corresponds to one of
the following constants:
518 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S R E L E A S E
Release
Description The Release procedure of the syHomePage form releases the record in the table for
the current Home Page.
SetIndex
Description The SetIndex procedure of the syHomePage form sets the key value for the
specified user so the Home Page for that user can be retrieved.
• UserID – A string that specifies the user for which the Home Page information is
being retrieved.
520 IN T E G R AT I O N G U ID E
H O M E P A G E S C R I P T S S E T U S E R R O L E
SetUserRole
Description The SetUserRole procedure of the syHomePage form sets the user role for the the
Home Page.
• UserRole – An integer that specifies the role for the Home Page. This typically
corresponds to the constant value created for each role.
• ActionStatus_LogActionComplete()
• ActionStatus_LogError()
• AddCommand()
• AddGroup()
• AddReport()
• BuildDictSpecificID()
• Columns_AddToken()
• Columns_AutoGenTokensForEnumField()
• ConfirmAction()
• CreateDefaultColumn()
• CreateDefaultCustomViewRecord()
• CreateDefaultFactBox()
• CreateDefaultViewRecord() -- Options
• CreateDefaultViewRecord() -- View
• DeleteForListView() -- Options
• DeleteForListView() -- Columns
• DeleteForListView() -- Business Analyzer Reports
• DisassembleDictSpecificID
• Exists()
• ExistsAsAction()
• ExistsAsGroup()
• FactBoxParameter_Add
• FindCommandInCmdList()
• GetListID()
• GetMarkedRecordCount()
• GetMarkedRecordsTableIndex()
• GetMarkedRecordsTableRef()
• GetViewID()
• InfoValue_ClearState()
• InfoValue_IsStateSet()
• InfoValue_SetState()
• List_FormatBoolean()
• List_FormatCurrency()
• List_FormatDate()
• List_FormatInteger()
• List_FormatPhone()
• List_FormatQuantity()
• List_FormatString()
• List_FormatTime()
• List_GetIDsForCoreCommand
• List_MultiSelectActionCompleteEvent
• List_Open
• List_RegisterAction()
• List_RegisterGroup()
• List_SetFactBoxParameter
• RegisterListNavigationCommand()
• XMLDoc_AddColumn
• XMLDoc_AddHeaderField
• XMLDoc_AddLineItem
• XMLDoc_AddLineItemValue
• XMLDoc_Create
• XMLDoc_Save
524 IN T E G R AT I O N G U ID E
L I S T S C R I P T S A C T I O N S T A T U S _ L O G A C T I O N C O M P L E T E ()
ActionStatus_LogActionComplete()
Description The ActionStatus_LogActionComplete() function of the form syListObj is used to
indicate that all status information has been logged for a list action.
• success_count – A long integer specifying the total number of list items that were
processed successfully.
• failure_count – A long integer specifying the total number of list items that had an
error logged for them as they were processed.
Return value A long integer containing the number of errors that were logged.
Comments The action processing code must keep track of the number of list items that were
processed successfully and that were processed but had an error logged.
ActionStatus_LogError()
Description The ActionStatus_LogError() function of the form syListObj is used to log a specific
error for a list action.
• error_text – A string that specifies the text of the error being logged.
• error_value – A long integer that specifies the numeric representation of the error
being logged. Often, this is a value from the err() function.
• reference_field – This is a reference to the field that identifies the list item for which
the error is being logged. Typically, it refers to a field in the main table used for the
list.
Return value A long integer containing the sequence for the logged error.
Examples The following is the DeleteLeads procedure for the Leads card list defined in the
sample integrating application. This procedure is run when the Delete action is
performed for the list. If an error occurs during the delete process, the
ActionStatus_LogError() function is used to log the error details. Once the action
processing is complete, the ActionStatus_LogActionComplete() function is called
to complete the process. Since the Delete action can be performed on multiple list
items at once, the List_MultiSelectActionCompleteEvent procedure is called to
indicate that a multi-select action has finished.
{Use the table reference from the list object to find which Leads are selected
in the list.}
get first table(list_object:TableRef1) by number list_object:Index;
526 IN T E G R AT I O N G U ID E
L I S T S C R I P T S A C T I O N S T A T U S _ L O G E R R O R ()
end while;
AddCommand()
Description The AddCommand() function defined in the syListViewCmdBarObj form is used to
add a command to a group in the Action Pane for a list.
Parameters • product_ID – The ID of the dictionary that contains the list for which you are adding
a command.
• list_ID – An integer specifying the ID of the list for which you are adding a
command.
• view_ID – An integer specifying the view for which the command is being added.
Use the constant LIST_PRIMARYVIEWID to indicate the primary view for the list.
• ParentDictID – The ID of the dictionary that contains the command list (group in the
Action Pane) to which the new command will be added. Use the constant
DYNAMICS to specify that you are adding items to a command list that is defined
in the Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list (group in the Action Pane) to which you are adding a command.
• ParentCmdID – The resource ID of the command list (group in the Action Pane) to
which you are adding a command.
• sequence – An integer variable that can be used to specify the sequence of the item in
the command list. The value 0 specifies the command will be added to the end of
the list. The actual position of the command will be returned after the command is
added.
• CmdDictID – The ID of the dictionary that contains the command you are adding.
• CmdFormID – The resource ID of the command form that contains the definition of
the command you are adding.
• priority – An integer that specifies the preferred initial location of the button for the
command. The value corresponds to one of the following constants:
528 IN T E G R AT I O N G U ID E
L I S T S C R I P T S A D D C O M M A N D ()
Constant Example
LISTACTIONPRIORITY_PRIMARY
LISTACTIONPRIORITY_SECONDARY
LISTACTIONPRIORITY_OVERFLOW
• size – An integer that specifies the initial size of the button displayed in the Action
Pane for the command. The value corresponds to one of the following constants:
Constant Example
LISTACTIONBTNSIZE_SMALL
LISTACTIONBTNSIZE_LARGE
• caption – A string specifying the caption to display for the command when it is
displayed in the Action Pane. Set this parameter to the empty string ("").
• visible – A boolean specifying whether the command will initially be visible in the
Action Pane. The value true indicates it will be visible, while the value false
indicates it will not.
Return value An integer indicating whether the command was added to the Action Pane. The
value corresponds to one of the following constants:
Constant Description
OKAY The command was successfully added.
DUPLICATE The command was not added because it already exists.
Comments A command displayed in the Action Pane must always be part of a group.
{Does the Contact History command exist for the list? If not, add it.}
exists = ExistsAsAction(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Contact_History of form Command_IG_Sample),
DYNAMICS,
LISTID_CUSTOMERS,
LIST_PRIMARYVIEWID) of form syListViewCmdBarObj;
{If the command was found, add the Contact History command}
if seq <> 0 then
seq = seq + 1;
nStatus = AddCommand(DYNAMICS,
LISTID_CUSTOMERS,
LIST_PRIMARYVIEWID,
DYNAMICS,
resourceid(form ListObj_Customers),
resourceid(command CL_ModifyGroup of form ListObj_Customers),
seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Contact_History of form
➥ Command_IG_Sample),
LISTACTIONPRIORITY_SECONDARY,
LISTACTIONBTNSIZE_SMALL,
530 IN T E G R AT I O N G U ID E
L I S T S C R I P T S A D D C O M M A N D ()
""{caption},
true{visible}) of form syListViewCmdBarObj;
end if;
end if;
{Does the Update Contact Date command exist for the list? If not, add it.}
exists = ExistsAsAction(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Update_Contact_Date of form Command_IG_Sample),
DYNAMICS,
LISTID_CUSTOMERS,
LIST_PRIMARYVIEWID) of form syListViewCmdBarObj;
{If the command was found, add the Update Contact Date command}
if seq <> 0 then
seq = seq + 1;
nStatus = AddCommand(DYNAMICS,
LISTID_CUSTOMERS,
LIST_PRIMARYVIEWID,
DYNAMICS,
resourceid(form ListObj_Customers),
resourceid(command CL_ActionsGroup of form ListObj_Customers),
seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Update_Contact_Date of form
➥ Command_IG_Sample),
LISTACTIONPRIORITY_SECONDARY,
LISTACTIONBTNSIZE_SMALL,
""{caption},
true{visible}) of form syListViewCmdBarObj;
end if;
end if;
end if;
532 IN T E G R AT I O N G U ID E
L I S T S C R I P T S A D D G R O U P ()
AddGroup()
Description The AddGroup() function defined in the syListViewCmdBarObj form is used to
add an additional group (command list) to the Action Pane for a list.
Parameters • product_ID – The ID of the dictionary that contains the list for which you are adding
a group.
• list_ID – An integer specifying the ID of the list for which you are adding a group.
• view_ID – An integer specifying the view for which the group is being added. Use
the constant LIST_PRIMARYVIEWID to indicate the primary view for the list.
• sequence – An integer variable that can be used to specify the sequence of the group
in the Action Pane. The value 0 specifies the group will be added to the end of the
Action Pane. The actual position of the group will be returned after the group is
added.
• CmdDictID – The ID of the dictionary that contains the group (command list) you
are adding.
• CmdFormID – The resource ID of the command form that contains the definition of
the group (command list) you are adding.
• CmdID – The resource ID of the group (command list) you are adding.
• caption – A string specifying the caption to display for the group when it is
displayed in the Action Pane. Set this parameter to the empty string ("").
• visible – A boolean specifying whether the group will initially be visible in the
Action Pane. The value true indicates it will be visible, while the value false
indicates it will not.
• clone – An optional boolean indicating whether the group should be duplicated for
all existing lists of the specified type.
Return value An integer indicating whether the group was added to the Action Pane. The value
corresponds to one of the following constants:
Constant Description
OKAY The group was successfully added.
DUPLICATE The group was not added because it already exists.
Examples The following is a portion of the CreateListRibbonData procedure for the Leads
card list defined in the sample integrating application. This procedure defines the
groups and actions that appear in the Action Pane for the Leads list. This example
adds the Actions group to the Action Pane.
in ListDictID nListDictID;
in ListID nListID;
nGroupSeq = 0;
{ Actions group }
increment nGroupSeq;
nCmdDictID = IG_PROD_ID;
nCmdFormID = resourceid(form ListObj_Leads);
nCmdID = resourceid(command CL_ActionsGroup);
nStatus = AddGroup(nListDictID, nListID, LIST_PRIMARYVIEWID, nGroupSeq,
nCmdDictID, nCmdFormID, nCmdID,
""{caption},
true{visible}) of form syListViewCmdBarObj;
534 IN T E G R AT I O N G U ID E
L I S T S C R I P T S A D D R E P O R T ()
AddReport()
Description The AddReport() function defined in the syReportList form is used to add a report
to the Report List.
Syntax AddReport(report_data)
Return value An integer indicating whether the report was added to the list. The value
corresponds to one of the following constants:
Constant Description
OKAY The report was added successfully
DUPLICATE The report already exists
in ListObjState list_object;
in 'Report Series DictID' nSeriesDictID;
in 'Report Series ID' nSeriesID;
{Simple Report}
clear field RptData;
RptData:'Report Type' = REPORTTYPE_SIMPLE;
RptData:'Product ID' = IG_PROD_ID;
RptData:'Report Series DictID' = IG_PROD_ID;
RptData:'Report Series ID' = 1;
RptData:'Report ID' = 1;
RptData:'Report Option Name' = "Leads";
RptData:'DictID' = IG_PROD_ID;
RptData:'Resid' = resourceid(report IG_Leads);
end if;
BuildDictSpecificID()
Description The BuildDictSpecificID() function encodes an integer identifier for an action and
a product ID into a single action ID.
Parameters • product_ID – An integer that specifies the ID of the product that defines the action.
Examples The following example creates an action ID for an action in the sample integrating
application. The action is identified by the constant value
ACTION_CONTACT_HISTORY. The product ID is identified by the constant
IG_PROD_ID.
ID = BuildDictSpecificID(IG_PROD_ID, ACTION_CONTACT_HISTORY);
536 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C O L U M N S _ A D D T O K E N ()
Columns_AddToken()
Description The Columns_AddToken() function in syListObj form defines the filtering tokens
to use for a specific column in a list. This function is used when the values to use for
the tokens can’t be automatically determined, such as for a radio group.
Parameters • list_object – The list object composite that manages the state information for the list.
This will have been passed into the procedure that creates the filtering tokens for list
columns.
• column_ID – A long integer specifying the column for which the filtering token is
being added. This will have been passed into the procedure that creates the filtering
tokens for list columns.
• token_name – A string specifying the name that will be displayed for the token. This
name will also be used in the SQL expression that is generated for the filter token.
• search_condition – An optional string specifying the SQL search condition to use for
this specific token. If supplied, this search condition will be used in a WHERE
clause to retrict the list items displayed to those that meet the specified criteria. The
token_name and qualifier parameters will not be used for the restriction. The search
condition string must be enclosed by parentheses. The general form of the SQL
restriction clause is:
• qualifier – An optional integer that specifies how the % wildcard will be included in
the SQL expression for the token. The value corresponds to one of the following
constants:
Constant Description
QUALIFY_NONE The % wildcard will not be included in the SQL expression.The SQL
expression will have the form:
WHERE fieldname LIKE 'token_name'
QUALIFY_PREFIX The % wildcard will be added to the beginning of the SQL expression,
before the token_name parameter. The SQL expression will have the
form:
WHERE fieldname LIKE '%token_name'
QUALIFY_SUFFIX The % wildcard will be added to the end of the SQL expression, after the
token_name parameter. The SQL expression will have the form:
WHERE fieldname LIKE 'token_name%'
QUALIFY_FULL The % wildcard will be added to both the beginning and the end of the
SQL expression, surrounding the token_name parameter. The SQL
expression will have the form:
WHERE fieldname LIKE '%token_name%'
Return value A long integer containing the internal ID for the token.
Examples The following example is the GetColumnTokens procedure for a list. It shows how
tokens would be added for a list column based on a the Typical Balance radio
group. In this example, a search_condition expression is used to select the specific
balance type. The physical name for the Typical Balance radio group is TPCLBLNC.
The value 0 indicates a debit balance. The value 1 indicates a credit balance.
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
{Credit}
internal_ID = Columns_AddToken(list_object,
nColumnID,
"Credit", {Token name}
2, {Unique ID for this token}
"(TPCLBLNC = '1')") of form syListObj;
end if;
The following example is the GetColumnTokens procedure for a list. It shows how
tokens would be added for a list column based on the Document Type Name field,
which is a string value stored in the table. The value can be “Work”, “Open”, or
“History”. The token_name and qualifier parameters are used to define the selection
criteria for each token. The physical name for this field is DOCTYNAM.
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
538 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C O L U M N S _ A D D T O K E N ()
{Open}
internal_ID = Columns_AddToken(list_object,
nColumnID,
"Open", {Token name}
2, {Unique ID for this token}
"", {No expression}
QUALIFY_SUFFIX) of form syListObj;
{History}
internal_ID = Columns_AddToken(list_object,
nColumnID,
"History", {Token name}
3, {Unique ID for this token}
"", {No expression}
QUALIFY_SUFFIX) of form syListObj;
end if;
The three restriction expressions that will be generated for the tokens are:
Columns_AutoGenTokensForEnumField()
Description The Columns_AutoGenTokensForEnumField() function in syListObj form creates
the filtering tokens to use for a specific list column that is based on a drop-down list,
button drop list, list box, combo box, or visual switch datatype.
Parameters • list_object – The list object composite that manages the state information for the list.
This will have been passed into the procedure that creates the filtering tokens for list
columns.
• field – A window field instance of the drop-down list, button drop list, list box,
combo box, or visual switch for which tokens are being generated. When the
Columns_AutoGenTokensForEnumField() is run, the window the field is placed
on must already be open.
• column_ID – A long integer specifying the column ID of the list column for which
tokens are being generated. This will have been passed into the procedure that
creates the filtering tokens for list columns.
Return value A boolean. The value true indicates that tokens were successfully generated for the
field, while false indicates they were not.
Examples The following is the GetColumnTokens procedure for the Leads card list defined in
the sample integrating application. This procedure creates the filter tokens for the
Lead Business Category column, which is based on a drop-down list field.
in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;
540 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C O N F I R M A C T I O N ()
ConfirmAction()
Description The ConfirmAction() function of the form ListObj_DropDialogs is used to display a
confirmation dialog for the user before an action is applied to the marked list items.
If the user confirms the action, the action will be performed.
Parameters • list_type – An integer that specifies the type of list for which the action is being
performed. The value corresponds to one of the following constants:
Constant Description
LISTTYPE_CARD A card list
LISTTYPE_TRX A transaction list
LISTTYPE_REPORT A report list
• action_name – A string specifying the name of the action being performed. This
name will be used in the status messages for the action.
• button_prompt – A string specifying the text displayed in the button for the drop-
dialog.
Return value An integer specifying the drop-dialog status. The value OKAY is returned if all
properties of the drop-dialog could be set properly. Any other value indicates an
error occurred.
Comments The following illustration shows the drop-dialog displayed by the ConfirmAction()
function.
Examples The following example is the command script for the DeleteLead command used
for the Leads list in the sample integrating application. The script calls the
ConfirmAction() function to verify that the delete action should be performed for
the items marked in the list.
542 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C R E A T E D E F A U L T C O L U M N ()
CreateDefaultColumn()
Parameters • product_ID – The ID of the dictionary that contains the list for which you are
creating a column.
• list_ID – An integer specifying the ID of the list for which you are creating a column.
• sequence – An integer specifying the default position of the column in the list. The
value 1 specifies the first column.
• field_ID – The resource ID of the field to be used for the new column.
• sort_order – An integer specifying how the content of the column will be sorted. The
value corresponds to one of the following constants:
Constant Description
COLSORTORDER_DESCENDING Sort the column in descending order
COLSORTORDER_ASCENDING Sort the column in ascending order
COLSORTORDER_NONE Do not sort the column
• visible – A boolean that indicates whether the column will be displayed by default.
The value true indicates the column will be displayed, while false indicates it will
not.
• width – An integer specifying the default width for the column in pixels.
• array_index – An integer specifying the array index of the field to be used for the
column. Specify the value 0 if the field is not an array.
• format_field_dict_ID – The ID of the dictonary that contains the format field used to
format the content of the column. Specify the value 0 if no format field is being
used.
• format_field_ID – The resource ID of the format field used to format the content of
the column. Specify the value 0 if no format field is being used.
Return value An integer indicating whether the column was added. The value corresponds to one
of the following constants:
Constant Description
OKAY The column was added successfully
DUPLICATE The column already exists for the list
Examples The following example is part of the CreateListColumnsData procedure for the
Leads list in the sample integrating application. It uses the CreateDefaultColumn()
function to add the MarkedToProcess column to the list.
in ListDictID nListDictID;
in ListID nListID;
nStatus = CreateDefaultColumn(
nListDictID,
nListID,
nSeq,
resourceid(field 'Marked To Process'){field id},
COLSORTORDER_NONE {sort order},
true {visible},
25 {width},
0, {array index}
0, 0, { no format field }
0, {token ID}
0 {sort sequence}) of form syListViewColObj;
544 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C R E A T E D E F A U L T C U S T O M V I E W R E C O R D ()
CreateDefaultCustomViewRecord()
Description The CreateDefaultCustomViewRecord() function defined in the syListViewObj
form is used to create a custom view for a list.
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• list_ID – An integer specifying the ID of the list for which a custom view is being
created.
• name – A string specifying the name to display for the new custom view.
• local_ID – A long integer that will be saved with the custom view. This value can be
used to identify the view if the view record needs to be retrieved at a future time.
• view_ID – A returned long integer containing the ID value that Microsoft Dynamics
GP assigned to the custom view. This value will be used in the functions that
defined the characteristics of the custom view.
Return value An integer indicating whether the default view information was created. The
constant OKAY indicates the information was created. Any other value indicates an
error occurred.
CreateDefaultFactBox()
Description The CreateDefaultFactBox() function defined in the syListViewFactBoxReportsObj
form is used to add an SSRS report to the default set of reports for a Business
Analyzer displayed for a list.
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• list_ID – An integer specifying the ID of the list for which a Business Analyzer is
being created.
• sequence – An integer that is used to specify the sequence of the report in the list. The
value 1 indicates the first item in the list.
• relative_URL – A string specifying the relative URL of the report on the Report
Server to be displayed. The URL has the following form:
• view_ID – An integer specifying the list view for which Business Analyzer report
information is being added. Use the constant LIST_PRIMARYVIEWID to indicate
the primary view for the list.
Return value An integer indicating whether the default Business Analyzer information was
created. The constant OKAY indicates the information was created. Any other value
indicates an error occurred.
Comments The SSRS reports that are to be available for a Business Analyzer must be located in
the /company/series/Charts and KPIs/ location on the Report Server. Otherwise,
the reports will not be found by the Business Analyzer.
Examples The following example is the CreateListFactBoxData procedure for the Leads list in
the sample integrating application. It adds two reports that will be available by
default in the Business Analzyer for the Leads list.
in ListDictID nListDictID;
in ListID nListID;
546 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C R E A T E D E F A U L T F A C T B O X ()
increment nSeq;
nStatus = CreateDefaultFactBox(
nListDictID,
nListID,
nSeq,
"%Company%/Sales/Charts And KPIs/",
"Lead Potential Revenue",
LIST_PRIMARYVIEWID) of form syListViewFactBoxReportsObj;
increment nSeq;
nStatus = CreateDefaultFactBox(
nListDictID,
nListID,
nSeq,
"%Company%/Sales/Charts And KPIs/",
"Leads Per Salesperson",
LIST_PRIMARYVIEWID) of form syListViewFactBoxReportsObj;
CreateDefaultViewRecord() -- Options
Description The CreateDefaultViewRecord() function defined in the syListViewOptionsObj
form is used to create the default view option information for a list.
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• list_option – An optional long integer that allows specifying which records are
displayed in the list. The default value is indicated by the constant
LISTOPTION_ALLRECORDS, which specifies that all records are displayed.
• date_restriction – An optional long integer that allows specifying the date range of
the records displayed in the list. The default value is indicated by the constant
DATERESTRICT_NONE, which indicates that no date restriction is applied.
Return value An integer indicating whether the default view option information was created. The
constant OKAY indicates the information was created. Any other value indicates an
error occurred.
Examples The following is the CreateListOptionsData procedure for the Leads list. It uses the
CreateDefaultViewRecord() function to create new default view option
information for the primary view of the Leads list. The list has the ID value 1.
548 IN T E G R AT I O N G U ID E
L I S T S C R I P T S C R E A T E D E F A U L T V I E W R E C O R D ( ) -- V I E W
CreateDefaultViewRecord() -- View
Description The CreateDefaultViewRecord() function defined in the syListViewObj form is
used to create the default view information for a list.
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
Return value An integer indicating whether the default view information was created. The
constant OKAY indicates the information was created. Any other value indicates an
error occurred.
DeleteForListView() -- Options
Description The DeleteForListView() function defined in the syListViewOptionsObj form is
used to delete any existing view information that has been saved for a specific list.
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• view_ID – An integer specifying the view for which view information is being
deleted. Use the constant LIST_PRIMARYVIEWID to indicate the primary view for
the list.
Return value An integer indicating whether the view information was deleted. The constant
OKAY indicates the information was deleted. Any other value indicates an error
occurred.
Examples The following is the CreateListOptionsData procedure for the Leads list. It uses the
DeleteForListView() function to remove any existing view information for the
primary view of the Leads list. The list has the ID value 1.
550 IN T E G R AT I O N G U ID E
L I S T S C R I P T S D E L E T E F O R L I S T V I E W ( ) - - C O L U M N S
DeleteForListView() -- Columns
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• view_ID – An integer specifying the view for which column definition information
is being deleted. Use the constant LIST_PRIMARYVIEWID to indicate the primary
view for the list.
Return value An integer indicating whether the column definitions were deleted. The constant
OKAY indicates they were deleted. Any other value indicates an error occurred.
Examples The following example is a portion of the CreateListColumnsData procedure for the
Leads list in the sample integrating application. This portion of the script uses the
DeleteForListView() function to remove any existing column information for the
list before new columns are defined.
in ListDictID nListDictID;
in ListID nListID;
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• view_ID – An integer specifying the view for which SSRS report information is
being deleted. Use the constant LIST_PRIMARYVIEWID to indicate the primary
view for the list.
Return value An integer indicating whether the SSRS report information was deleted. The
constant OKAY indicates it was. Any other value indicates an error occurred.
552 IN T E G R AT I O N G U ID E
L I S T S C R I P T S D I S A S S E M B L E D I C T S P E C I F I C I D
DisassembleDictSpecificID
• action – A returned integer containing the action extracted from the supplied action
ID.
Examples The following example is the trigger processing procedure that runs when the user
chooses an action from the Customers list. It uses the DisassembleDictSpecificID
procedure to extract the product ID and action from the action ID.
inout ListObjState list_object;
in long action_id;
Exists()
Description The Exists() function in the syListViewObj form verifies whether a specific view for
a list has been defined.
Parameters • product_ID – The ID of the dictionary that contains the list for which the view is
being queried.
• list_ID – An integer specifying the ID of the list for which a view is being queried.
• view_ID – An integer specifying the view being queried. Use the constant
LIST_PRIMARYVIEWID to indicate the primary view for the list.
Return value A boolean. The value true indicates the view has been defined for the list, while
false indicates it has not.
Comments Use this function when creating custom views to determine whether views for the
specific list have already been created.
Examples The following example is a trigger processing procedure from the sample
integrating application. It creates a custom view for the Leads list in the sample
integration. It uses the Exists() function to determine whether the primary view for
the Leads list has been created. If it has not, it uses the CreateDefaultViewRecord()
-- View and the CreateDefaultCustomViewRecord() functions to create the custom
view. This custom view defines new filter criteria for the list.
{Create the custom view record for the 'High Revenue' view}
nStatus = CreateDefaultCustomViewRecord(IG_PROD_ID, LISTID_LEADS,
➥ "High Revenue", 1, viewID) of form syListViewObj;
554 IN T E G R AT I O N G U ID E
L I S T S C R I P T S E X I S T S ()
ExistsAsAction()
Description The ExistsAsAction() function in the syListViewCmdBarObj form verifies whether
a specific command exists as an action for the Action Pane of a list.
Parameters • ParentDictID – The ID of the dictionary that contains the command that is being
queried. Use the constant DYNAMICS to specify that you querying a command that
is defined in the Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command that is being queried.
• product_ID – The ID of the dictionary that contains the list for which a command is
being queried.
• list_ID – An integer specifying the ID of the list for which a command is being
queried.
• view_ID – An integer specifying the view for which the command is being queried.
Use the constant LIST_PRIMARYVIEWID to indicate the primary view for the list.
Return value A boolean. The value true indicates the command exists as an action for the list,
while false indicates it does not.
556 IN T E G R AT I O N G U ID E
L I S T S C R I P T S E X I S T S A S G R O U P ()
ExistsAsGroup()
Description The ExistsAsGroup() function in the syListViewCmdBarObj form verifies whether
a specific command list exists as a group for the Action Pane of a list.
Parameters • product_ID – The ID of the dictionary that contains the list for which a command list
is being queried.
• list_ID – An integer specifying the ID of the list for which a command list is being
queried.
• view_ID – An integer specifying the view for which the command list is being
queried. Use the constant LIST_PRIMARYVIEWID to indicate the primary view for
the list.
• ParentDictID – The ID of the dictionary that contains the command list that is being
queried. Use the constant DYNAMICS to specify that you querying a command list
that is defined in the Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that is being queried.
Return value A boolean. The value true indicates the command list exists as a group for the list,
while false indicates it does not.
Examples The following example examines whether the Actions group exists for the Action
Pane defined for the Leads card list defined in the sample integrating application.
exists = ExistsAsGroup(IG_PROD_ID,
1, {Leads card list}
LIST_PRIMARYVIEWID,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_ActionsGroup));
FactBoxParameter_Add
Description The FactBoxParameter_Add procedure in the syListObj form adds a value to the list
of values to be used for a parameter of a SQL Server Reporting Services report that
is displayed in a Business Analyzer for a list.
Parameters • list_object – The list object composite that manages the state information for the list.
This will have been passed into the procedure that is creating the parameter for use
by the report.
• parameter – A text field that contains the set of values for the parameter. A parameter
can contain one or more values.
• value – A string specifying the value to add to the list of values for the parameter.
Examples The following example is the LoadFactBoxParameters procedure for the Leads list
in the sample integrating application. It uses the FactBoxParameter_Add procedure
to build the set of Lead ID values to pass as a parameter to the reports displayed in
the Business Analyzer for the list. If only one row is selected, the parameter will
contain just one value. If multiple rows are marked in the list, the Lead ID of each
marked row will be added to the parameter. The List_SetFactBoxParameter
procedure makes the parameter value available to the report.
if fMultipleMarked then
{ Look through the list of marked leads, and add each one. }
get first table(tableRef);
nStatus = err();
while nStatus <> EOF do
call FactBoxParameter_Add of form syListObj, list_object, LeadParam,
➥ 'Lead ID' of table(tableRef), fMultipleMarked, fParamTooLong;
if fParamTooLong then
exit while;
end if;
558 IN T E G R AT I O N G U ID E
L I S T S C R I P T S F A C T B O X P A R A M E T E R _ A D D
nStatus = err();
end while;
else
{ Add only the selected lead. }
call FactBoxParameter_Add of form syListObj, list_object, LeadParam,
➥ 'Lead ID' of table(tableRef);
end if;
FindCommandInCmdList()
Parameters • product_ID – The ID of the dictionary that contains the list for which a command list
is being queried.
• list_ID – An integer specifying the ID of the list for which a command in the Action
Pane is being queried.
• view_ID – An integer specifying the view for which the command list is being
queried. Use the constant LIST_PRIMARYVIEWID to indicate the primary view for
the list.
• ParentDictID – The ID of the dictionary that contains the command list that is being
examined. Use the constant DYNAMICS to specify the Microsoft Dynamics GP
main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that is being examined.
• CmdDictID – The ID of the dictionary that contains the command whose location is
being examined.
• CmdFormID – The resource ID of the command form that contains the definition of
the command whose location is being examined.
Return value An integer that specifies the location (sequence number) of the specified command.
The value 0 indicates the item was not found in the command list.
Examples The following example uses the FindCommandInCmdList() function to retrieve the
location of the Remove Hold command that appears in the Action Pane for the
Customers list in Microsoft Dynamics GP.
local integer Seq;
560 IN T E G R AT I O N G U ID E
L I S T S C R I P T S G E T L I S T ID ()
GetListID()
Description The GetListID() function in the syListObj form retrieves the ID of the list currently
being displayed.
Syntax GetListID(list_object)
Parameters • list_object – The list object composite that manages the state information for the list.
Examples The following example retrieves the list ID for the current list.
GetMarkedRecordCount()
Description The GetMarkedRecordCount() function in the syListObj form retrieves the number
of rows marked for the list.
Syntax GetMarkedRecordCount(list_object)
Parameters • list_object – The list object composite that manages the state information for the list.
Examples The following example retrieves the number rows marked for the current list.
562 IN T E G R AT I O N G U ID E
L I S T S C R I P T S G E T M A R K E D R E C O R D S T A B L E I N D E X ()
GetMarkedRecordsTableIndex()
Description The GetMarkedRecordsTableIndex() function in the syListObj form retrieves the
number of the index used for the temporary table that contains the rows marked for
the list.
Syntax GetMarkedRecordsTableIndex(list_object)
Parameters • list_object – The list object composite that manages the state information for the list.
Examples The following example retrieves the reference to the temporary table that contains
the marked rows for the current list. It also retrieves the number of the index used
for the temporary table that contains the marked rows.
GetMarkedRecordsTableRef()
Description The GetMarkedRecordsTableRef() function in the syListObj form retrieves the
reference to the temporary table that contains the rows marked for the list.
Syntax GetMarkedRecordsTableRef(list_object)
Parameters • list_object – The list object composite that manages the state information for the list.
Return value A reference to the temporary table that contains the rows marked for the list.
Examples The following example retrieves the reference to the temporary table that contains
the marked rows for the current list. It also retrieves the number of the index used
for the temporary table that contains the marked rows.
564 IN T E G R AT I O N G U ID E
L I S T S C R I P T S G E T V I E W ID ()
GetViewID()
Description The GetViewID() function in the syListObj form retrieves the ID of the view for the
list currently being displayed.
Syntax GetViewID(list_object)
Parameters • list_object – The list object composite that manages the state information for the list.
Examples The following example retrieves the view ID for the current list.
InfoValue_ClearState()
Description The InfoValue_ClearState() function defined in the syListObj form is used to clear
a specific state value of the InfoValue column for a list. The InfoValue is a bitmask
field, with several states that are set and retrieved independently.
• state – The state which will be cleared for the Information Icon displayed for the list
item. The value is an integer that corresponds to one of the following constants:
Return value A boolean. The value true indicates the specific state value had already been
cleared. The value false indicates the specific state value was previously set, but is
now cleared.
Examples The following example clears the Error state for a variable used to set the
Information Icon for a list.
566 IN T E G R AT I O N G U ID E
L I S T S C R I P T S I N F O V A L U E _ I S S T A T E S E T ()
InfoValue_IsStateSet()
Description The InfoValue_IsStateSet() function defined in the syListObj form is used to verify
whether a specific state value of the InfoValue column for a list is set. The InfoValue
is a bitmask field, with several states that are set and retrieved independently.
• state – The state which will be examined for the Information Icon displayed for the
list item. The value is an integer that corresponds to one of the following constants:
Return value A boolean. The value true indicates the state is set, while the value false indicates it
is not.
Examples The following example examines the Note Attached state for the Information Icon
for a list.
InfoValue_SetState()
Description The InfoValue_SetState() function defined in the syListObj form is used to set the
value of the InfoValue column for a list. The InfoValue is a bitmask field, with
several states that are set and retrieved independently.
• state – The state which will be set and displayed by the Information Icon for the list
item. The value is an integer that corresponds to one of the following constants:
Return value A boolean indicating the state had previously been set. The value true indicates the
state had already been set, while the value false indicates it had not.
Comments While the InfoValue column can keep track of all the individual states, the
Information Icon in the list will display the icon for only the highest-priority state
that has been set.
Examples The following example sets two integer variables to states that are used to set the
InfoValue column for the Leads card list in the sample integrating application.
{Define the values to which the InfoValue column must be set for rows that
meet the criteria}
InfoValue_SetState(InfoValueInactive, INFOVALUE_CUSTOM1) of form syListObj;
InfoValue_SetState(InfoValueNote, INFOVALUE_NOTEATTACHED) of form syListObj;
568 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ F O R M A T B O O L E A N ()
List_FormatBoolean()
Description The List_FormatBoolean() function defined in the syListObj form is used to format
boolean values for list data displayed in the Information Pane, included in a report,
or exported to Microsoft Excel.
• use – An integer indicating where the formatted boolean is to be used. Based on the
intended use, the boolean will be formatted appropriately. The value corresponds to
one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Return value A string containing the formatted boolean value. The value true will be returned as
“Yes”. The value false will be returned as “No”.
Examples The following example formats a boolean value for use in the Information Pane.
List_FormatCurrency()
Description The List_FormatCurrency() function defined in the syListObj form is used to format
currency values for list data displayed in the Information Pane, included in a report,
or exported to Microsoft Excel.
• currency_index – A integer specifying the currency index to use for formatting. If the
currency index isn’t known, the number of decimal places can also be specified by
this parameter.
• use – An integer indicating where the formatted currency is to be used. Based on the
intended use, the currency will be formatted appropriately. The value corresponds
to one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Examples The following example formats a currency value for use in the Information Pane.
The value will have two decimal places and display the currency symbol.
570 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ F O R M A T D A T E ()
List_FormatDate()
Description The List_FormatDate() function defined in the syListObj form is used to format
date values for list data displayed in the Information Pane, included in a report, or
exported to Microsoft Excel.
• use – An integer indicating where the formatted date is to be used. Based on the
intended use, the date will be formatted appropriately. The value corresponds to
one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Examples The following example formats a date value for use in the Information Pane.
List_FormatInteger()
Description The List_FormatInteger() function defined in the syListObj form is used to format
integer or long integer values for list data displayed in the Information Pane,
included in a report, or exported to Microsoft Excel.
• use – An integer indicating where the formatted integer or long integer is to be used.
Based on the intended use, the value will be formatted appropriately. The value
corresponds to one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Return value A string containing the formatted integer or long integer value.
Examples The following example formats an integer value for use in the Information Pane.
572 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ F O R M A T P H O N E ()
List_FormatPhone()
Description The List_FormatPhone() function defined in the syListObj form is used to format
phone number values for list data displayed in the Information Pane, included in a
report, or exported to Microsoft Excel.
• use – An integer indicating where the formatted phone number is to be used. Based
on the intended use, the phone number will be formatted appropriately. The value
corresponds to one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Examples The following example formats a phone number for use in the Information Pane.
List_FormatQuantity()
Description The List_FormatQuantity() function defined in the syListObj form is used to format
quantity values for list data displayed in the Information Pane, included in a report,
or exported to Microsoft Excel.
• decimal_places – The 'Decimal Places QTYS' field (a drop-down list) specifying the
number of decimal places to use for the quantity.
• use – An integer indicating where the formatted quanitity value is to be used. Based
on the intended use, the quantity value will be formatted appropriately. The value
corresponds to one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Examples The following example formats a quantity value for use in the Information Pane.
574 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ F O R M A T S T R I N G ()
List_FormatString()
Description The List_FormatString() function defined in the syListObj form is used to format
string values for list data displayed in the Information Pane, included in a report, or
exported to Microsoft Excel.
• use – An integer indicating where the formatted string is to be used. Based on the
intended use, the string will be formatted appropriately. The value corresponds to
one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Examples The following example formats a string value for use in the Information Pane.
List_FormatTime()
Description The List_FormatTime() function defined in the syListObj form is used to format
time values for list data displayed in the Information Pane, included in a report, or
exported to Microsoft Excel.
• use – An integer indicating where the formatted time value is to be used. Based on
the intended use, the time will be formatted appropriately. The value corresponds
to one of the following constants:
Constant Description
LIST_FORMATFOR_EXCEL The value is being formatted for exporting to Excel.
LIST_FORMATFOR_PREVPANE The value is being formatted for display in the Information
Pane.
LIST_FORMATFOR_REPORT The value is being formatted for display in the report
generated from the list content.
Examples The following example formats a time value for use in the Information Pane.
576 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ G E T ID S F O R C O R E C O M M A N D
List_GetIDsForCoreCommand
Description The List_GetIDsForCoreCommand procedure defined in the
syListViewCmdBarObj form is used to retrieve the ID values for predefined
commands and groups that can be displayed in the Action Pane for a list.
Parameters • list_type – An integer that specifies the type of list from which a core command is
being retrieved. The value corresponds to one of the following constants:
Constant Description
LISTTYPE_CARD A card list.
LISTTYPE_TRX A transaction list.
• action_ID – A long integer specifying the item for which the ID information is being
retrieved. The value corresponds to one of the following constants:
Constant Description
LISTRIBBONGROUP_USERDEF1 The first user-defined group for the list.
LISTRIBBONGROUP_USERDEF2 The second user-defined group for the list.
LISTACTION_EXPORTTOEXCEL The action to export to Microsoft Excel.
LISTACTION_PRINTLIST The action to print the list content.
LISTRIBBONGROUP_RESTRICT The Restrictions group for the list.
LISTACTION_LISTRESTRICT The restriction drop-list for the list.
LISTACTION_DATERESTRICT The date restriction drop-list for the list.
• dict_ID – A returned integer containing the ID of the dictionary that defines the
command.
• form_ID – A returned integer containing the resource ID of the form that defines the
command.
Examples The following is a portion of the CreateListRibbonData procedure for the Leads
card list defined in the sample integrating application. This portion of the procedure
retrieves and adds the two user-defined groups that can be added to the action pane
for a list.
in ListDictID nListDictID;
in ListID nListID;
nListID,
LIST_PRIMARYVIEWID,
nGroupSeq,
nCmdDictID,
nCmdFormID,
nCmdID,
""{caption},
false{visible}) of form syListViewCmdBarObj;
578 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ M U L T I S E L E C T A C T I O N C O M P L E T E E V E N T
List_MultiSelectActionCompleteEvent
Description The List_MultiSelectActionCompleteEvent procedure of the syListObj form is
used to indicate that a multiselect action has finished processing.
Parameters • list_object – The list object composite that manages the state information for the list.
List_Open
Description The List_Open procedure defined in the syListObj form is used to open a list from
sanScript code. The list content can be displayed in the main Microsoft Dynamics
GP window or in a separate window.
This procedure must always be called with the background keyword to prevent conflicts
with other list code that may be running.
Parameters • list_dict_ID – An integer specifying the ID of the product that defines the list.
• view_ID – An integer specifying the view to use for the list. Typically, the constant
LIST_PRIMARYVIEWID is used to specify that the primary view is used.
Comments Microsoft Dynamics GP can display one card list, one trasaction list, and one report
list at a time. The lists can be in either the main Microsoft Dynamics GP window or
a separate window. Before you open a list using sanScript code, you must verify
that a list of that type is not already open.
You can use the optional restriction parameters for the List_Open procedure to pass
information to the list that specifies what data will be displayed in the list. If you
supply the restriction parameters, their values will be temporarily stored as
properties for the command associated with the list. You can retrieve the property
values using the Command_GetNamedProperty() function. The following table
lists the constants defined in the syListObj form that correspond to the named
properties that will be set for the command used for the list.
Constant Description
NAMEDPROP_RESTRICTIONTYPE The optional integer restriction parameter.
NAMEDPROP_RESTRICTIONSTRING1 The first string restriction parameter.
NAMEDPROP_RESTRICTIONSTRING2 The second string restriction parameter.
Typically, these restriction parameters are retrieved and used in the Refresh
procedure for the list being opened.
580 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ O P E N
Examples The following example opens the Sales Order Transactions list in a separate
window. The code examines whether a transaction list is already open before Sales
Order Transactions list is displayed. Notice that the List_Open procedure is called
with the background keyword.
List_RegisterAction()
Description The List_RegisterAction() function defined in the syListObj form is used to register
commands that appear in the action pane for a list. The commands must be
registered for them to be accessed by other list processing code.
Parameters • list_object – The list object (composite) that specifies characteristics for the list. This
value will have been passed into the procedure that is registering actions for the list.
• command – The command resource that is being registered for the list’s action pane.
• command_type – A constant that specifies the conditions under which the command
will be active on the action pane. The value corresponds to one of the following
constants:
Constant Description
LISTCMDTYPE_SINGLESELECT The action is available when only one item is selected in
the list.
LISTCMDTYPE_MULTISELECT The action is available when one or more items is selected
in the list.
LISTCMDTYPE_ALWAYSAVAILABLE The action is always available.
• action – A long integer value that specifies the action that will be performed for each
of the items selected in the list. Typically, this value is a constant that was defined
for the specific list action.
Return value A long integer containing the index of the registered command.
Examples The following example is a portion of the RegisterCommands procedure for the
Leads list in the sample integrating application. This example registers the
“Actions” group and the QualifyLead command. The constant named
ACTION_QUALIFYLEAD has been defined to indentify the action that is being
performed.
582 IN T E G R AT I O N G U ID E
L I S T S C R I P T S L I S T _ R E G I S T E R G R O U P ()
List_RegisterGroup()
Description The List_RegisterGroup() function defined in the syListObj form is used to register
command lists that appear as groups in the action pane for a list. The command lists
must be registered for them to be accessed by other list processing code.
Parameters • list_object – The list object (composite) that specifies characteristics for the list. This
value will have been passed into the procedure that is registering groups for the list.
• command_list – The command list resource that is being registered as a group for the
list’s action pane.
Return value A long integer containing the index of the registered command list.
Examples The following example is a portion of the RegisterCommands procedure for the
Leads list in the sample integrating application. This example registers the
“Actions” group defined by the CL_ActionsGroup command list.
List_SetFactBoxParameter
Description The List_SetFactBoxParameter procedure in the syListObj form sets the value of a
specified parameter for the SQL Server Reporting Services reports displayed in the
Business Analyzer for a list.
Parameters • list_object – The list object (composite) that specifies characteristics for the list. This
value will have been passed into the procedure that is setting the report parameter.
584 IN T E G R AT I O N G U ID E
L I S T S C R I P T S R E G I S T E R L I S T N A V I G A T I O N C O M M A N D ()
RegisterListNavigationCommand()
Description The RegisterListNavigationCommand() function defined in the syListObj form
registers the command that opens a list. The command must be added to one of the
command lists used for the Navigation Pane.
• form_dict_ID – The ID of the dictionary that contains the form used to define the list
characteristics.
• form_ID – The resource ID of the form that defines the list characteristics.
• sublist – An integer specifying the sublist to be displayed. The sublist is used when a
single list form is used to display different sets of information. The sublist value
indicates to the list which set of information to display. In the list processing code,
the sublist specified by this parameter can be retrieved using the SubList
component of the ListObjState composite. If no sublist is being used, specify the
value 0.
• list_type – An integer specifying the type of list being registered. The value
corresponds to one of the following constants:
Constant Description
LISTTYPE_CARD A card list
LISTTYPE_TRX A transaction list
• parent_command – The command list for the Navigation Pane into which the
command being registered had been added.
Return value A boolean. The value true indicates the navigation command was registered
successfully, while the value false indicates it was not.
Examples The following example is a form pre script for a command form that defines a
command to open the Leads list. The script registers the Leads list, which was
added to the Sales command list in the Navigation Pane. The value “1” is assigned
as the ID for the list.
XMLDoc_AddColumn
Description The XMLDoc_AddColumn procedure of the syListObj form adds a column to the
end of the set of line items for the current Information Pane.
Parameters • XML_state – A field of the type ListPrevPaneXMLState that contains the state
information for the Information Pane XML document.
• right_align – An optional boolean. The value true indicates the name will be right-
aligned, while the value false indicates the value will be left-aligned. The default is
left-aligned.
Examples The following trigger processing procedure adds the Company column to the end
of the set of line items for the Account Transaction list.
in integer nTrxType;
inout ListPrevPaneXMLState XMLState;
586 IN T E G R AT I O N G U ID E
L I S T S C R I P T S X M LD O C _ A D D H E A D E R F I E L D
XMLDoc_AddHeaderField
Description The XMLDoc_AddHeaderField procedure of the syListObj form adds a value to the
end of the specified column in the header for the current Information Pane.
Parameters • XML_state – A field of the type ListPrevPaneXMLState that contains the state
information for the Information Pane XML document.
• prompt – A string specifying the prompt to display for the value being added to the
end of the column.
• value – A string specifying the value to add to the end of the column.
• column – An integer specifying which column to add the value to. The value can be
1, 2, or 3.
{Address}
sValue = 'Address 1' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "Address", sValue, 1;
sValue = 'Address 2' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "", sValue, 1;
XMLDoc_AddLineItem
Description The XMLDoc_AddLineItem procedure of the syListObj form adds a new line item
to the current Information Pane.
Parameters • XML_state – A field of the type ListPrevPaneXMLState that contains the state
information for the Information Pane XML document.
• row_element – A returned reference value for the new line item that was added. This
value is used by the XMLDoc_AddLineItemValue procedure when values are
added to the line.
588 IN T E G R AT I O N G U ID E
L I S T S C R I P T S X M LD O C _ A D D L I N E I T E M V A L U E
XMLDoc_AddLineItemValue
Description The XMLDoc_AddLineItemValue procedure of the syListObj form adds a column
value to the end of the current line item row in the Information Pane.
Parameters • XML_state – A field of the type ListPrevPaneXMLState that contains the state
information for the Information Pane XML document.
• row_element – A reference to the current row element to which a line item value is
being added.
• right_align – An optional boolean. The value true indicates the value will be right-
aligned, while the value false indicates the value will be left-aligned. The default is
left-aligned.
• URL – An optional string. The value specifies the URL to associate with the item
being added.
Examples The following trigger processing procedure adds the company information to the
end of the current line item row in the Information Pane for the Account
Transactions list.
XMLDoc_Create
Description The XMLDoc_Create procedure of the syListObj form starts the process of creating
the content for the Information Pane displayed by a list.
Parameters • XML_state – A returned field of the type ListPrevPaneXMLState that contains the
state information for the Information Pane XML document. This value will be used
by the other procedures used to define Information Pane content.
• XML_file_path – A string that specifies the file path where the XML document used
for the Information Pane will be created. Use the value passed into the
GeneratePreviewPaneXML procedure defined for the list.
• title – A string specifying the title to display for the Information Pane.
Examples The following is the complete GeneratePreviewPaneXML procedure defined for the
Leads card list in the sample integrating application. It uses the XMLDoc_Create
procedure to start the process of creating the XML content to be displayed in the
Information Pane. After the content has been specified, the XMLDoc_Save
procedure is called to complete the process.
{Get the reference for the temporary table used by the list}
Leads_MSTR_Temp = list_object:'Table Reference';
{--Column 1--}
{Address}
sValue = 'Address 1' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "Address", sValue, 1;
sValue = 'Address 2' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "", sValue, 1;
590 IN T E G R AT I O N G U ID E
L I S T S C R I P T S X M L D O C _ C R E A T E
{Phone 1}
call GetColumnName of form ListObj_Leads, resourceid(field 'Phone 1'), 0,
➥ sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Phone 1'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;
{Phone 2}
call GetColumnName of form ListObj_Leads, resourceid(field 'Phone 2'), 0,
➥ sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Phone 2'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;
{Fax}
call GetColumnName of form ListObj_Leads, resourceid(field 'Fax'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Fax'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;
{--Column 2--}
{Lead Category}
call GetColumnName of form ListObj_Leads, resourceid(field 'Lead Business
➥ Category'), 0, sName;
sValue = itemname('Lead Business Category' of window State, 'Lead Business
➥ Category' of table(Leads_MSTR_Temp));
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;
{Contact}
call GetColumnName of form ListObj_Leads, resourceid(field 'Contact'), 0,
➥ sName;
sValue = 'Contact' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;
{Potential Revenue}
call GetColumnName of form ListObj_Leads, resourceid(field 'Potential
➥ Revenue'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Potential Revenue'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;
{--Column 3--}
{Qualified Lead}
call GetColumnName of form ListObj_Leads, resourceid(field 'Qualified Lead'),
➥ 0, sName;
sValue = itemname('Qualified Lead' of window State, 'Qualified Lead' of
➥ table(Leads_MSTR_Temp));
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;
{Qualification Date}
call GetColumnName of form ListObj_Leads, resourceid(field 'Qualification
➥ Date'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field
➥ 'Qualification Date'), 0, 1, sValue, iAlignment;
{Source}
call GetColumnName of form ListObj_Leads, resourceid(field 'Lead Source'), 0,
➥ sName;
sValue = 'Lead Source' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;
592 IN T E G R AT I O N G U ID E
L I S T S C R I P T S X M LD O C _ S A V E
XMLDoc_Save
Description The XMLDoc_Save procedure of the syListObj form completes the process of
creating the content for the Information Pane displayed by a list.
Parameters • XML_state – A field of the type ListPrevPaneXMLState that contains the state
information for the Information Pane XML document.
• AddCommandToMenu()
• AddNavBarButton()
• AlreadyExistsOnMenu()
• FindCommandInMenu()
• MenusExistForProduct()
AddCommandToMenu()
Parameters • ParentDictID – The ID of the dictionary that contains the command list (menu or
submenu) to which the new command will be added. Use the constant DYNAMICS
to specify that you are adding items to the Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list to which you are adding a command.
• ParentCmdID – The resource ID of the command list to which you are adding a
command.
• Sequence – An integer variable that can be used to specify the sequence of the item in
the command list. The value 0 specifies the command will be added to the end of
the list. The actual position of the command will be returned after the command is
added.
• CmdDictID – The ID of the dictionary that contains the command you are adding.
• CmdFormID – The resource ID of the command form that contains the definition of
the command you are adding.
• CloneCmd – A boolean parameter. The value true specifies that the command will be
added for all users, while the value false specifies that the command will be added
for only the current user.
• LoadMode – An integer that specifies where the command will be added. The value
corresponds to one of the following constants:
Constant Description
MENULOAD_TOTABLE The menu items are being added to the default menu set
in the syMenuMstr table.
MENULOAD_TOMEMORY The menu items are being added directly to the menu set
displayed in Microsoft Dynamics GP.
Return value An integer indicating whether the command was added to the menu. The value
corresponds to one of the following constants:
Constant Description
OKAY The command was successfully added.
DUPLICATE The command was not added because it already exists.
Comments When you add your menu items, we recommend that you add them to the end of
the menu or submenu. You should also consider using a separator to separate your
items from the default items.
596 IN T E G R AT I O N G U ID E
M E N U S C R I P T S A D D C O M M A N D T O M E N U ()
To add a separator to a menu, use the following constants to specify the built-in
separator command:
Constant Description
CMD_BUILTINCMD_DICTID Specifies the ID of the dictionary that contains the
separator built-in command.
CMD_BUILTINCMD_FORMID Specifies the resource ID of the form that defines
the separator built-in command.
cmdSeparator The built-in separator command.
AddNavBarButton()
Description The AddNavBarButton() function defined for the syNavBarBtnObj form adds a
button to the Navigation pane.
Parameters • UserID – A string that specifies to which user’s set of menus the button will be
added. Specify the empty string ("") to add to the default set of menus.
• Sequence – An integer variable that specifies the position of the button in the
Navigation pane. The value 0 specifies the button will be added to the end of the
list. The actual position of the button will be returned after it is added.
You should always specify the value 0 for this variable to add the new Navigation pane
button to the end of the list.
• Visible – A boolean that specifies whether the button is visible in the Navigation
pane. The value true specifies the button is visible, while the value false specifies
that it is not.
• CmdDictID – The ID of the dictionary that contains the command to use for the
Navigation pane button.
• CmdFormID – The resource ID of the command form that contains the definition of
the command to be added to the Navigation pane.
• CloneCmd – A boolean parameter. The value true specifies that the command will be
added for all users, while the value false specifies that the command will be added
for only the current user. You should always specify the value true when adding a
new Navigation pane button.
Return value An integer indicating whether the command was added to the menu. The value
corresponds to one of the following constants:
Constant Description
OKAY The button was successfully added.
DUPLICATE The button was not added because it already exists.
{Find out whether the Navigation pane categories for this product have already
been added}
sWhere = physicalname('CmdParentDictID' of table syNavBarButtons) + CH_SPACE
➥ + CH_EQUAL + CH_SPACE + str(IG_PROD_ID);
598 IN T E G R AT I O N G U ID E
M E N U S C R I P T S A D D N A V B A R B U T T O N ()
nSeq = 0;
AlreadyExistsOnMenu()
Parameters • UserID – A string that specifies which user’s set of menus will be examined to find
out whether the menu item exists. Specify the empty string ("") to examine the
default set of menus.
• ParentDictID – The ID of the dictionary that contains the command list (menu or
submenu) that is being examined. Use the constant DYNAMICS to specify the
Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that is being examined.
• CmdDictID – The ID of the dictionary that contains the command whose existance is
being examined.
• CmdFormID – The resource ID of the command form that contains the definition of
the command whose existance is being examined.
• Sequence – An optional integer variable that can be used to retrieve the sequence of
the item in the command list, if the item exists. The value 0 indicates the item does
not exist.
Return value The function returns a boolean. The value true indicates the command already
exists on the menu, while the value false indicates it does not.
if AlreadyExistsOnMenu("", DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Cards of form Command_Sales),
3333,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Maintenance of form Command_IG_Sample),
➥ Seq) of form syMenuObj = true then
600 IN T E G R AT I O N G U ID E
M E N U S C R I P T S F I N D C O M M A N D I N M E N U ()
FindCommandInMenu()
Parameters • ParentDictID – The ID of the dictionary that contains the command list (menu or
submenu) that is being examined. Use the constant DYNAMICS to specify the
Microsoft Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that is being examined.
• CmdDictID – The ID of the dictionary that contains the command whose location is
being examined.
• CmdFormID – The resource ID of the command form that contains the definition of
the command whose location is being examined.
• LoadMode – An integer that specifies which set of menus is being examined. The
value corresponds to one of the following constants:
Constant Description
MENULOAD_TOTABLE The menu set in the syMenuMstr table is being examined.
MENULOAD_TOMEMORY The menu set displayed in Microsoft Dynamics GP is
being examined.
• UserID – An optional string that specifies which user’s set of menus will be
examined to find the position of the menu item. Specify the empty string ("") to
examine the default set of menus.
Return value An integer that specifies the location (sequence number) of the specified menu item.
The value 0 indicates the item was not found in the menu or submenu.
Examples The following example uses the FindCommandInMenu() function to retrieve the
location of the ListObj_Salespeople (Salesperson) command that appears in the
Sales Lists menu.
Seq = FindCommandInMenu(DYNAMICS,
resourceid(form Command_System),
resourceid(command CL_Sales_Lists of form Command_System),
DYNAMICS,
resourceid(form Command_Sales),
resourceid(command ListObj_Salespeople of form Command_Sales),
LoadMode,
"");
MenusExistForProduct()
Syntax MenusExistForProduct(Product_ID)
Parameters • Product_ID– The ID of the dictionary for which default menu items will be
examined.
Return value A boolean. The value true indicates that default menu items exist for the product,
while false indicates they do not.
602 IN T E G R AT I O N G U ID E
Report scripts
The following scripts are used when working with reports and report templates for
an integrating application:
• syImportReportTemplate()
• syRemoveReportTemplate()
syImportReportTemplate()
Parameters • display_name – A string specifying the display name of the report. Typically, this is
the same name as the report template document being imported, but without the
.docx file extension.
• product_ID – The product ID of the dictionary that contains the report for which a
report template is being imported.
• resource_ID – An integer specifying the resource ID for the report for which a report
template is being imported.
• report_type – An integer specifying the type of report for which a report template is
being imported. The following table lists the possible values:
Value Description
1 Original report
2 Modified report
3 Alternate report
4 Modified alternate report
• filename – A string specifying the complete path and filename for the report
template document. The path must be in native format.
• replace – A boolean. The value true indicates that any existing report template with
the same name should be replaced.
• series_dictionary_ID – The dictionary that defines the series. Set this to the product
ID of the dictionary that contains the report definition for which a template is being
imported.
• series – An integer specifying the series the report is included in. The series values
are listed in the following table.
Series Value
Financial 1
Sales 2
Purchasing 3
Inventory 4
Payroll 5
Project 6
System 7
Company 8
3rd Party 10
604 IN T E G R AT I O N G U ID E
R E P O R T S C R I P T S S Y I M P O R T R E P O R T T E M P L A T E ()
Return value An integer indicating the status. The value corresponds to one of the following
constants:
Constant Description
TEMPLATE_OKAY The template was successfully imported.
TEMPLATE_INVALID The template is not valid or cannot be found.
TEMPLATE_EXISTS The template already exists.
TEMPLATE_NOREPLACE A default template is already installed and cannot be replaced.
syRemoveReportTemplate()
Parameters • product_ID – The product ID of the dictionary that contains the report for which a
report template is being removed.
• resource_ID – An integer specifying the resource ID for the report for which a report
template is being removed.
• display_name – A string specifying the display name of the report for which a report
template is being removed. This name must match the display name that was used
when the report template was imported into Microsoft Dynamics GP.
Return value An integer indicating the status. The value corresponds to one of the following
constants:
Constant Description
TEMPLATE_OKAY The template was successfully removed.
TEMPLATE_INVALID The template could not be found.
TEMPLATE_ISDEFAULT The template was pre-defined and cannot be removed.
TEMPLATE_ISASSIGNED The template is assigned to a company and cannot be
removed.
606 IN T E G R AT I O N G U ID E
Security scripts
The following scripts are used when implementing security features for an
integrating application:
• AddSecurityTaskOperation()
• AddTaskToRole()
• CreateSecurityRole()
• CreateSecurityTask()
• DeleteSecurityForProduct()
• Exists() -- Security Role
• Exists() -- Security Task
• Exists() -- Security Task Operation
• Exists() -- Security Task Role
• GetValidSystemPassword()
• LoadListView
• Security()
• SetIndex
• syUserInRole()
AddSecurityTaskOperation()
Parameters • task_ID – A string specifying the ID of the task to which an operation is being
added.
• dict_ID – An integer specifying the ID of the dictionary that contains the resource
for which a security operation is being added.
Contant Value
TABLETYPE 1
FORMTYPE 2
REPORTTYPE 23
SECURITYTYPE_LISTS 900
SECURITYTYPE_SMARTLISTOBJECT 1000
• security_ID – A long integer identifying the resource for which a security operation
is being added. The following table describes the value to use for each security
resource type:
Return value An integer indicating whether the operation was added to the security task. The
value corresponds to one of the following constants:
Constant Description
OKAY The operation was added successfully
DUPLICATE The operation already exists
Comments To build the security ID for a list, use the BuildDictSpecificID() function. The
following constants are defined for the portions of the list for which security can be
controlled:
Constant Description
LISTSECURITYTYPE_LIST The base list
LISTSECURITYTYPE_PREVPANE The information pane for the list
LISTSECURITYTYPE_CUSTOMIZE The customization capability for the list
Use one of these constants as the product ID (first parameter) for the
BuildDictSpecificID() function. Use the unique integer identifier you assigned to
the list as the action (second parameter).
604 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S A D D S E C U R I T Y T A S K O P E R A T I O N ()
Examples The following is a portion of the IG_CreateSecurityData prodcure for the sample
integrating application. It adds security operations to the CART_IGSAMPLE_01
task. A form operation, table operation, report operation, the various list operations,
and a SmartList operation are added to the security task.
local long status;
local string taskID;
taskID = "CARD_IGSAMPLE_01";
{Leads report}
status = AddSecurityTaskOperation(taskID,
IG_PROD_ID,
REPORTTYPE,
resourceid(report IG_Leads))
of form sySecurityTaskOperations;
{Leads SmartList}
status = AddSecurityTaskOperation(taskID,
SMARTLIST,
1000, {Use constant SECURITYTYPE_SMARTLISTOBJECT in GP 10 SP1 and later}
BuildDictSpecificID(IG_PROD_ID, SMARTLIST_OBJECTTYPE_LEADS))
of form sySecurityTaskOperations;
606 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S A D D T A S K T O R O L E ()
AddTaskToRole()
Description The AddTaskToRole() function of the sySecurityTaskRole form adds a task to the
specified security role.
Parameters • role_ID – A string specifying the ID of the security role to which a task is being
added.
Return value An integer indicating whether the task was added to the security role. The value
corresponds to one of the following constants:
Constant Description
OKAY The task was added successfully
DUPLICATE The task already exists
Examples The following example adds the CARD_IGSAMPLE_01 security task to the LEAD
GENERATION security role.
CreateSecurityRole()
• role_name – A string specifying the name displayed for the security role.
Return value An integer indicating whether the security role was added. The value corresponds
to one of the following constants:
Constant Description
OKAY The security role was added successfully
DUPLICATE The security role already exists
Examples The following example adds the LEAD GENERATION role for the sample
integrating application.
608 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S C R E A T E S E C U R I T Y T A S K ()
CreateSecurityTask()
Parameters • task_ID – A string specifying the ID of the security task that is being created.
• task_name – A string specifying the name displayed for the security task.
• category – An integer specifying the category for the security task. Use one of the
following constants, defined in the sySecurityRoleEntry form:
Constant Description
CATEGORY_COMPANY Company
CATEGORY_FINANCIAL Financial
CATEGORY_INVENTORY Inventory
CATEGORY_OTHER Other
CATEGORY_PAYROLL Payroll
CATEGORY_PROJECT Project
CATEGORY_PURCHASING Purchasing
CATEGORY_SALES Sales
CATEGORY_SYSTEM System
Return value An integer indicating whether the security task was added. The value corresponds
to one of the following constants:
Constant Description
OKAY The security task was added successfully
DUPLICATE The security task already exists
Examples The following example adds the CARD_IGSAMPLE_01 security task used for the
sample integrating application. The new security task is part of the Sales category.
taskID = "CARD_IGSAMPLE_01";
status = CreateSecurityTask(taskID, {ID}
"Maintain leads", {Name}
"Maintain lead information and setup.", {Description}
CATEGORY_SALES of form sySecurityRoleEntry)
of form sySecurityTask;
DeleteSecurityForProduct()
Description The DeleteSecurityForProduct() function removes the security task operations and
the modified/alternate forms and reports settings for the specified product.
Syntax DeleteSecurityForProduct(dict_ID)
Parameters • dict_ID – An integer specifying the ID of the dictionary for which the security
information is being deleted.
Return value A boolean. The value true indicates the security data was removed, while the value
false indicates it was not.
Examples The following example removes the security data for the sample integrating
application.
result = DeleteSecurityForProduct(IG_PROD_ID);
610 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S E X I S T S ( ) -- S E C U R I T Y R O L E
Description The Exists() function of the sySecurityRole form verifies whether the specified
security role exists in Microsoft Dynamics GP.
Syntax Exists(role_ID)
Return value A boolean. The value true indicates the security role exists, while the value false
indicates it does not.
Examples The following example uses the Exists() function to indicate whether the LEAD
GENERATION security role exists. If it does not, the role is added.
Description The Exists() function of the sySecurityTask form verifies whether the specified task
exists in Microsoft Dynamics GP.
Syntax Exists(task_ID)
Return value A boolean. The value true indicates the security task exists, while the value false
indicates it does not.
Examples The following example uses the Exists() function to indicate whether the
CARD_IGSAMPLE_01 security task exists. If it does not, the security task is added.
taskID = "CARD_IGSAMPLE_01";
if Exists(taskID) of form sySecurityTask = false then
{Task does not exist, so create it}
status = CreateSecurityTask(taskID, {ID}
"Maintain leads", {Name}
"Maintain lead information and setup.", {Description}
CATEGORY_SALES of form sySecurityRoleEntry)
of form sySecurityTask;
end if;
612 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S E X I S T S ( ) - - S E C U R I T Y T A S K O P E R A T I O N
Description The Exists() function of the sySecurityTaskOperations form verifies whether the
specified security task operation exists in Microsoft Dynamics GP.
Parameters • task_ID – A string specifying the ID of the task which could contain the specified
operation.
• dict_ID – An integer specifying the ID of the dictionary that contains the resource
for the security operation.
• security_ID – A long integer identifying the resource for the security operation. The
following table describes the value to use for each security resource type:
Contant Value
TABLETYPE 1
FORMTYPE 2
REPORTTYPE 23
SECURITYTYPE_LISTS 900
Return value A boolean. The value true indicates the security task operation exists, while the
value false indicates it does not.
Comments To build the security ID for a list, use the BuildDictSpecificID() function. The
following constants are defined for the portions of the list for which security can be
controlled:
Constant Description
LISTSECURITYTYPE_LIST The base list
LISTSECURITYTYPE_PREVPANE The information pane for the list
LISTSECURITYTYPE_CUSTOMIZE The customization capability for the list
Use one of these constants as the product ID (first parameter) for the
BuildDictSpecificID() function. Use the unique integer identifier you assigned to
the list as the action (second parameter).
Examples The following example verifies whether the security task operation for access to the
base functionality of the Leads list exists for the sample integrating application. The
ID for the Leads lists is 1.
taskID = "CARD_IGSAMPLE_01";
if Exists(taskID,
IG_PROD_ID,
BuildDictSpecificID(LISTSECURITYTYPE_LIST, 1),
SECURITYTYPE_LISTS) of form sySecurityTaskOperations = false then
warning "Security task operation does not exist for the Leads list.";
end if;
614 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S E X I S T S ( ) - - S E C U R I T Y T A S K R O L E
Return value A boolean. The value true indicates the security task exists for the security role,
while the value false indicates it does not.
Examples The following example verifies whether the security task CARD_IGSAMPLE_01
has been added to the LEAD GENERATION security role.
taskID = "CARD_IGSAMPLE_01";
roleID = "LEAD GENERATION";
if Exists(roleID, taskID) of form sySecurityTaskRole = false then
warning "Security task does not exist for the LEAD GENERATION role.";
end if;
GetValidSystemPassword()
Description The GetValidSystemPassword() function prompts the current user to enter the
system password defined when Microsoft Dynamics GP was installed. The value
true or false is returned, depending on whether the correct password was supplied.
Syntax GetValidSystemPassword()
Parameters • None
Return value A boolean. The value true indicates the correct system password was supplied,
while false indicates that it was not.
Examples The following example is the form pre script for the IG_Sample_Setup form. It uses
the GetValidSystemPassword() function to prompt the user for the system
password before opening a setup window for the sample integrating application.
result = GetValidSystemPassword();
616 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S L O A D L I S T V I E W
LoadListView
Description The LoadListView procedure defined for the sySecurityTaskEntry form is used to
add a security operation to the list of operations for that type that are displayed in
the Security Task Setup window in Microsoft Dynamics GP.
Parameters • operation – A string containing the name of the operation being added to the list.
• operation_ID – An integer specifying the ID of the operation being added to the list.
• security_type – An integer specifying the security type that contains the operation
being added.
• dict_ID – An integer specifying the dictionary that defines the security type and
operation.
• accessible – A boolean. The value true specifies the operation is marked and will be
accessible to the task. The value false specifies the operation is unmarked and will
not accessible to the task.
Security()
Description The Security() function is used to verify whether the current user has access to the
specified resource.
Parameters • product_ID – An integer specifying the ID of the product that contains the item for
which security is being examined. This must be an integer variable. If an alternate
version of a form or report is being used, the product ID of the dictionary containing
the alternate version being used will be returned to this parameter.
• restype – An integer that specifies what type of item is being examined. The value
corresponds to one of the following constants:
Constant Description
FORMTYPE A form
REPORTTYPE A report
TABLETYPE A table
• item_ID – An integer specifying the resource ID of the item for which security is
being examined.
Return value An integer. The value 0 indicates the user has access, while the value corresponding
to the constant REJECT_RECORD indicates they do not.
Examples The following script examines the IG_Contact_History form to verify that the
current user has access. Notice that a local variable containing the product ID is
passed into the function.
local integer dict_ID = 3333;
local integer result;
The following script examines the security status of the Account_Lookup form in
the Dynamics dictionary to find out whether an alternate version of the form is
being used. If an alternate form is being used, the product ID for the dictionary is
returned and displayed.
local integer dict_ID;
local integer result;
dict_ID = 0;
result = Security(dict_ID, FORMTYPE, resourceid(form Account_Lookup));
if result = 0 then
if dict_ID = 0 then
{Acess to the original version}
warning "Access to Original";
else
{Access to an alternate version}
warning "Access to alternate in dictionary with ID: " + str(dict_ID);
end if;
else
warning "Access denied.";
end if;
618 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S S E T I N D E X
SetIndex
Description The SetIndex procedure defined for the sySecurityTaskOperations form is used to
specify a security operation that will be examined for its current status. The
procedure is used when an integration defines a new security type, and the
operations for that type are displayed in the Security Task Setup window in
Microsoft Dynamics GP.
• task_ID – The ID for the current task. This is typically the 'Security Task ID' field in
the syTaskEntry winow of the sySecurityTaskEntry form.
• dict_ID – An integer specifying the dictionary that defines the security type and
operations.
• security_type – An integer specifying the security type that contains the operations.
Examples The following example is the trigger processing procedure that runs when the
operations for a security task are to be displayed in the Security Task Setup window.
The procedure uses the SetIndex procedure to specify the operation to be added to
the list. The operation is examined, and the status information is used to control
how the LoadListView procedure adds the operation to the list.
in integer dict_ID;
in integer security_type;
in integer security_series;
if security_series = 1 then
{Look up the security status of each item as it is added, so
that the marked or unmarked state can be set}
➥ sySecurityTaskEntry,
IG_PROD_ID,
101,
security_type;
if security_series = 2 then
{Series 2 Item 1 -- ID is 201}
call SetIndex of form sySecurityTaskOperations,
TaskOperationsState,
'Security Task ID' of window syTaskEntry of form
➥ sySecurityTaskEntry,
IG_PROD_ID,
201,
security_type;
620 IN T E G R AT I O N G U ID E
S E C U R I T Y S C R I P T S S E T I N D E X
syUserInRole()
Description The syUserInRole() function is used to find whether a user is assigned to specific
server or database roles for SQL Server.
• role – A string specifying the role being examined. Use one of the following
constants:
Constant Description
ROLE_SYSADMIN Members of the sysadmin fixed server role can perform any
activity in the database.
ROLE_SECURITYADMIN Members of the securityadmin fixed server role manage
logins and their properties. They can GRANT, DENY, and
REVOKE server-level permissions. They can also GRANT,
DENY, and REVOKE database-level permissions. Additionally,
they can reset passwords for SQL Server logins.
ROLE_DBCREATOR Members of the dbcreator fixed server role can create, alter,
drop, and restore any database.
ROLE_DBOWNER* Members of the db_owner fixed database role can perform all
configuration and maintenance activities on the database.
ROLE_DBACCESSADMIN* Members of the db_accessadmin fixed database role can add
or remove access for Windows logins, Windows groups, and
SQL Server logins.
ROLE_DBSECURITYADMIN* Members of the db_securityadmin fixed database role can
modify role membership and manage permissions.
ROLE_DBBACKUPOPERATOR* Members of the db_backupoperator fixed database role can
backup the database.
*Requires the database to be specified
• database – An optional string parameter specifying the database for which access is
being examined. This parameter must be supplied when querying whether a user is
assigned to a specific role for the database.
Return value A boolean. The value true indicates the user is in the specified role, while false
indicates the user is not.
Comments The 'User ID' global variable contains the user ID for the user currently logged into
Microsoft Dynamics GP. The 'Intercompany ID' global variable contains the
database name for the current company’s database.
Examples The following example verifies whether the current user logged into Microsoft
Dynamics GP is assigned to the “sysadmin” role.
if syUserInRole('User ID' of globals, ROLE_SYSADMIN) then
warning "User is System Administrator";
end if;
The following example verifies whether the current user logged into Microsoft
Dynamics GP is assigned to the “dbowner” role for the current company.
if syUserInRole('User ID' of globals, ROLE_DBOWNER, 'Intercompany ID' of
➥ globals) then
warning "User is DB Owner";
end if;
622 IN T E G R AT I O N G U ID E
Shortcut scripts
The following form-level functions are used by integrating applications to add
shortcuts to the Navigation pane:
• ScBar_AddDexForm()
• ScBar_AddExternalFile()
• ScBar_AddFolder()
• ScBar_AddMacro()
• ScBar_AddUrl()
• ScBar_ItemExists
ScBar_AddDexForm()
Description The ScBar_AddDexForm() function adds a Dexterity-based form from the specified
dictionary to the Shortcut Bar.
Parameters • type – An integer indicating whether the shortcut is being added for a specific user
or for a specific user class. Use one of the following constants (which are part of the
syScBarObj form):
Constant Description
scgPERSONAL The shortcut is being added for a specific user.
scgUSERCLASS The shortcut is being added for a specific user class.
• name – A string specifying the user name or user class to which the shortcut is being
added.
• parent_ID – An integer indicating the parent node to which the shortcut will be
added. The value 0 indicates the root level.
• shortcut_display_name – A string containing the text that will be used for the
shortcut.
• resource_ID – A integer specifying the resource ID of the form for which the shortcut
is being added. You can use the Resource_GetID() function in Dexterity to retrieve
the ID of a specific form in your dictionary.
• product_ID – The product ID of the dictionary that contains the form for which the
shortcut is being created.
Return value A boolean. True indicates the shortcut was successfully added, while false indicates
it was not.
Examples The following example adds a shortcut for the Lead Maintenance form from the
sample integration application. This shortcut will be available only for
LESSONUSER1.
local boolean result;
local integer res_id;
624 IN T E G R AT I O N G U ID E
S H O R T C U T S C R I P T S S C B A R _ A D D E X T E R N A L F I L E ()
ScBar_AddExternalFile()
Description The ScBar_AddExternalFile() function adds a shortcut for an external file to the
Shortcut Bar.
Parameters • type – An integer indicating whether the shortcut is being added for a specific user
or for a specific user class. Use one of the following constants (which are part of the
syScBarObj form):
Constant Description
scgPERSONAL The shortcut is being added for a specific user.
scgUSERCLASS The shortcut is being added for a specific user class.
• name – A string specifying the user name or user class to which the shortcut is being
added.
• parent_ID – An integer indicating the parent node to which the shortcut will be
added. The value 0 indicates the root level.
• shortcut_display_name – A string containing the text that will be used for the
shortcut.
• filename – A string specifying the complete path to the file. The path must be in
native format.
Return value A boolean. True indicates the shortcut was successfully added, while false indicates
it was not.
Examples The following example adds a shortcut for the Notepad application. This shortcut
will be available only for LESSONUSER1.
ScBar_AddFolder()
Description The ScBar_AddFolder() function adds a folder to the Shortcut Bar. Folders are used
for grouping items in the Shortcut Bar.
Parameters • type – An integer indicating whether the folder is being added for a specific user or
for a specific user class. Use one of the following constants (which are part of the
syScBarObj form):
Constant Description
scgPERSONAL The folder is being added for a specific user.
scgUSERCLASS The folder is being added for a specific user class.
• name – A string specifying the user name or user class to which the folder is being
added.
• parent_ID – An integer indicating the parent node to which the folder will be added.
The value 0 indicates the root level.
• folder_name – A string containing the text that will be used for the folder name.
Examples The following example adds a folder named “Sample” to the Shortcut Bar. This
folder will be available only for LESSONUSER1.
626 IN T E G R AT I O N G U ID E
S H O R T C U T S C R I P T S S C B A R _ A D D M A C R O ()
ScBar_AddMacro()
Description The ScBar_AddMacro() function adds a shortcut for a macro to the Shortcut Bar.
Parameters • type – An integer indicating whether the shortcut is being added for a specific user
or for a specific user class. Use one of the following constants (which are part of the
syScBarObj form):
Constant Description
scgPERSONAL The shortcut is being added for a specific user.
scgUSERCLASS The shortcut is being added for a specific user class.
• name – A string specifying the user name or user class to which the shortcut is being
added.
• parent_ID – An integer indicating the parent node to which the shortcut will be
added. The value 0 indicates the root level.
• shortcut_display_name – A string containing the text that will be used for the
shortcut.
• macro_name – A string specifying the path to the macro file. The path must be in
native format.
Return value A boolean. True indicates the shortcut was successfully added, while false indicates
it was not.
Examples The following example adds a shortcut for a macro named “Setup.mac”. This
shortcut will be available only for LESSONUSER1.
ScBar_AddUrl()
Description The ScBar_AddUrl() function adds a shortcut for a URL to the Shortcut Bar.
Parameters • type – An integer indicating whether the shortcut is being added for a specific user
or for a specific user class. Use one of the following constants (which are part of the
syScBarObj form):
Constant Description
scgPERSONAL The shortcut is being added for a specific user.
scgUSERCLASS The shortcut is being added for a specific user class.
• name – A string specifying the user name or user class to which the shortcut is being
added.
• parent_ID – An integer indicating the parent node to which the shortcut will be
added. The value 0 indicates the root level.
• shortcut_display_name – A string containing the text that will be used for the
shortcut.
Return value A boolean. True indicates the shortcut was successfully added, while false indicates
it was not.
Examples The following example adds a shortcut to open the Microsoft web site. This shortcut
will be available only for LESSONUSER1.
628 IN T E G R AT I O N G U ID E
S H O R T C U T S C R I P T S S C B A R _ I T E M E X I S T S
ScBar_ItemExists
Description The ScBar_ItemExists() function indicates whether the specified shortcut has been
added to the Shortcut Bar.
Parameters • type – An integer indicating whether the shortcut is for a specific user or for a
specific user class. Use one of the following constants (which are part of the
syScBarObj form):
Constant Description
scgPERSONAL The shortcut is for a specific user.
scgUSERCLASS The shortcut is for a specific user class.
• name – A string specifying the user name or user class which is being examined to
find out whether the shortcut exists.
Return value A boolean. True indicates the shortcut exists, while false indicates it does not.
Examples The following example verifies that the shortcut to open the Microsoft web site
exists for LESSONUSER1. If it doesn’t, the shortcut is added.
• AddSetupChecklistItem()
• FindSetupChecklistItem()
AddSetupChecklistItem()
Parameters • ParentDictID – The ID of the dictionary that contains the command list used for the
node to which the Setup Checklist item will be added. Use the constant DYNAMICS
to specify that you are adding an item to a category defined by the Microsoft
Dynamics GP main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list used for the node to which you are adding an item.
• ParentCmdID – The resource ID of the command list used for the node to which you
are adding an item.
• Sequence – An integer variable that can be used to specify the position of the item
being added. The value 0 specifies the item will be added to the end of the category
list. The actual position of the item will be returned after it is added.
• CmdDictID – The ID of the dictionary that contains the command you are adding.
• CmdFormID – The resource ID of the command form that contains the definition of
the command you are adding.
• Optional – A boolean that indicates whether the setup action to be performed by the
Setup Checklist item is optional. The value true indicates the action is optional,
while the value false indicates it is required.
• HelpTopic – A string specifying the HTML Help topic to display for the Setup
Checklist item or category. You must specify the HTML filename of the topic to
display, including the .htm file extension. You cannot use a help context number to
specify a topic to display.
Return value An integer indicating whether the item was added to the Setup Checklist. The value
corresponds to one of the following constants:
Constant Description
OKAY The item was successfully added.
DUPLICATE The item was not added because it already exists.
632 IN T E G R AT I O N G U ID E
S E T U P C H E C K L I S T S C R I P T S A D D S E T U P C H E C K L I S T I T E M ()
Every item you add to the Setup Checklist should have a corresponding help topic
in the compiled HTML Help file for your integration. For individual items, the topic
should describe the setup actions the user can perform with the setup window. For
categories, the topic should describe the overall setup process for the group.
Examples The following example uses the AddSetupChecklistItem() function to add a new
category as a first-level node in the Setup Checklist tree. The new category is
defined by the CL_IG_Sample_Setup command list. The constant value
SETUPCHECKLIST_TOPLEVEL indicates the category is being added to the top-
level node in the tree. Because it is a category, no window technical name is needed.
The constant IG_CHM_NAME contains the name of the help file from which to
display a topic. The topic named “SampleSetup.htm” will be displayed from this
help file.
status = AddSetupChecklistItem(DYNAMICS,
SETUPCHECKLIST_TOPLEVEL,
SETUPCHECKLIST_TOPLEVEL,
seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_Setup of form Command_IG_Sample),
"",
false,
"IG_CHM_NAME",
"SampleSetup.htm") of form sySetupChecklistObj;
status = AddSetupChecklistItem(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Setup of form Command_Sales),
seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Contact_History_Setup of form Command_IG_Sample),
technicalname(window Contact_History_Setup of form
➥ IG_Contact_History_Setup),
false,
"IG_CHM_NAME",
"ContactHistorySetup.htm") of form sySetupChecklistObj;
status = AddSetupChecklistItem(DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Setup of form Command_Sales),
seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_Setup of form Command_IG_Sample),
"",
false,
"IG_CHM_NAME",
"SampleSetup.htm") of form sySetupChecklistObj;
634 IN T E G R AT I O N G U ID E
S E T U P C H E C K L I S T S C R I P T S F I N D S E T U P C H E C K L I S T I T E M ()
FindSetupChecklistItem()
Parameters • ParentDictID – The ID of the dictionary that contains the command list used for the
Setup Checklist category that will be searched.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list used for the Setup Checklist category that will be searched.
• ParentCmdID – The resource ID of the command list used for the Setup Checklist
category that will be searched.
• CmdDictID – The ID of the dictionary that contains the command for the Setup
Checklist item whose location is being examined.
• CmdFormID – The resource ID of the command form that contains the definition of
the command for the Setup Checklist item whose location is being examined.
• CmdID – The resource ID of the command for the Setup Checklist item whose
location is being examined.
Return value An integer that specifies the location (sequence number) of the specified Setup
Checklist item. The value 0 indicates the item was not found in the category
specified for the Setup Checklist.
Examples The following example uses the FindSetupChecklistItem() function to retrieve the
location of the Sales category in the Setup Checklist.
seq = FindSetupChecklistItem(DYNAMICS,
SETUPCHECKLIST_TOPLEVEL,
SETUPCHECKLIST_TOPLEVEL,
DYNAMICS,
resourceid(form Command_Sales),
resourceid(command CL_Sales_Setup of form Command_Sales)) of form
➥ sySetupChecklistObj;
• Explorer_Add_Column_To_Object
• Explorer_Add_GoTo_Item
• Explorer_Add_Object
• Explorer_AddItem_To_ListView
• Explorer_Add_SubItem_To_ListView
• Explorer_Check_Stop_Processing
• Explorer_Remove_Column_From_Object
• Explorer_Remove_GoTo_Item
• Explorer_Remove_Object
• Explorer_Search_Generic
• Explorer_Set_SQL_Join_Info
• Explorer_Set_SQL_Query_Field
• Explorer_SQL_Search_Generic
Explorer_Add_Column_To_Object
Parameters • Object_Dict_ID – An integer specifying the dictionary that defines the SmartList
object to which a column is being added. For SmartList objects defined in the core
application, use the constant DYNAMICS.
• Field_Dict_ID – An integer specifying the dictionary in which the field to use for the
column is located.
• Field_ID – An integer specifying the unique ID to use for the column. Typically, this
will be the resource ID of the field used for the column.
• Display_Name – A string that will be the default name for the column. The string can
be up to 80 characters long.
• Field_Name – A string containing the technical name of the field used for the new
column.
638 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ A D D _ C O L U M N _ T O _ O B J E C T
• DDL_Type – An integer that specifies whether the list field used for the column is 0-
based (items numbered 0, 1, 2) or 1-based (items numbered 1, 2, 3). Specify 0 for 0-
based numbering. Specify 1 for 1-based numbering. If the field is not a list, specify 1.
Radio groups use 0-based numbering. All other list fields, such as drop-down lists and list
boxes, use 1-based numbering.
• In_Lookup – A boolean that indicates whether the column should appear in the
Advanced Lookup window for the SmartList object to which you are adding a
column. This parameter should be set to true only if your added columns to an
existing SmartList object in the core dictionary that has a corresponding Advanced
Lookup window.
• User_Defined_Field – A boolean that indicates whether the field used for the column
is a user-defined field. The value true indicates that it is, while false indicates that it
is not. User-defined fields have their prompts defined at runtime by the user.
• Display_Sequence – A returned integer that indicates the sequence the new colum
will be displayed in if you have chosen to include it in the default query. You should
initially set this value to zero. SmartList will return the next available sequence
number that you can use when adding additional columns to the specified
SmartList object.
• Error – A returned integer containing the database error that was returned by
SmartList when the column was added. The following table lists the typical values
returned:
Comments When a new column is added to a SmartList object, the information about the
column is written to the ASITAB20 table. If incorrect parameter values were used
when you wrote the column, you will have to manually remove the record from this
table. If you leave the existing record and try to rewrite the column information
with parameter changes, you will receive a dupliate record error.
Examples The following example adds a new column to the Customers SmartList object. This
column will not be included in the default query for the SmartList object.
640 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ A D D _ G O T O _ I T E M
Explorer_Add_GoTo_Item
Parameters • Object_Dict_ID – An integer specifying the dictionary that defines the SmartList
object to which a Go To item is being added. For SmartList objects defined in the
core application, use the constant DYNAMICS.
• GoTo_Item – An integer that uniquely identifies the Go To item. Often, the resource
ID of the form used to process the Go To item will be used.
• GoTo_Default – A boolean that specifies whether the Go To item will be the default
Go To action for the specified SmartList. There should be only one default item for
each SmartList object type.
• Error – A returned integer containing the database error that was returned by
SmartList when the Go To item was added. The following table lists the typical
values returned:
Comments When a new Go To item is added to a SmartList object, the information about the
item is written to the ASIEXP60 table. If incorrect parameter values were used when
you wrote the Go To item, you will have to manually remove the record from this
table. If you leave the existing record and try to rewrite the Go To information with
parameter changes, you will receive a dupliate record error.
Examples The following example adds a Go To item to the Customers SmartList object.
642 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ A D D _ O B J E C T
Explorer_Add_Object
Parameters • Object_Dict_ID – An integer specifying the dictionary that is defining the new
SmartList object, typically the ID of your integrating product.
• Object_Type – An integer specifying the unique ID for the new SmartList object. The
object type must be unique within the scope of the dictionary defining the new
object. You may want to create a constant that contains the object type.
• Object_Name – A string specifying the name of the new SmartList object. The name
can be up to 80 characters long.
• Error – A returned integer containing the database error that was returned by
SmartList when the new SmartList object was created. The following table lists the
typical values returned:
Comments You must create the new SmartList object before you can add new columns and Go
To items to it.
Examples The following example creates a new Leads SmartList object for the sample
integrating application. The IG_PROD_ID constant contains the product ID for the
sample.
Explorer_AddItem_To_ListView
Description The Explorer_AddItem_To_ListView procedure adds one item to the list view field
in the SmartList window. It is used in the procedure that is called as individual
records are added to the SmartList.
Parameters • Label – A string that must contain the primary key values needed to retrieve the
record that supplies the data for the item being added. Other applications will use
the key values stored in the label to identify the record, such as when processing Go
To items.
• Record_Count – A long integer specifying the total number of items being added to
the list view. This number will be displayed in the status area at the bottom of the
SmartList window.
• Object_Name – A string that contains the name of the type of objects being displayed
in the SmartList. This name will be displayed in the status area at the bottom of the
SmartList window.
• Index – A returned long integer that contains the index of the new list view item.
You will use this index with the Explorer_Add_SubItem_To_ListView procedure
to add subitems to the new item.
Comments This procedure should be called with the foreground parameter, ensuring that it
runs in the foreground.
in integer IN_Total_SubItems;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in long IN_Record_Count;
inout table IG_Leads_MSTR;
local long n;
local integer l_Count;
local string l_Field_As_String;
local long l_Field_As_Integer;
local date l_Field_As_Date;
local currency l_Field_As_Currency;
local time l_Field_As_Time;
local integer l_Datatype;
local boolean b_Success;
644 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ A D D I T E M _ T O _ L I S T V I E W
set l_Count to 1;
case IN_Field_List[l_Count]
in [resourceid(field 'Lead ID')]
l_Field_As_String = 'Lead ID' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Lead Name')]
l_Field_As_String = 'Lead Name' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Lead Business Category')]
{Need a "helper" window field to get the category name}
'Lead Business Category' of window Dummy of form Command_IG_Sample
➥ = 'Lead Business Category' of table IG_Leads_MSTR;
l_Field_As_String = itemname('Lead Business Category' of window
➥ Dummy of form Command_IG_Sample, 'Lead Business Category' of
➥ table IG_Leads_MSTR);
l_Field_As_Integer = 'Lead Business Category' of table
➥ IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_DDL;
in [resourceid(field 'Potential Revenue')]
l_Field_As_String = format('Potential Revenue' of table
➥ IG_Leads_MSTR, true, true, 2, SYSTEMNEG);
l_Field_As_Currency = 'Potential Revenue' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_CURRENCY;
in [resourceid(field 'Contact')]
l_Field_As_String = 'Contact' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Address 1')]
l_Field_As_String = 'Address 1' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Address 2')]
l_Field_As_String = 'Address 2' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'City')]
l_Field_As_String = 'City' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'State')]
l_Field_As_String = 'State' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Zip')]
l_Field_As_String = 'Zip' of table IG_Leads_MSTR;
l_Datatype = SMARTLIST_DATATYPE_STRING;
in [resourceid(field 'Phone 1')]
l_Field_As_String = FormatPhoneNumber('Phone 1' of table
➥ IG_Leads_MSTR);
l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
in [resourceid(field 'Phone 2')]
l_Field_As_String = FormatPhoneNumber('Phone 2' of table
➥ IG_Leads_MSTR);
l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
in [resourceid(field 'Fax')]
increment l_Count;
end while;
646 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ A D D _ S U B I T E M _ T O _ L I S T V I E W
Explorer_Add_SubItem_To_ListView
Parameters • Index – A long integer that specifies the list view item to which the subitem is to be
added. Use the value that was returned from the Explorer_AddItem_To_ListView
procedure.
• Column – An integer specifying the column number of the subitem being added to
the list view.
• Display_String – A string specifying the text that will be displayed in the column.
The string will be displayed exactly as it’s supplied. Any formatting (such as for
currency fields) must be done before the value is passed to this parameter.
• Sort_Integer – For an integer subitem, the integer value that will be used for sorting
the column.
• Sort_Date – For a date subitem, the data value that will be used for sorting the
column.
• Sort_Currency – For a currency subitem, the currency value that will be used for
sorting the column.
• Sort_Time – For a time subitem, the time value that will be used for sorting the
column.
• Result – A returned boolean that indicates whether the subitem was added. The
value true indicates it was added, while the value false indicates it was not.
Explorer_Check_Stop_Processing
Parameters • Stop – A returned boolean that will be true if the user has chosen to stop processing,
and false if they have not.
Comments This procedure should be called at least once in the loop that fills the SmartList with
data items.
Examples The following example is the procedure from the sample integrating application
that adds Leads records to the SmartList. Notice that the procedure uses the
Explorer_Check_Stop_Processing procedure to know whether to continue adding
items to the SmartList.
in integer IN_Total_SubItems;
in Explorer_BOOL_List IN_Searching;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
in Explorer_INT_List IN_Datatype;
in Explorer_INT_List IN_Type;
in Explorer_STR30_List IN_Search_From;
in Explorer_STR30_List IN_Search_To;
in Explorer_BOOL_List IN_Match_Case;
in integer IN_Global_Search_Type;
in Explorer_Field_Comparison IN_Field_Comparison;
in Explorer_Start_Comp_Field_ID IN_Start_Comp_Field_ID;
in Explorer_Start_Comp_Field_Dict IN_Start_Comp_Field_Dict;
in Explorer_End_Comp_Field_ID IN_End_Comp_Field_ID;
in Explorer_End_Comp_Field_Dict IN_End_Comp_Field_Dict;
in boolean IN_GetSummary;
in integer IN_Summary_Type; {0 = Number of records, 1 = Total of Column}
inout integer IO_SummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_ColumnTotal;
set l_Record_Count to 0;
set l_Key to 1;
call with name "Explorer_Check_Stop_Processing" in dictionary SMARTLIST,
➥ b_Stop;
648 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ C H E C K _ S T O P _ P R O C E S S I N G
IN_Field_Comparison,
IN_Start_Comp_Field_ID,
IN_Start_Comp_Field_Dict,
IN_End_Comp_Field_ID,
IN_End_Comp_Field_Dict,
b_Found;
if b_Found then
increment l_Record_Count;
call foreground SmartList_Leads_FillOneRowAtTime,
IN_Total_SubItems,
IN_Dict_List,
IN_Field_List,
l_Record_Count,
table IG_Leads_MSTR;
end if;
Explorer_Remove_Column_From_Object
Parameters • Object_Dict_ID – An integer specifying the dictionary that defines the SmartList
object from which a column is being removed. For SmartList objects defined in the
core application, use the constant DYNAMICS.
• Field_Dict_ID – An integer specifying the dictionary in which the field used for the
column is located.
• Field_ID – An integer specifying the unique ID used for the column. Typically, this
will be the resource ID of the field used for the column.
Comments Use this procedure to remove columns that you have added for your integration.
You cannot remove columns defined by the core dictionary.
Examples The following example removes the First Contact Date column from the Customers
SmartList object.
650 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ R E M O V E _ G O T O _ I T E M
Explorer_Remove_GoTo_Item
Parameters • Object_Dict_ID – An integer specifying the dictionary that defines the SmartList
object from which a Go To item is being removed. For SmartList objects defined in
the core application, use the constant DYNAMICS.
• GoTo_Item – An integer that uniquely identifies the Go To item. Often, the resource
ID of the form used to process the Go To item will be used.
• Error – A returned integer containing the database error that was returned by
SmartList when the Go To item was removed. The following table lists the typical
values returned:
Comments Use this procedure to remove Go To items that you have added for your integration.
You cannot remove Go To items defined by the core dictionary.
Examples The following example removes the Contact History Go To item added to the
Customers SmartList object.
Explorer_Remove_Object
Parameters • Object_Dict_ID – An integer specifying the dictionary that defined the SmartList
object being removed.
• Error – A returned integer containing the database error that was returned by
SmartList when the SmartList object was removed. The following table lists the
typical values returned:
Comments Use this procedure to remove SmartList objects that you have added for your
integration. You cannot remove SmartList objects defined by the core dictionary.
Examples The following example removes the Leads SmartList object defined by the sample
integrating application.
652 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ S E A R C H _ G E N E R I C
Explorer_Search_Generic
Parameters • Object_Dict_ID – An integer specifying the dictionary that has defined the SmartList
object.
• Searching – An array of four boolean values indicating whether any search criteria
are being used. If no search criteria are used, the Found parameter will always return
true.
• Field_Dict_ID – An array of four integers containing the dictionary IDs of the fields
being searched.
• Field – An array of four integers containing the resource IDs of the fields being
searched.
• Datatype – An array of four integers containing the datatypes of the fields being
searched.
• Type – An array of four integers that indicate the type of searches being performed.
For instance, “contains” or “is equal to” are common search types.
• Search_From – An array of four strings that the search fields will be compared to.
• Search_To – An array of four strings that the search fields will be compared to.
• Match_Case – An array of four booleans indicating whether the search should match
case.
• Found – A returned boolean indicating whether the record matches the search
criteria.
Comments This procedure is used for SmartList objects that are not optimized for SQL Server.
Most of the parameters passedto this procedure originate from the SmartList.
Examples The following example from the sample integrating application fills the Leads
SmartList object with records. The Explorer_Search_Generic procedure is called to
determine whether the current record matches the search criteria specified by the
SmartList user. This check occurs only if the object indicates that it is not optimized
for SQL.
in integer IN_Total_SubItems;
in Explorer_BOOL_List IN_Searching;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
in Explorer_INT_List IN_Datatype;
in Explorer_INT_List IN_Type;
in Explorer_STR30_List IN_Search_From;
in Explorer_STR30_List IN_Search_To;
in Explorer_BOOL_List IN_Match_Case;
in integer IN_Global_Search_Type;
in Explorer_Field_Comparison IN_Field_Comparison;
in Explorer_Start_Comp_Field_ID IN_Start_Comp_Field_ID;
in Explorer_Start_Comp_Field_Dict IN_Start_Comp_Field_Dict;
in Explorer_End_Comp_Field_ID IN_End_Comp_Field_ID;
in Explorer_End_Comp_Field_Dict IN_End_Comp_Field_Dict;
in boolean IN_GetSummary;
in integer IN_Summary_Type; {0 = Number of records, 1 = Total of Column}
inout integer IO_SummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_ColumnTotal;
654 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ S E A R C H _ G E N E R I C
IN_Field,
IN_Datatype,
IN_Type,
IN_Search_From,
IN_Search_To,
IN_Match_Case,
IN_Field_Comparison,
IN_Start_Comp_Field_ID,
IN_Start_Comp_Field_Dict,
IN_End_Comp_Field_ID,
IN_End_Comp_Field_Dict,
IN_Global_Search_Type,
SQL_Context,
Error,
IN_GetSummary,
IN_Summary_Type,
IO_SummaryCount,
IN_nSummaryFieldDictID,
IN_nSummaryFieldID,
IO_ColumnTotal;
{This is the traditional SmartList code that works for all database types}
set l_Record_Count to 0;
set l_Key to 1;
call with name "Explorer_Check_Stop_Processing" in dictionary SMARTLIST,
➥ b_Stop;
IN_Start_Comp_Field_ID,
IN_Start_Comp_Field_Dict,
IN_End_Comp_Field_ID,
IN_End_Comp_Field_Dict,
b_Found;
if b_Found then
increment l_Record_Count;
call foreground SmartList_Leads_FillOneRowAtTime,
IN_Total_SubItems,
IN_Dict_List,
IN_Field_List,
l_Record_Count,
table IG_Leads_MSTR;
end if;
656 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ S E T _ S Q L _ J O I N _ I N F O
Explorer_Set_SQL_Join_Info
Parameters • From_Table – A string specifying the technical name of the primary table to join
from.
• To_Table – A string specifying the technical name of the secondary table to join to.
• To_Field – A string up to 80 characters long specifying the technical name of the field
in the secondary table to join to.
• Join_Type – An integer specifying the type of join being created. Use one of the
following constants:
• Error – A returned integer containing any database errors that occurred while
adding the join information.
When multiple fields are needed to create the join (such as for a multi-segment key)
you will call this procedure once for each individual field in the join.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
inout integer Document_Type;
658 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ S E T _ S Q L _ Q U E R Y _ F I E L D
Explorer_Set_SQL_Query_Field
Parameters • Sequence – An integer specifying the position of this field in the results set. The value
0 indicates the first position.
• Table – A string up to 80 characters long containing the technical name of the table
the key field comes from.
• Dict_ID – An integer specifying the dictionary ID of the product that defines the
table the key field comes from.
• Field – A string up to 80 characters long containing the technical name of the field to
return in the results set.
• Error – A returned integer indicating any error that occurred adding the field to the
results set.
When multiple fields are needed to uniquely indentify each record in the table, you
will call this procedure once for each individual field.
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
Explorer_SQL_Search_Generic
We strongly recommend that you use SmartList’s built-in optimization when creating
SmartList objects that are designed to work with SQL Server.
Parameters • Object_Dict_ID – An integer specifying the dictionary that has defined the SmartList
object.
• Searching – An array of four boolean values indicating whether any search criteria
are being used.
• Field_Dict_ID – An array of four integers containing the dictionary IDs of the fields
being searched.
• Field – An array of four integers containing the resource IDs of the fields being
searched.
• Datatype – An array of four integers containing the datatypes of the fields being
searched.
• Type – An array of four integers that indicate the type of searches being performed.
For instance, “contains” or “is equal to” are common search types.
• Search_From – An array of four strings that the search fields will be compared to.
• Search_To – An array of four strings that the search fields will be compared to.
• Match_Case – An array of four booleans indicating whether the search should match
case.
• DDL_Type – An array of four integers indicating whether list fields used for the
search are 0-based or 1-based. The value 0 indicates 0-based, while the value 1
indicates 1-based.
660 IN T E G R AT I O N G U ID E
S M A R T L I S T S C R I P T S E X P L O R E R _ S Q L _ S E A R C H _ G E N E R I C
• Search_Table_Name – An array of four strings containing the names of the tables for
the search fields.
• SQL_Connection – A returned long integer that is the connect to the SQL results set
containing the key values for the items returned by the search. Use functions such
as SQL_FetchNext() and SQL_GetData() to retrieve the results.
• Error – A returned integer indicating whether the search could be completed. The
value 0 indicates the search was completed. The value -1 indicates the search could
not be completed, and a manual sequential search should be performed.
• Column_Total – A returned currency containing the total of the specified column for
the records that match the search.
• GrantAccess()
• SQL_GetConnection()
GrantAccess()
Description The GrantAccess() function of the SQL Maintenance form is used to grant security
access to SQL tables and stored procedures.
Parameters • object_name – A string specifying the object to which access is being granted.
Typically, this is a table physical name.
• type – A boolean that indicates whether access is being granted to a table or to the
auto-generated stored procedures for the table. The value false indicates access is
being granted to the SQL table. The value true indicates access is being granted to
the auto-generated stored procedures for the specified table.
• group_name – A string specifying the SQL group to which access is being granted.
Typically, this will be “DYNGRP”.
• database – A string specifying the database that contains the table or auto-generated
stored procedures for which access is being granted.
Return value A boolean. The value true indicates that access was granted, while false indicates it
was not.
Comments When granting access to a new table, you will first grant access to the table, and
then to the auto-generated stored procedures for the table.
If an error occurs while granting access, an error dialog will be displayed that lists
the number of the SQL error that occurred.
Examples The following example uses the GrantAccess() function to grant access to the
IG_Leads_MSTR table and its auto-generated stored procedures. The name of the
current database is stored in the Intercompany ID global variable.
664 IN T E G R AT I O N G U ID E
SQ L S C R I P T S S Q L _ G E T C O N N E C T I O N ()
SQL_GetConnection()
Parameters • type – Specifies how the pass-through SQL connection will be used. The value
corresponds to one of the following constants:
Constant Description
FOREGROUND Pass-through SQL will be executed
from a foreground script.
BACKGROUND Pass-through SQL will be executed
from a background script.
Return value An integer indicating whether the connection was returned. The value 0 indicates
the connection was returned. Any othe value indicates an error occurred.
Examples The following example is a portion of the metric processing script for a Home Page
metric. It uses the SQL_GetConnection() function to retrieve a pass-through SQL
connection that is used to access data for the metric.
• AddCommandBar()
• AddCommandToCmdBar()
• ButtonsExistForProduct()
• CmdBarIsVisible()
• ExistsForUserID()
• FindCommandInCmdList()
• ToggleCommandBar()
AddCommandBar()
Description The AddCommandBar() function defined in the syCmdBarObj form is used to add
a toolbar to Microsoft Dynamics GP.
Parameters • UserID – A string that specifies which user’s set of toolbars the new toolbar will be
added to. Specify the empty string ("") to add the new toolbar to the default set of
toolbars.
• ParentDictID – The ID of the dictionary that contains the command list that will be
used to contain the toolbar items.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that will be used to contain the toolbar items.
• ParentCmdID – The resource ID of the command list that will contain the toolbar
items.
• visible – A boolean that indicates whether the toolbar will be displayed by default.
The value true indicates the toolbar will be displayed, while false indicates it will
not.
• row_number – An integer that specifies which row the toolbar will attempt to be
placed on. If the row doesn’t exist, a new row will be added.
• position – An integer variable that specifies the horizontal position of the toolbar on
the row. The value is measured in pixels from the left edge of the main Microsoft
Dynamics GP window. The value 0 specifies the toolbar will be added as the first
item in the row.
• clone – A boolean parameter. The value true specifies that the toolbar will be added
for all users, while the value false specifies that the toolbar will be added for only
the specified user.
Return value An integer indicating whether the toolbar was added. The value corresponds to one
of the following constants:
Constant Description
OKAY The toolbar was successfully added.
DUPLICATE The toolbar was not added because it already exists.
668 IN T E G R AT I O N G U ID E
T O O L B A R S C R I P T S A D D C O M M A N D B A R ()
{Add the toolbar and clone for each user who has toolbars}
pos = 0; {Place at the beginning of the row}
status = AddCommandBar("",
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
true, {visibility}
2, {row number}
pos, {position}
true) of form syCmdBarObj;
AddCommandToCmdBar()
Parameters • ParentDictID – The ID of the dictionary that contains the command list that is used
for the toolbar.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that is used for the toolbar.
• ParentCmdID – The resource ID of the command list that is used for the toolbar.
• Sequence – An integer variable that can be used to specify the position of the item in
the toolbar. The value 0 specifies the command will be added to the end of the
toolbar. The actual position of the command will be returned after the command is
added.
• CmdDictID – The ID of the dictionary that contains the command you are adding.
• CmdFormID – The resource ID of the command form that contains the definition of
the command you are adding.
• CloneCmd – A boolean parameter. The value true specifies that the command will be
added for all users, while the value false specifies that the command will be added
for only the current user.
• LoadMode – An integer that specifies where the command will be added. The value
corresponds to one of the following constants:
Constant Description
MENULOAD_TOTABLE The toolbar items are being added to the default toolbar
set in Microsoft Dynamics GP.
MENULOAD_TOMEMORY This value is not currently used.
Return value An integer indicating whether the command was added to the toolbar. The value
corresponds to one of the following constants:
Constant Description
OKAY The command was successfully added.
DUPLICATE The command was not added because it already exists.
670 IN T E G R AT I O N G U ID E
T O O L B A R S C R I P T S A D D C O M M A N D T O C M D B A R ()
increment Seq;
status = AddCommandToCmdBar(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Inquiry of form Command_IG_Sample),
true, {available for all users}
MENULOAD_TOTABLE);
ButtonsExistForProduct()
Syntax ButtonsExistForProduct(Product_ID)
Parameters • Product_ID– The ID of the dictionary for which toolbar buttons will be examined.
Return value A boolean. The value true indicates that toolbar buttons exist for the product, while
false indicates they do not.
Seq = 1;
status = AddCommandToCmdBar(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Maintenance of form Command_IG_Sample),
true, {available for all users}
MENULOAD_TOTABLE);
increment Seq;
status = AddCommandToCmdBar(IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command CL_IG_Sample_CMDBAR of form Command_IG_Sample),
Seq,
IG_PROD_ID,
resourceid(form Command_IG_Sample),
resourceid(command IG_Lead_Inquiry of form Command_IG_Sample),
true, {available for all users}
MENULOAD_TOTABLE);
672 IN T E G R AT I O N G U ID E
T O O L B A R S C R I P T S C M D B A R I S V I S I B L E ()
CmdBarIsVisible()
Description The CmdBarIsVisible() function defined in the syCmdBarObj form is used to find
out whether a toolbar is visible in Microsoft Dynamics GP.
Parameters • UserID – A string that specifies the user for whom the state of the toolbar will be
examined. Specify the empty string ("") to examine the default set of toolbars.
• ParentDictID – The ID of the dictionary that contains the command list for the
toolbar that is being examined.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list used for the toolbar that is being examined.
• ParentCmdID – The resource ID of the command list for the toolbar that is being
examined.
Return value A boolean. The value true indicates that the toolbar is displayed for the specified
user, while false indicates that it is not.
Examples The following example uses the CmdBarIsVisible() function to find out whether
the toolbar for the sample integrating application is displayed. If it is, the
corresponding menu item in the Toolbars submenu is checked.
local boolean visible;
local integer tag;
ExistsForUserID()
Parameters • UserID – A string that specifies the user for whom the existance of the toolbar will
be examined. Specify the empty string ("") to examine the default set of toolbars.
• ParentDictID – The ID of the dictionary that contains the command list for the
toolbar that is being examined.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list used for the toolbar that is being examined.
• ParentCmdID – The resource ID of the command list for the toolbar that is being
examined.
Return value A boolean. The value true indicates that the toolbar exists for the specified user,
while false indicates it does not.
Comments This function does not indicate whether a toolbar is visible. Use the
CmdBarIsVisible() function to find out whether a toolbar is visible.
674 IN T E G R AT I O N G U ID E
T O O L B A R S C R I P T S F I N D C O M M A N D I N C M D L I S T ()
FindCommandInCmdList()
Parameters • UserID – A string that specifies which user’s set of commands will be examined to
find the position of the command in the command list. Specify the empty string ("")
to examine the default set of commands.
Parameters • ParentDictID – The ID of the dictionary that contains the command list that is being
examined. Use the constant DYNAMICS to specify the Microsoft Dynamics GP
main dictionary.
• ParentFormID – The resource ID of the command form that contains the definition of
the command list that is being examined.
• CmdDictID – The ID of the dictionary that contains the command whose location is
being examined.
• CmdFormID – The resource ID of the command form that contains the definition of
the command whose location is being examined.
Return value An integer that specifies the location (sequence number) of the specified command.
The value 0 indicates the item was not found in the command list.
Examples The following example uses the FindCommandInCmdList() function to retrieve the
location of the GL_Transaction_Entry command that appears in the Financial
toolbar in Microsoft Dynamics GP.
Seq = FindCommandInCmdList("",
DYNAMICS,
resourceid(form Command_System),
resourceid(command CL_Financial_CMDBAR of form Command_System),
DYNAMICS,
resourceid(form Command_Financial),
resourceid(command GL_Transaction_Entry of form Command_Financial)) of
FindCommandInCmdListform syCmdBarBtnObj;
ToggleCommandBar()
Parameters • menu_item_tag – The integer tag value for the menu item in the Toolbars submenu
that is used to control whether the toolbar is displayed. If the toolbar is being
displayed, the menu item will be set to the checked state. Otherwise it will be set to
the unchecked state.
• toolbar_tag – The integer tag value for the command list used to define the the
toolbar. If the toolbar is visible, it will be hidden. If it is hidden, it will be made
visible.
Return value An integer indicating whether the toolbar status was changed. The constant value
OKAY indicates the toolbar status was changed.
Examples The following example is the command script for the Toolbar_IGSample command.
This command is added to the Toolbars submenu in Microsoft Dynamics GP. When
a user chooses the command, the script uses the ToggleCommandBar() function to
show or hide the toolbar for the sample integration.
676 IN T E G R AT I O N G U ID E
Unified Communications scripts
The following scripts are used when working with Unified Communications for
Microsoft Dynamics GP:
• Activate
• GatherSIP()
• Register
• Unregister
Activate
Description The Activate procedure of the Dummy_Presence_Form form is used to perform the
action the user selected in the button drop list for a presence indicator.
Parameters • form_name – A string specifying the name of the form. Typically, this parameter is
set to the empty string.
• SIP_address – A string specifying the SIP address for which the action is being
performed. Typically, this value is retrieved from the corresponding Label_Presence
field for the presence indicator.
• title – A string that specifies the additional text to display in the title of the
messenger window when the action is performed.
• action – An integer that specifies the action to be performed. This corresponds to the
position of the item the user chose from the button drop list.
• master_ID – A string parameter that is not used. Set this to the empty string.
• master_type – A string parameter that is not used. Set this to the empty string.
• master_address – A string parameter that is not used. Set this to the empty string.
• product_ID – An integer specifying the product ID for the product that contains the
presence fields.
Examples The following example is the change script for the PB_Presence_Button field for the
first presence instance in the Lead Inquiry window. This change script builds the
title to display in the messenger dialog, and then calls the Activate procedure to
perform the action. The constant IG_PROD_ID is used to specify the product in
which the presence indicator has been implemented.
{Perform the action that was chosen from the button drop list}
call Activate of form Dummy_Presence_Form, "", "", 0, Label_Presence[1],
➥ convo_title, PB_Presence_Button[1], "", "", "", IG_PROD_ID;
678 IN T E G R AT I O N G U ID E
U N I F I E D C O M M U N I C A T I O N S S C R I P T S G A T H E R S IP ()
GatherSIP()
Description The GatherSIP() function retrieves the SIP address (messenger address) for the
specified entity in Microsoft Dynamics GP.
Parameters • master_type – A string that specifies the type of entity from which to retrieve the SIP
address. The following table lists the possible values:
• master_ID – A string that contains the ID of the entity. For instance, when retrieving
the SIP address for a salesperson, this is the Salesperson ID.
• address_code – If multiple addresses can be defined for the entity, specifies the ID of
the set of address information from which the SIP address will be retrieved. If the
entity does not support multiple addresses, use the empty string ("").
Return value A string containing the SIP address for the entity.
Examples The following example is the change script for the Label_Presence[1] field in the
Lead Maintenance window of the sample integrating application. This script
retrieves the SIP address for the salesperson currently selected in the Salesperson ID
field, and then registers the presence indicator for that field.
form_name = "IG_Lead_Maintenance";
window_name = "'Lead Maintenance'";
{Retrieve the SIP address for the salesperson and store it in the array
element}
Label_Presence[1] = GatherSIP(CO_INETADDRS_SALESPERSON, 'Salesperson ID',
➥ "");
Register
Description The Register procedure of the Dummy_Presence_Form form registers the presence
indicator for a field so the indicator can be updated.
Parameters • form_name – A string specifying the name of the form that contains the presence
indicator field.
• window_name – A string specifying the name of the window that contains the
presence indicator field.
• index – An integer specifying the presence field instance that is being registered. The
value 1 indicates the first presence field for the window, the value 2 indicates the
second, and so on.
• SIP_address – A string specifying the SIP address for the entity. Typically, this value
is retrieved from the corresponding Label_Presence field for the presence indicator.
• master_ID – A string that contains the ID of the entity. For instance, when retrieving
the SIP address for a salesperson, this is the Salesperson ID.
• master_type – A string that specifies the type of entity. The following table lists the
possible values:
• address_code – If multiple addresses can be defined for the entity, specifies the ID of
the set of address information from which the SIP address will be retrieved. If the
entity does not support multiple addresses, use the empty string ("").
• product_ID – An integer specifying the product ID for the product that contains the
presence fields.
Examples The following example is the change script for the Label_Presence[1] field in the
Lead Inquiry window of the sample integrating application. This script retrieves the
SIP address for the salesperson currently selected in the Salesperson ID field, and
then registers the presence indicator for that field.
form_name = "IG_Lead_Inquiry";
window_name = "IG_Lead_Inquiry";
{Retrieve the SIP address for the salesperson and store it in the array
element}
Label_Presence[1] = GatherSIP(CO_INETADDRS_SALESPERSON, 'Salesperson ID',
➥ "");
680 IN T E G R AT I O N G U ID E
U N I F I E D C O M M U N I C A T I O N S S C R I P T S R E G I S T E R
Unregister
Description The Unregister procedure of the Dummy_Presence_Form form unregisters the
presence indicator for a field so the indicator will no longer be updated.
Parameters • form_name – A string specifying the name of the form that contains the presence
indicator field.
• window_name – A string specifying the name of the window that contains the
presence indicator field.
• index – An integer specifying the presence field instance that is being unregistered.
The value 1 indicates the first presence field for the window, the value 2 indicates
the second, and so on.
• SIP_address – A string specifying the SIP address for the entity. Typically, this value
is retrieved from the corresponding Label_Presence field for the presence indicator.
• master_ID – A string that contains the ID of the entity. For instance, when retrieving
the SIP address for a salesperson, this is the Salesperson ID.
• master_type – A string that specifies the type of entity. The following table lists the
possible values:
• address_code – If multiple addresses can be defined for the entity, specifies the ID of
the set of address information from which the SIP address will be retrieved. If the
entity does not support multiple addresses, use the empty string ("").
• product_ID – An integer specifying the product ID for the product that contains the
presence fields.
Examples The following example is the change script for the PresenceChangeEventTrigger
field in the Lead Inquiry window of the sample integrating application. This script
handles two cases based on the value it is set to when the change script is run. When
its value is -1, the script unregisters all of the presence indicators for the fields in the
window. When its value is a specific presence field instance number, only that
presence indicator is unregistered.
form_name = "IG_Lead_Inquiry";
window_name = "IG_Lead_Inquiry";
case PresenceChangeEventTrigger
in [-1]
682 IN T E G R AT I O N G U ID E
U N I F I E D C O M M U N I C A T I O N S S C R I P T S U N R E G I S T E R
686 IN T E G R AT I O N G U ID E
Appendix A: Naming Conventions
Microsoft Dynamics GP uses a standard naming convention for different resource
types. The following sections describe this convention:
Resource names
All words in a resource name begin with an uppercase letter followed by the
remaining characters in lowercase, as in “Customer_Maintenance.” The exception
to this rule is any standard abbreviation used in a resource name, such as YTD
(year-to-date).
Using underscores
Use an underscore (_), not a space, between words in names given to composites,
formats, data types, forms, windows, native pictures, tables, table keys and
procedures.
Using spaces
Use a space between words in report names and field names, whether they’re local
fields, global fields or system variables. Since these names can be viewed by users in
the Report Writer and Modifier, using spaces between words makes them more
readable.
Standard abbreviations
Common accounting terms can be abbreviated. To ensure consistency, the following
standard abbreviations have been established for Microsoft Dynamics GP. Use the
technical abbreviations for resource names; use the display abbreviations for names
that will be displayed on the computer screen (in a message or in a window) or in
reports.
688 IN T E G R AT I O N G U ID E
A PP E ND IX A N A M I N G C O N V E N T I O N S
Data types
Data type names should be as consistent and descriptive as possible to allow for
systemwide use. Keep in mind that you can use existing Microsoft Dynamics GP
data types for fields in your dictionary, rather than creating new data types.
We currently use three categories of data types: standard, object and control field.
Each control field should have its own data type. In addition to the naming
conventions already described, identify the data type as a control field data type by
adding a prefix that describes the functionality of the control field.
Formats
Format names consist of three parts, each separated by underscores. String formats
contain the first and second parts of the name, while currency and integer formats
may contain all three, where appropriate. If any abbreviation does not appear in the
name, the type of information it corresponds to isn’t applicable to the format:
The second part of the name indicates the format’s alignment, fill, decimal digits
and whether it’s numeric, alphanumeric or uppercase:
The last part of the name is used only with integer or currency control types. It
indicates whether the format is signed or unsigned, if it shows the thousands
separator or not, its relative decimal position and if it uses the currency symbol or
the percent sign:
Fields
To distinguish fields from other resources in scripts, avoid using underscores in
field names. Other resource types can be easily identified by the underscores in
their names.
Invisible fields
Invisible fields are typically used to hold a temporary value in a window. Many
invisible fields have scripts attached to them, allowing other window scripts to use
the run script statement to access the invisible field’s script. However, a more
appropriate method for accessing a script for a form is through form procedures.
Distinguish these fields in the layout window by selecting the following field
properties:
Editable False
Visible False
BackColor Yellow if the field has a script attached. Magenta if the
field has no script attached.
690 IN T E G R AT I O N G U ID E
A PP E ND IX A N A M I N G C O N V E N T I O N S
Tables
Each table has three names – a table name, display name and physical name.
Table names
Table names are comprised of a two-, three- or four-character module abbreviation,
followed by a term that describes the contents of the table, and a three- or four-
character main table type abbreviation, following this format:
• MODULE_Contents_MAIN
• MODULE_Contents_SUB_MAIN
Display names
Each table also has a display name that may appear in windows or on reports.
Display names don’t use underscores or abbreviations.
Display names should begin with a one-word module or series identifier, such as
Receivables or Financials. If the table contains master records and is included in
System Manager, use the master record type, such as Customer or Account instead
of a module identifier.
Table groups
Display names for table groups typically end in Master, Work, Setup, History or
Open. The table group’s display name should be the same as the primary table in
the group.
Physical names
Physical names (names applied to a table by the operating system) are
alphanumeric, typically comprised of three segments, as shown in the following
table:
Segment Length
Module abbreviation 2 characters
Table type + sequence number 3 digits
Variant number 2 digits
692 IN T E G R AT I O N G U ID E
A PP E ND IX A N A M I N G C O N V E N T I O N S
Module Variant
abbreviation number
Table type
GL10301
Sequence
number
Table type
The table type is a code corresponding to the type of data the table stores. Table
types and their corresponding values are shown in the following table.
Sequence number
The sequence number is a way of categorizing different tables that have the same
table type (such as master or work), and are not in the same table group. For
example, the GL_Budget_MSTR table has a physical name of GL00200 (sequence
number of “2”), and GL_Account_MSTR table has a physical name of GL00100
(sequence number of “1”). Both of these store master record data, but do not belong
to the same table group.
Variant number
The variant number indicates the order the table belongs in a table group. For
example, the following chart shows tables in the Account Master table group in the
order they appear in the group. Notice that the variant number increments for each
table in the group.
Key names
Names for a table key consist of the table name followed by [_Keyn] where n is the
number of the key. By including the table name, you won’t inadvertently create
duplicate key names. For example, the first two keys for the Inventory Item Master
Table are IV_Item_MSTR_Key1 and IV_Item_MSTR_Key2.
Form Windows
RM_Customer_Maintenance RM_Customer_Maintenance
RM_Customer_Accounts
RM_Customer_Options
RM_Credit_Limit
If abbreviations are required due to space restrictions, use only the standard
abbreviations indicated in Standard abbreviations on page 688.
Window titles
A window title is the text that appears in the title bar of a window. While using
underscores and abbreviations in the window name makes it easier to work with in
scripts, those conventions can be distracting and confusing for users if you use them
for a window title. Therefore, Microsoft Dynamics GP uses window titles that are
more familiar to users.
Window titles for windows that maintain master records should begin with the
master record type, series or module that is affected by the form or window. Module
abbreviations should not be used in window titles. Typical window titles include:
• Account Maintenance
• Employee Benefit Maintenance
• Inventory Setup Reports
Window titles for windows that perform routines may begin with verbs, like
“reconcile” or “remove.” Some of these window titles include:
694 IN T E G R AT I O N G U ID E
A PP E ND IX A N A M I N G C O N V E N T I O N S
The titles of parent windows should end in a word that indicates the type of action
performed.
• Batch IDs
• Accounts
• Payment Terms
Reports
Report names do not contain abbreviations or underscores, since these names
typically appear in the Report Writer. You can use module abbreviations, if space
limitations apply. Report names must end with a noun that identifies the item as a
report, rather than a window, table or other object.
Scripts
We use script names automatically applied to field, window and form scripts using
the auto-naming feature in Dexterity.
Procedures
Procedure names are written using the following format:
Procedure names start with the abbreviation for the module, followed by a word that
describes the action performed in the procedure, such as print, reconcile, add, delete
or create and so on. The main part of the name is the resource name of the object
that’s acted upon, such as a table, a report or another resource.
• MC_Verify_Currency_ID
• PM_Create_Vendor_Account_File
• UPR_Clear_Work_Files
If the script source is too large to fit into one script, split it into two or more sections.
Give each section the same name, but add a sequence number at the end of each script
to indicate its place in the sequence.
• RM_Open_Transactions_Logical_Table_1
• RM_Open_Transactions_Logical_Table_2
• RM_Open_Transactions_Logical_Table_3
Local variables
Local variables declared and used within a script should have the prefix (l_) (a
lowercase L), as shown in the following examples.
local string l_Customer_Number, l_Vendor_Number;
local integer l_Sequence_Number;
Native pictures
We use naming conventions for native pictures that are used with push buttons and
visual switches.
Names for native pictures used with push buttons indicate the control type, name,
position and whether the picture contains pictures, text or both:
PB_Note_Absent_Dn_TB_P
In the example above, the first part (PB) indicates that the native picture is to be
used with a push button data type, followed by the name of the button (Note
Absent). “Up” or “Dn” indicates the button position depicted by the native picture.
The location of the picture in the window is indicated by TB (tool bar), WA (window
area) and WCA (window control area). The last part denotes that the native picture
uses only a picture (P). The name will also indicate whether the picture uses text (T)
or pictures and text (P&T).
696 IN T E G R AT I O N G U ID E
A PP E ND IX A N A M I N G C O N V E N T I O N S
Names for native pictures used with a visual switch indicate the control type, name,
position and location they appear in the window:
VS_Stick_Pin_Dn_WCA
In the example above, the first part (VS) indicates that the native picture is to be
used with a visual switch data type, followed by the name of the button (Stick Pin).
“Up” or “Dn” indicate the position depicted by the native picture. The location of
the picture is indicated by TB (tool bar), WA (window area) and WCA (window
control area).
Abbreviations
Words in windows should be spelled out whenever possible. If abbreviations are
required, follow these guidelines:
• Don’t abbreviate words with four or fewer letters. Abbreviations for words of
this length doesn’t save much space, and might confuse the user.
• Specific table names should be capitalized, but the word “tables” should be
lowercase. For example, use “Customer Table” to refer to a specific table or table
group, but “General Ledger tables” to refer to all the tables in the General Led-
ger module.
Messages
Microsoft Dynamics GP uses the following guidelines for writing alert messages:
• State the information, error or problem clearly. Avoid technical jargon, descrip-
tions or explanations, and use easily-understood language. Messages should
give users a concise summary of the situation, in an encouraging manner, so
they can easily correct the problem, if necessary, and continue.
• Make the message as specific as possible. For example, use “Another user
updated this customer record since you opened it. Re-enter the customer infor-
mation and save again” instead of messages like “Can’t save record” or
“Another user updated this table already.”
• Don’t use the word “error.” Avoid messages that imply that the user made an
error. For example, use “Not all required fields have been entered” rather than
“Required field error.”
Punctuation
Be sure to use punctuation consistently throughout the application.
• Use closing punctuation (usually a period or question mark) at the end of warn-
ing dialog messages and alert messages. Do not use exclamation points after
messages.
• Use an ellipsis (...) after a menu item that brings up a window or dialog that
requires additional information be entered before an action (such as printing)
can take place. For example, Printer Setup... opens a window in which users can
specify the type of printer being used.
• Double-Space
• Year-End
• Month-End
• Quarter-End
698 IN T E G R AT I O N G U ID E
A PP E ND IX A N A M I N G C O N V E N T I O N S
Spelling
Microsoft Dynamics GP uses American English as their interface standard, so
international spelling variations may apply. In situations where more than one
spelling may be considered correct, follow these conventions:
• Use two l’s in words that may have either one or two, such as “totalling” and
“cancelled.”
Verb tenses
Use the present tense, not the past tense.
702 IN T E G R AT I O N G U ID E
G L O S S A R Y
Trigger
Functionality that allows an application to
respond to events in other dictionaries. To
create a trigger, you need to register it with
the runtime engine.
Unchunking
The process by which a chunk dictionary
updates the launch file with product
information, runs installation scripts, and
converts itself into a dictionary.
Unmodified dictionary
A “clean” Dynamics.dic dictionary that
contains no developer resources or direct
customizations.
Zoom
Also known as a “drill-down.” This is the
process of viewing a lower level of detail for
a given field. A zoom field is indicated by a
magnifying glass, or “zoom pointer.”
Zoom pointer
A special cursor that appears when the
pointer is over a push button field that has
the Zoom property set to True. Clicking
when the pointer is over such a field enables
users to “zoom” to the window where
records for the field can be added.
710 IN T E G R AT I O N G U ID E
I N D E X
database triggers (continued) DEX.INI file, copying from Microsoft Explorer_Get_Datatype procedure 343,
database events 95 Dynamics GP 11 356, 380
defined 705 Dexterity, setting up for development 11 Explorer_Get_DDL_Type procedure 345,
described 74, 95 disabling, triggers 77, 80 360, 381
example 34 DisassembleDictSpecificID procedure 212, Explorer_Get_Field_As_String_From_Tab
registering 75, 95 553 le procedure 344, 357, 381
registration example 95 display name, retrieving for Report List Explorer_Get_Object_Name procedure
restricting by form 96 report 317 354, 383
using ranges 96 Display procedure 500 Explorer_Get_Records_Background
working with table buffers 96 documentation, symbols and conventions procedure 368, 383
Date Restrictions, predefined action 577 3 Explorer_Get_SQL_Field_Info procedure
date values, formatting for lists 571 drill-downs, see zooms 348, 371, 385
dates drop dialogs Explorer_Get_SQL_Join_Info procedure
calendar drop-down 164 creating 220 348, 372, 386
width in windows 164 example 220 Explorer_Get_SQL_Override_Field_Nam
debugging, lists in Microsoft Dynamics for Action Pane actions 220 e procedure 350, 373, 387
GP 209 DYNSA user, described 407 Explorer_Get_SQL_Query_Fields
default columns procedure 373, 387
for card lists 246 E Explorer_Get_Table_Name procedure 342,
for transaction lists 282 Edit Launch file window, in Microsoft 356, 388
default values, for table columns 36 Dynamics GP 30, 48 Explorer_Get_User_Defined_Prompt
DEFAULTUSER task, described 394 enabling, triggers 77 procedure 388
Delete button ending scripts, for chunk dictionaries 458 Explorer_GoTo_Button procedure 351,
defined 705 errors, acting on list action errors 226 375, 389
described 125 execute() function 113 Explorer_Optimize_For_SQL procedure
guidelines 125 ExecuteAction procedure 347, 370, 389
script example 125 for card lists 266 Explorer_Process_SQL_Data procedure
delete database triggers for transaction lists 301 369, 390
described 98 ExecuteListAction procedure, for list Explorer_Remove_Column_From_Object
example 99, 100 actions 214 procedure 654
deleted resources 466 executing, list actions 220 Explorer_Remove_GoTo_Item procedure
deleted strings 465 Exists() function - Home Page 517 655
DeleteForListView() function -- Business Exists() function - list views 554 Explorer_Remove_Object procedure 656
Analyzer Reports 552 Exists() function - security role 615 Explorer_Search_Generic procedure 657
DeleteForListView() function -- Columns Exists() function - security task 616 Explorer_Set_SQL_Join_Info procedure
551 Exists() function - security task operation 661
DeleteForListView() function -- Options 617 Explorer_Set_SQL_Query_Field
550 Exists() function - security task role 619 procedure 663
DeleteSecurityForProduct() function 614 ExistsAsAction() function 556 Explorer_SQL_Search_Generic procedure
deleting, records using focus triggers 87 ExistsAsGroup() function 557 664
Destroy procedure 516 ExistsForUserID() function 678 Export To Excel, predefined action 577
Develop.cnk, see sample integrating expansion window, defined 705 Extract utility, defined 705
application expansions Extract window 450
DEVELOP.DIC creating 143-144 extracted dictionary, defined 705
see also sample integrating described 25, 143 extracting
application illustration 143 an application 449
defined 705 Expansions and Zooms, chapter 143-145 described 449
Developer Update utility, defined 705 Explorer, see SmartList installers to create a patch 487
Developing Integrations, chapter 7-12 Explorer_Add_Column_To_Object procedure 450
development dictionary procedure 642
defined 705 Explorer_Add_GoTo_Item procedure 645 F
described 9 Explorer_Add_Object procedure 647 FactBoxParameter_Add procedure 558
running in test mode 11 Explorer_Add_SubItem_To_ListView field focus triggers
development environment, setting up 11 procedure 651 described 92
development folder, creating for an Explorer_AddItem_To_ListView example 92
integration 11 procedure 648 field groups
development process for integrating Explorer_Check_Stop_Processing defined 705
applications procedure 652 described 166
checklist 9-10 Explorer_Fill_Range_DDLs_From_Field_I fields
described 9 D procedure 346, 360, 379 adding to Information Pane header
illustration 9 section 587
712 IN T E G R AT I O N G U ID E
I N D E X
Home Pages (continued) Integration Basics, part 6-22 List_SetFactBoxParameter procedure 584
setting internal index for user 520 Integration Components, part 24-69 ListObjState, composite for Report List
setting role for user 521 Intercompany ID, global variable 38 325
templates 412 Inventory, commonly used procedures 66 lists
triggers for 413 Invoicing, commonly used procedures 66 acting on action errors 226
actions 203, 211
I J Business Analyzer for 270
icon resource assembly, for Microsoft joins, for SQL tables in SmartList 348, 372, card lists 204, 243
Dynamics GP 172 661 categories 205
icons, for commands 172 checking action access 217
images K clearing marked items after refresh
for Action Pane items 213 key fields, from main dictionary tables 33 223
for Area Pages 496 constants for list IDs 215
for commands 172 L creating columns 543
industries, for grouping roles 411 launch files
customization 203
Information Icon contents 8
debugging 209
clearing state value for 566 defined 706
displaying in separate window 206,
setting for list row 252, 286 described 7
580
setting state value for 568 dictionary location IDs 8
features 203
verifying state value 567 dictionary locations 8
filtering capability 203
Information Pane editing 30, 48
filters for 203
adding column to line items section for integrating applications 8
Information Pane 229
586 illustration 8
limit to number open 206
adding content to 229 information for Windows Installer
list IDs for 215, 275, 307, 561
adding field to header section 587 480
logging status for actions 223
adding line item to line items section product names 8
marked rows table
588 layout priority, for Action Pane buttons
returning index used for 563
adding to card list 267 213
returning number of rows 562
adding to for custom lists 229 license agreement, for template installer
returning reference to 564
adding to transaction list 302 481
Message Bar usage 223
adding values to line item 589 light bulb symbol 3
navigation 205
chapter 229-241 line items
opening from code 206, 580
creating XML document for 590 adding to Information Pane 588
overview 203
described 229 adding values to for Information
part 202-308
formatting data for 256, 292 Pane 589
performing actions for marked rows
header 230 LinePre procedure
222
layout 229 for card lists 272
predefined actions 203
line items 231 for transaction lists 304
refresh event 223
procedure reference 232 linking prompts to fields 165
registering actions and groups 217
saving XML document for 593 list customization, security operation for
Report List 309
information pane, security operation for 396
report lists 205
396 List Debugging Tools, described 209
retrieving list ID 561
InfoValue column, for card lists 245, 281 list fields, filter tokens for 258, 294
retrieving number of rows marked
InfoValue_ClearState() function 566 list IDs
223
InfoValue_IsStateSet() function 567 assigning to card lists 275
retrieving restriction parameters 208
InfoValue_SetState() function 568 assigning to transaction lists 307
roles for sharing 410
Initialize procedure List Overview, chapter 203-210
scripts used for 523
for card lists 272 List_FormatBoolean() function 569
search 203
for transaction lists 304 List_FormatCurrency() function 570
security IDs for 395, 608
installation files, defined 705 List_FormatDate() function 571
security operations for 396
installation scripts List_FormatInteger() function 572
transaction lists 204, 279
common tasks 455 List_FormatPhone() function 573
types of 204
defined 705 List_FormatQuantity() function 574
verifying whether open 206
described 455 List_FormatString() function 575
view IDs, returning 565
installer, see Windows Installer List_FormatTime() function 576
views 275, 554
installer project, editing 479 List_GetIDsForCoreCommand procedure
LoadListView procedure 621
installer template 577
LoadMode, adding menus to Microsoft
chapter 477-483 List_MultiSelectActionCompleteEvent
Dynamics GP 182
overview 477 procedure 579
local variables, naming conventions 700
using 477, 478 List_Open procedure 206, 580
long integer values, formatting for lists
integer values, formatting for lists 572 List_RegisterAction() function 582
572
List_RegisterGroup() function 583
714 IN T E G R AT I O N G U ID E
I N D E X
716 IN T E G R AT I O N G U ID E
I N D E X
Report List (continued) restricting database triggers 96 sample report list, described 16
triggers, to retrieve report restriction parameters, for lists 208 sample report options form, described 15
information 316 Restrictions, predefined action 577 sample reports, described 17
triggers for 310 Restrictions Group, for Action Pane 577 sample reports form, described 14
viewing reports 321 reviewing changes to new versions of sample setup form, described 14
when to add reports 311 Microsoft Dynamics GP 468 sample SmartList object, described 15
report lists ribbon, see Action Pane sample transaction list, described 16
described 205 roles sample trigger form, described 13
verifying whether open 207 see also security roles Save button
report options windows, use with adding additional roles 410 described 126
template reports 59 adding for Home Pages 508 guidelines 126
report types, for Report List 310 building Home Page for 412 script example 126
Report Writer, defined 706 displaying description for 411 saving records
Report Writer (runtime) for Home Pages 409 using focus triggers
reports dictionary 47 unique ID for 411 described 85
using to modify reports 47 using for list view sharing 410 example 86
Report Writer functions rows, marked rows for list actions 222 ScBar_AddDexForm() function 628
list of used to access report data 54 runtime engine, defined 706 ScBar_AddExternalFile() function 629
using to access report data 49 rw_ReportEnd() Report Writer function 57 ScBar_AddFolder() function 630
ReportDestOptions, composite for Report rw_ReportStart() Report Writer function ScBar_AddMacro() function 631
List 325 56 ScBar_AddUrl() function 632
reporting currency, defined 706 rw_TableHeaderCurrency() Report Writer ScBar_ItemExists() function 633
reports function 54 script logger
adding to Home Pages 415, 507 rw_TableHeaderString() Report Writer defined 706
adding to Report List 311, 535 function 54 using with procedures 64
alternate reports 43 rw_TableLineCurrency() Report Writer Script Reference, part 492-680
chapter 43-61 function 55 scripts
controlling access to 48 rw_TableLineString() Report Writer for browse buttons 120
creating alternate reports 44 function 56 for sort lists 121
in Report List 310 installation scripts 455
modifying with the runtime Report S naming conventions 700
Writer 47 ”sa” user, described 407 on Microsoft Dynamics GP forms 27
naming conventions 699 Sales Order Processing, commonly used scrolling window focus triggers
Report Writer functions procedures 68 described 90
examples 50 sample card list, described 15 example 91
retrieving third-party data 49 sample data, for sample integrating secondary, Action Pane button position
scripts used for 603 application 19 213
security IDs for 395, 608 sample inquiry form, described 14 secondary lookup controls
template-enabled reports 57 sample integrating application defined 706
testing in a multidictionary accessing 18 described 130
environment 47 chapter 13-22 sections, adding to Home Pages 511
Word templates for 57 contents 13 security
reports dictionaries installing 18 adding for integrating applications
creating 47 navigation 17 394
defined 706 overview 13 checking security access 398, 622
location 47 sample card list 15 deleting for integrating applications
updating 470 sample data 19 400
Reports lookup, making template-enabled sample inquiry form 14 determining SQL Server user role 626
reports visible 57 sample maintenance form 13 “DYNSA” user 407
required fields sample report list 16 excluding resources from security 399
creating 163-164 sample report options form 15 for command forms 171
defined 706 sample reports 17 for commands 173
described 163 sample reports form 14 for metrics 418
displaying 163 sample setup form 14 for SmartList objects 354
reregistering triggers 76 sample SmartList object 15 Microsoft Dynamics GP security
resource ID, retrieving for Report List sample transaction list 16 model 393
report 316 sample trigger form 13 reports for 394
resource name guidelines 691 source code 21 “sa” user 407
resources using 13 scripts used for 607
deleted 466 Word templates for 19 SQL Server 407
name conflicts 466 sample maintenance form, described 13 system password 406
718 IN T E G R AT I O N G U ID E
I N D E X
720 IN T E G R AT I O N G U ID E
I N D E X
722 IN T E G R AT I O N G U ID E