Form Generator utility to generate MT/MX InfoPath 2007 forms

Contents

Form Generator utility to generate MT/MX InfoPath 2007 forms

Introduction

Implementing the Sample

Syntax of Command usage for FormGenerator.exe

Examples of MT Messages

Generation of Category 0 and MT121 Forms

Examples of MX Messages

Generation and publishing of MT/MX forms on the SharePoint site

Publishing the MT Message Instance file (creating new messages)

Publishing the MX Message Instance file (creating new messages)

Multiple Views of MX InfoPath forms

Introduction

The purpose of this document is to explain how to generate and publish MT and MX InfoPath 2007 forms using Form Generator Utility. These forms are used by the Message Repair and New Submission feature of A4SWIFT 2009.

Implementing the Sample

To implement the sample, proceed as follows:

1. Create a new folder for SWIFT schemas (<DocumentSchemaLocation> in the utility syntax). All schemas for which you are going to create/modify the InfoPath forms must be located in this folder when you execute the utility.

2. If you are generating InfoPath forms for MT messages then Copy “SWIFT Base Types.xsd” and “SWIFT Common Data Types.xsd” from <drive :> \Program Files\Microsoft BizTalk Accelerator for SWIFT <Message Pack Version> Message Pack\SWIFT Messages\A4SWIFT-SRG<Message Pack Version>\Base Schemas into the folder that you created for SWIFT schemas.

3. Copy all schemas for which you are going to create InfoPath forms into the folder that you created for SWIFT schemas in the step 1 above.

4. Create or designate a folder to hold the created InfoPath form template solution files (<DestinationFolderPath> in the utility syntax). If you do not create the output folder, the utility will create the same with path and name that you pass on the command line.

5.[Optional]- Create a text file <NameOfFileContainingSchemaList> that lists the message types for messages for which the InfoPath form is to be generated. For e.g.Message Type can be MT103, MT102 etc. The Message names can directly be passed through the command line instead of creating this text file.

Syntax of Command usage for FormGenerator.exe

FormGenerator[-b] [-#] <TemplateFolderPath> [<TemplateFolderPath2>

[...<TemplateFolderPath#>]]

<DestinationFolderPath> <DocumentSchemaLocation

{ [<SpaceSeparatedDocumentSchemaList>] | [-f <NameOfFileContainingSchemaList>] }

Where:

1)-b: If specified, forms will be compiled after creation.

2)TemplateFolderPath: the folder containing the template files used to create the InfoPath solution

3)-#: If specified, templates will be looked up in multipletemplate paths (as many as the integer number # specifies) and in the order specified.

4)DestinationFolderPath: the folder where the forms will be created

5)DocumentSchemaLocation: location of schemas (including base and common schemas for MT messages)

6)SpaceSeparatedDocumentSchemaList: space-separated list of schemas like MT103 MT300.

7)-f: If specified, the schema list needs to be read from a file.

8)NameOfFileContainingSchemaList: name of file containing the list

Note: The above command is a generic command for MT, MX and Category 0 messages. Specific commands to generate these types of forms are given in the below sections.

Examples of MT Messages

Commands to generate the solution (InfoPath form template) for the Different MT messages:

The following examples require that the "SWIFT Base Types.xsd", "SWIFT Common Data Types.xsd","MT102.xsd", "MT500.xsd", and "MT103.xsd" schemas are all in c:\schemas. This will generate the solution for InfoPath Form Template in the "C:\GeneratedForms" folder. The folder name of the solution would be same as the name of the message for which the InfoPath form needs to be generated. These examples assume that the utility has been placed in “C:\FormGeneratorUtility2008” folder. Replace the location that you have selected for the utility in the below commands.

To generate a form for the MT103 schema:

FormGenerator.exe -b “C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas MT103

To generate a form for the MT103, MT102 and MT500 schema:

FormGenerator.exe -b “C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas MT103 MT102 MT500

To generate a form for the MT103 schema(from the file):

FormGenerator.exe -b “C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas -f P1forms.txt

You can find the snapshot of an MT InfoPath form getting generated below:

Generation of Category 0 and MT121 Forms

Category 0 and MT121 InfoPath forms generation require different template files. Category 0 forms are divided into 5 categories. General categories messages are generated in the same way as do the rest of the MT categories. Examples of other 4 categorieswith their message names are given below:

To generate category 0 GAHeaderforms (MT036,MT042,MT047,MT072,MT077,and MT085):

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\GAHeader” "C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas -f GAHeaderForms.txt

To generate category 0 NoTextBlocksforms (MT035,MT043,MT048,and MT049):

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\NoTextBlocks” "C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas –f NoTextBlocksForms.txt

To generate category 0 NoTrailerforms (MT021):

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\NoTrailer” "C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas –f NoTrailerForms.txt

To generate category 0 NoTrailerTextBlocksforms (MT082):

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\NoTrailerTextBlocks” "C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas –f NoTrailerTextBlocks.txt

To generate category 1NoHeaderTextBlockforms (MT121):

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\NoHeaderTextBlock” "C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas -f NoHeaderTextBlockForms.txt

Examples of MX Messages

Command Lines to generate the solution (InfoPath form template) for the Different MX messages:

