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.

[spacer]

Global field

Description

Button

Note Absent Button - Toolbar

Indicates the absence of a note for the window.

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.

Accessing window-level notes

Window-level notes are available on a company-wide basis, meaning that a note applied to a window in company A can be viewed by all users who access that window in company A, but not in company B. A different note can be applied to the same window in company B.

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.

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.

Storing window-level notes

Window-level notes are stored in the SY_Notes_MSTR table (SY00700). The layout of this table is shown in the following table:

[spacer]

Field

Control type

Storage size

Description

Note Name

String

46

Stores the display name of the window. This field is the key for the table.

Date

Date

4

Stores the system date when the note record was last updated by the user. This date is displayed in the Note window.

Time

Time

5

Stores the system time when the note record was last updated by the user. This time is displayed in the Note window.

Display Name

String

82

Stores the window’s display name that’s returned by the Window_GetTitle() function. This is the window name that’s displayed in the Note window.

Text Field

Text

0...32,000

Stores the note text entered by the user in the Note window.


Using procedures

The following table explains each of the Microsoft Dynamics GP procedures used to implement window-level notes.

[spacer]

Name

Description

Check_Note_ID_String

This script ascertains which of five possible note forms are currently 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_To_Open

This script ascertains which note form is currently open (if any) 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_Note

This script checks the SY_Notes_MSTR table to ascertain whether a note record exists for the window.


Adding window-level notes

To add window-level notes to a window in your application, display the window’s layout and complete the following steps.

  1. Add note fields to the window.

Add the following fields to the window’s layout:

[spacer]

Global field

Position

Field properties

Note Absent Button - Toolbar

Position this field in the window status area in the lower-right corner of the window.

NA

Note Present Button - Toolbar

Position this field directly over the Note Absent Button - Toolbar field.

NA

Dummy Note Show Hide

Position this field off the window layout area.

Visible=False

Editable=False

SetChangeFlag=False


  1. Attach a change script to the Note Absent Button - Toolbar field.

This script determines whether a note record exists in the SY_Notes_MSTR table for the current window:

local string l_Note_ID, l_Display_Name;
local boolean isthere;
local integer l_exists, form_number;

{Retrieve the current display name of the window. This
 will be displayed in the Note window when it's opened.}
l_Display_Name = Window_GetTitle(window Lead_Maintenace of form IG_Lead_Maintenance);

{Use the window display name as the key for the SY_Notes_MSTR table.}
l_Note_ID = "Lead Maintenance";

{Checks for multiuser conflicts}
call Check_For_Note, l_Note_ID, l_exists;
if 'Dummy Note Show Hide' = 1 and l_exists = 0 then
	warning "This note has been deleted since you opened the window.";
elseif 'Dummy Note Show Hide' = 0 and l_exists = 1 then
	warning "This note has been created since you opened the window.";
end if;
isthere = false;
form_number = 0;

{---------------------------------------------------------
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;

elseif form_number = 2 then
	open form Form_Note_2 return to 'Dummy Note Show Hide';
	'Note ID' of window Form_Note_2 of form Form_Note_2 = l_Note_ID;
	'Display Name' of window Form_Note_2 of form Form_Note_2 = l_Display_Name;
	if not isthere then
		run script '(L) Dummy WIN PRE' of window Form_Note_2 of form Form_Note_2;
	end if;
elseif form_number = 3 then
	open form Form_Note_3 return to 'Dummy Note Show Hide';
	'Note ID' of window Form_Note_3 of form Form_Note_3 = l_Note_ID;
	'Display Name' of window Form_Note_3 of form Form_Note_3 =  l_Display_Name;
	if not isthere then
		run script '(L) Dummy WIN PRE' of window Form_Note_3 of form Form_Note_3;
	end if;

elseif form_number = 4 then
	open form Form_Note_4 return to 'Dummy Note Show Hide';
	'Note ID' of window Form_Note_4 of form Form_Note_4 = l_Note_ID;
	'Display Name' of window Form_Note_4 of form Form_Note_4 = l_Display_Name;
	if not isthere then
		run script '(L) Dummy WIN PRE' of window Form_Note_4 of form Form_Note_4;
	end if;

elseif form_number = 5 then
	open form Form_Note_5 return to 'Dummy Note Show Hide';
	'Note ID' of window Form_Note_5 of form Form_Note_5 = l_Note_ID;
	'Display Name' of window Form_Note_5 of form Form_Note_5 = l_Display_Name;
	if not isthere then
		run script '(L) Dummy WIN PRE' of window Form_Note_5 of form Form_Note_5;
	end if;
end if;

  1. Attach a change script to the Note Present Button - Toolbar field.

The following script runs for script on the ‘Note Absent Button - Toolbar’ field. It retrieves an existing note record, then determines which note form to open.

run script 'Note Absent Button - Toolbar';

  1. Attach a change script to the Dummy Note Show Hide field.

This script runs each time the window pre script runs (see step 5), and checks for an existing note record for the window. If one exists, it sets the window-level note button to display a “filled sheet.” Otherwise, it displays a “clean sheet.”

local string str_note_ID;
str_note_ID = "Lead Maintenance";

{----------------------------------------------------------
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.
----------------------------------------------------------}

call Check_For_Note, str_note_ID, 'Dummy Note Show Hide';

if 'Dummy Note Show Hide' = 1 then
	hide 'Note Absent Button - Toolbar ';
	show 'Note Present Button - Toolbar';
else
	hide 'Note Present Button - Toolbar';
	show 'Note Absent Button - Toolbar ';
end if;

  1. Attach a window pre script.

This script runs the change script attached to the ‘Dummy Note Show Hide’ field, which determines whether a note record exists for the window and displays the appropriate note button.

disable 'Delete Button';
set 'Sort By' to 1;

hide 'Note Present Button - Toolbar';
show 'Note Absent Button - Toolbar ';
run script 'Dummy Note Show Hide';

focus 'Lead ID';


Documentation Feedback