Left_Next_Arrow_Blue_Bkgd_Icon

Right_Next_Arrow_Blue_Bkgd_Icon

Creating Name Templates

Name Templates allow you to create a naming scheme for your documents or forms, and to automatically generate a unique name each time a document is checked in or a form is started. You can create as many Name Templates as needed for your environment. This section describes how to create a name template, and then link the template to a document or form.

Implementing automatic form naming requires these steps:

The following sections provide instructions for these steps.

Specifying a Unique Identifier

To specify a unique identifier to be used in your Name Template, do the following:

  1. In Designer, open the Document Workflow or Form Workflow site for which you want to create a Name Template.
  2. On the Tools menu, click Name Template to open the Name Template dialog box.

  3. Click Add.

    The New Name Template dialog box appears.
  4. In the Name field, type a name for your name template, and then click OK.

    Your new template is added to the Name Template dialog box.

  5. With your new Name Template highlighted in the Templates list, click Modify.

    The Edit Name Template dialog box appears.

  6. Click Add.

    A new line is added for the default six-digit component.

  7. Select the first entry (the name template that you just created) from the list, and then click Modify.

    The Modify Name Component dialog box appears.

  8. From the Type drop-down list, select one of the following options:
  9. In the Value text box, type the value that you want your name scheme to begin with.

    See the examples in step 9 for details.

  10. Click OK.
  11. Click OK on the Edit Name Template dialog box.
  12. The Name Template dialog box appears.
  13. Click Save.
  14. Click Done.

    Example:

    You will need one entry for anything you want to generate. In the following example, there are 2 entries. The 1st entry will be generating a letter of the alphabet beginning with the letter A. The 2nd entry will be a 6-digit number starting with 000001. The first form that is submitted will thus be assigned A000001.

  15. Click Add. A new entry is added:

  16. Because we want the letter to be first, we'll modify the first entry of my name template. Select the 1st entry, and then click Modify.
  17. Change the Type from Number to Alphabetic.
  18. Next to Value, type the letter A.

  19. Click OK twice, and then click Close.

Configuring the ShareVis.FormName Control to use the newly created Name Template:

  1. Add the ShareVis.FormName Control to your form.
  2. Right click on the control and go into its properties.


  3. In the Template Name & Fields property, enter the name of the template you just created

    TIP: It is a good idea to select Run At End so the form name isn’t generated until the very end. This will prevent the form from taking up numbers and creating gaps in your generated form name.

  4. Click OK to publish your form and your workflow.

Additional Information/Options:

If you want more information to be populated in your form, the following information is also available:

Refer to the above table at the beginning of the document for further explanation on what each of these attributes provide. To use any of these attributes, you will need to create a textbox within your form and provide the field name. See the following example:

Linking a Name Template to a Document

To enable a Name Template to be applied to a specific document, you must link the Name Template to the document.

To link a Name Template to a document:

  1. In the document library, create a column that will contain the results of the name template generation. 
  2. Set the default value of the column to the initial value of the name template. 

    For example, create a column named MyRevision with a SharePoint Type of Single Line of Text and default value of 0000.

  3. Create a name template in Designer, for example, MyNameTemplate that is a running four-digit number.

    In your workflow where you would like to set the column value, add a plug-in and set it to the Set Column plug-in.

  4. Set the Name in the plug-in to the column name. 

    For example, [MyRevision].

  5. Use the $Revision function in the plug-in's value field to calculate the next value in the sequence using the name template and the value in the column. 

    For example, $Revision(MyNameTemplate, [MyRevision]).  The plug-in configured in this way will set the column value in MyRevision to the next value in the sequence.  In this example, it will set the MyRevision field to 0001 on the first run, 0002 the next time the workflow is run, etc.

Linking a Name Template to a Form

To enable a Name Template to be applied to a specific form, you must link the Name Template to the form using the ShareVis.FormName custom control.

To link a Name Template to a form:

  1. Start InfoPath and open the form you want to link to a Name Template in Design Mode.
  2. Click at the bottom of the form. Add a Text Box control to the form and rename it formID
  3. Click Controls on the right side.
  4. Scroll to the Custom Controls area and click ShareVis.FormName.

    The control is added to the form.

  5. Double-click the ShareVis.FormName icon on your form.

    The FormName Properties dialog box appears.

  6. Click the Form Name tab.
  7. In the Template Name & Fields text box, type the name of the Name Template you created in the previous section.
  8. In the Field Name XPath text box, type formId.

    This copies the new name generated by the name template into the fromid field each time a new form is started.

See Also

Email Approve or Reject

Plug-ins

Labeled Assignments

Exporting Workflow Data into a Database or SharePoint

Configuring Bulk Assignment/Reassignment approval

Running Webservices