Custom Document Identifier
With this example you can create unique identifiers of any complexity in any SharePoint objects. You don’t need any special programming skills or code writing.
Custom Document Identifier provides you with the ability to tag documents with a unique identification number.
To start, create a new list where you will be creating the new text field or go to an existing list. Then go to Settings > Create Columns.
Title the name of your new field as “Document ID”. If you have Virto Custom Mask and Unique Field Validation installed, a list of column types will be available. Select “Virto Custom Mask”.
Once column type is selected, visual field editor will be available. It consists of several blocks.
Block 1 defines unique scope, automatic field case and separator between elements.
You can define the unique scope. The following options are available:
[Not use] – fields are not validated whether or not they are unique;
Current List – field value must be unique within the current list;
Current Site – field value must be unique within the site and all columns with the same name;
Must Have Matching Field Name and Type – field value must be unique within the current site collection and in all lists and all columns with the same name.
Block 2 contains mask preview which is refreshed automatically, but you can also refresh it manually by clicking the “Refresh” button.
Block 3 allows adding, deleting and adjusting mask elements. You can add elements with the following types:
Text – any text value;
Date/Time – current date/time in free form;
Existing Column Value – value from existing field;
Site Name – name of site;
List Name – name of list;
Number – numeric value, auto increment is also supported (depending on unique scope type).
Let’s now create a unique identifier which will contain prefix, current date, unique number and custom string code.
First of all, define the basic settings as follows: Unique Scope to be “Current List”; Field Case to be “Default”; and Separator to be “-“. It should look as below.
Now define the text prefix. Select “Text” in the mask item type field and click “Add”. Then enter “MYPREFIX” as the prefix and click “Refresh”. Here’s how it should look like:
You will then need to add current date. In order to do this, select “Date/Time" in the mask item type and click “Add”. Then define the required data format.
Note: you can select predefined date/time formats or use custom ones. Please use the following links for reference on date and time formats:
You will get the fields structure as shown on the picture below:
You can now define the auto increment number. Select “Number” in the mask item type and click Add. Check the box “Auto increment” in the new block. Then click “Refresh” to show all the changes in preview.