The following examples require that the “pacs.004.001.01" and “pain.002.001.01” schemas are all in c:\schemas. This will generate the solution for InfoPath Form Template in the "C:\GeneratedForms" folder. The folder name of the solution would be same as the name of the message for which the InfoPath form needs to be generated. These examples assume that the utility has been placed in “C:\Program Files\Microsoft BizTalk Accelerator for SWIFT\SDK\FormGeneratorUtility” folder. Replace the location that you have selected for the utility in the below commands.

To generate a form for the pacs.004.001.01 schema:

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\MXTemplates” "C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas pacs.004.001.01

To generate a form for the pacs.004.001.01and pain.002.001.01 schema:

FormGenerator.exe -b -2 “C:\FormGeneratorUtility2008\MXTemplates” “C:\FormGeneratorUtility2008\TemplateDS\InfoPath Form Template" c:\generatedforms c:\schemas pacs.004.001.01 pain.002.001.01

You can find the snapshot of an MX InfoPath form getting generated below:

Generation and publishing of MT/MX forms on the SharePoint site

1.)Download the Form Generator Utility and save it locally on the machine.

2.)Open the “FormGenerator.sln" from the folder downloaded above and compile the solution.

3.)At a command prompt, move to the folder of compiled executable (FormGenerator.exe).For e.g. if you have built the utility in debug mode, move to ..\bin\debug folder.

4.)Type FormGenerator.exe [-b] [-<No. of Template folder paths>]

<TemplateFolderPathDestinationFolderPathDocumentSchemaLocation> {[SpaceSeparatedDocumentSchemaList>] | [-f <NameOfFileContainingSchemaList]} with the parameters replaced by the folders created above.

5.)The above command will also generate the Envelope schema needed for MX message repair.

6.)Go to output folder <DestinationFolderPath>. In <DestinationFolderPath>, open the folder of the InfoPath form template for which you want to generate the form. Let’s say, if you want to generate the MT103 InfoPath form, then open the MT103 folder at the DestinationFolderPath and open the TemplateDS.sln.

7.)In the Solution Explorer, double click the manifest.xsf. It will open the design file of the InfoPath form which will take some time to get opened.

Note: The MX messages manifest.xsf might take 2-5 minutes to get opened.

8.)In the manifest.xsf, go to Tools ->Form Options-> Security and Trust" menu option. Check the "Full Trust" option must be enabled for the permission.

9.)Check the box "Sign this form Template" as shown in the snapshot below. Click on "Select certificate". In this, select the certificate with which you want to sign the form. Click ok.

10.)Save the manifest.xsf.

11.)Go to View -> Design Tasks. On the Design Tasks pane, click "Publish Form Template" option as shown below.

12.)In the publishing wizard window, select "To a network location" and click next.

13.)In the "Form template path and file name" textbox type: " and type MessageType in the Form Template name textbox and click next.

14.)Click Next.

15.)Click Publish and close.

16.)In Internet Explorer, open your SharePoint site at

17.)Point to MessageType, click the down arrow next to it, and then click Edit Properties.

18.)In the Templates :< MessageType window, in the Namespace box,

If you are generating MT InfoPath forms, type:

If you are generating MX InfoPath forms, type:

This will help in identifying the message instance with the corresponding template.

19.)Click Save and Close.

Publishing the MT Message Instance file (creating new messages)

1.) Go to output folder of the InfoPath form template generated above,..\MTXXX\TemplateDS\InfoPath Form Template.

2.) In Internet Explorer, open

3.) In New Swift MT Messages window, click Upload.

4.) In the Upload Document window, click Browse.

5.) In the Choose file dialog box, move to the output folder of the InfoPath form generated above, ..\MTXXX\TemplateDS\InfoPath Form Template.Select the MTXXX.xml file such as MT103.xml and then click Open.

6.) In the Upload Document window, click ok.

7.) In the New SWIFT MT Messages:MTXXX window, in the Namespace box, type and then click Ok.

Publishing the MX Message Instance file (creating new messages)

1.) Go to output folder of the InfoPath form template generated above, ..\<MessageType>\TemplateDS\InfoPath Form Template.

2.) In Internet Explorer, open

3.) In New Swift MX Messages window, click Upload.

4.) In the Upload Document window, click Browse.

5.) In the Choose file dialog box, move to the output folder of the InfoPath form generated above, ..\<MessageType>\TemplateDS\InfoPath Form Template. Select the <MessageType>.xml file such as pacs.004.001.01.xml, and then click Open.

6.) In the Upload Document window, click ok.

7.) In the New SWIFT MX Messages: <MessageType> window, in the Namespace box, type and then click Ok.

Multiple Views of MX InfoPath forms

The MX InfoPath form templates might be divided into separate views. If the total number of fields in the schema is large, then there will be different views of the same template otherwise there will be only a single view of the template.

While doing the Message Repair in the Message Repair and New submission workflow, the different views of the message can be browsed from the View Menu as shown below:

Note: Even if the field containing error is not in the default view, then also the name of the field can be seen from the validation window in the task pane. The corresponding field can be searched manually in all the other views. Once the Message becomes completely valid, then the form can be submitted from any of the views. Switching between the larger views might take 1-3 minutes for the view to get properly loaded and opened.