Modify the SP Global Change Spec Header and Add Parameters

Previous: Add the Global Change Spec

Step 1 -  Review the Global Change Spec XML.

Review the boilerplate GlobalChangeSpec xml file.

You should notice that the GlobalChangeSpec element's Name, Description, Author, DisplayName, GlobalChangeFolder, and SPName attributes need to be altered. In addition, the name of the stored procedure within the CREATE PROCEDURE T-SQL Data Definition Language statement requires changing. The stored procedure name should match the name of the SPName attribute.

Notice the @FIELD1 and @FIELD2 parameters within the stored procedures. These correlate to the boiler plated form fields found within the FormMetaData tag at the bottom of the spec. Both of these parameters and form fields need to be modified.

Within the body of the stored procedure, we will perform the logic for our global change, utilizing the parameters to narrow the rows processed.

Step 2 -  Modify the spec header

Open the FoodBankTX.DeleteHistory.GlobalChange.xml spec file and modify the GlobalChangeSpec element. We will modify the Name, Description, Author, DisplayName, GlobalChangeFolder, and SPName attributes to look something like this. Your ID attribute value will vary since the catalog item template defaults each new spec with a unique GUID value.

Tip: Note the use of (Custom) to help future-proof the display name of our spec against potential upgrade conflicts. After it is loaded into the catalog system (database), the GlobalChangeSpec will be stored within the GlobalChangeCatalog table that contains a unique index on the DisplayName column. For spec naming and coding standards, see Best Practices.

Step 3 -  Add a single UI Parameter by modifying the ParametersFormMetaData Element

With the spec file, let's replace the boiler plate form field parameters with a single date parameter for the user interface. We are going to modify the ParametersFormMetaData element 's FormMetaData child element by adding one form field. The form field will represent a user interface parameter. When the end user configures a new global change instance from a definition, the user will supply the values for the parameter using this form fields.

Note: For more information on parameters within a global change, see the ParametersFormMetaData element within Exploring a GlobalChangeSpec.

The single parameter will represent a "Transactions older than" date. The end user will select a date and the global change will delete transaction header records where the transaction date is less than the user provided "Transactions older than" date parameter.

Add the Form Field for the Date

Within the global change spec, add the following FormField tag to your FormMetaData element. This adds a user interface control to the parameter's section of the global change instance screens used to manage global change instance. This user interface control will allow the end user to select a date.

<FormMetaData xmlns="bb_appfx_commontypes">
	<FormFields>
		<FormField FieldID="OLDERTHAN" Caption="Transactions older than" DataType="Date" />
	</FormFields>
</FormMetaData>

Step 4 -  Remove or comment out the FormUIComponent tag

Within the GlobalChangeSpec, remove or comment out the FormUIComponent tag from ParametersFormMetaData. With the tag removed, the system will render a simple user interface containing our three form fields.

Note: The FormUIComponent tag is a relic from the ClickOnce Smart Client user interface days. The existence of FormUIComponent signifies that a conversion to a UI Model is necessary to view the feature in the Web Shell user interface. You don't want to use FormUIComponent since the ClickOnce Smart Clientultimately will be retired and replaced by the Web Shell user interface. For more information, see Frequently Asked Questions in the User Interface section of the User Guides.

Below is look at the bottom half of our spec. At this point your GlobalChangeSpec's ParametersFormMetaData element should include the one form field and look something like this. Note that I have removed the FormUIComponent tag.

Figure: Our new form field provides a user input parameter for our global change.

Next: Code the SP Logic