You are here: Getting Started > Tutorials > Tutorial 1: Creating a Time Off Request Form > T1-10. Assigning unique form names

Tutorial 1–Step 10: Assigning Unique Names to Forms

Name Templates allow you to create a naming scheme for your forms, and to automatically generate a unique name each time a form is started. You can create as many Name Templates as needed for your environment. For this example, you will create a Name Template for AlphaOne Bank to ensure automatic and consistent naming of their Time Off Request forms.

Implementing automatic form naming requires two steps:

  • Creating a Name Template
  • Adding the ShareVis.FormName custom control to your form to link the Name Template to the form

Configuring automatic form naming

  1. Sign in as Steve Designer.
  2. In Winshuttle Designer, from the Tools menu, click Name Template.

    Note: If you have closed Winshuttle Designer since completing the previous steps in this guide, you must type the URL for your HR Forms Form Workflow site in the Site text box.

  3. Click the Add button.

    The New Name Template dialog box appears.

  4. In the Name box, type Time Off Request.
  5. Click OK. The new template is now added to the Name Template dialog box.
  6. With the Time Off Request template highlighted in the Templates list, click Modify.
  7. In the Edit Name Template dialog box, click Add to add a new line for the default six-digit component.
  8. Select the first entry in the list, and then click Modify.
  9. In the Modify Name Component dialog box, next to Type , click the drop arrow, and then select Constant.
  10. In the Value box, type TOR-.
  11. Click OK.
  12. Click OK.
  13. Click Save and then click Done.
  14. Start Designer, and then open the solution Time Off Request solution file.
  15. Click the bottom of the form.
  16. On the right-hand side, click Controls .
  17. Scroll to the Custom Controls area, and then click ShareVis.FormName. to add the control to the form.
  18. Double-click the ShareVis.FormName icon on your form.
  19. In the ShareVis.FormName Properties dialog box, click the Form Name tab.
  20. In the Template Name & Fields box, type Time Off Request.

    This is the name of the Name Template you created earlier.

  21. In the Field Name XPath box, type formId. This copies the new name generated by the name template into the Form ID box each time a new form is started.

  22. Click OK.
  23. Save your changes in InfoPath.
  24. Close InfoPath.
  25. In Designer, click Save Solution.
  26. On the File menu, click Publish Solution.
  27. Go to the HR Forms Form Workflow site.
  28. Click the New Form button to start a new Time Off Request form.

    The new form appears and the Form ID box shows TOR-000001. Each time a new Time Off Request form is started, the Form ID box will be incremented by one.