Generate title in a form

  • 27 November 2022
  • 1 reply
  • 112 views

Basic question

 

I just want to creat a unic title with 2 colum (drop down menu) date and item ID.

 

Ex: choice#1-choice#2-2022-1234

 

Witch code do i need?

 

Sorry for my english


1 reply

Userlevel 5
Badge +13

You can accomplish this using a Calculated Value control on your form. In my "how to" details below, I am using the Responsive Form designer in SharePoint 2013. Your set up could be different, but this solution should also work in other SharePoint on-premise environments.



Follow these steps:



  1. Add a Calculated Value control to the form.

  2. Configure the Calculated Value control you just added with these settings (see image below):

    1. Name = GeneratedTitle (or whatever name you would like).

    2. Title = Generated Title (or whatever you would like).

    3. Connected to = SharePoint list column you would like to store the result in (if you want to save the value to a list column).

    4. Formula =
      SelectChoice1 + "-" + SelectChoice2 + "-" + formatDate(Current Date,"yyyy") + "-" + ID

    5. Notes on the Formula in the Calculated Value control:

      • SelectChoice1 and SelectChoice2 are the names of the Choice controls on the form.

      • formatDate is a Runtime Function (more information about Runtime Functions).

      • Current Date is found on the Common tab in the Formula Builder of the Calculated Value control.





  3. Preview the form to test this functionality.

  4. Save / Publish the form.

  5. Note: The ID will be missing in the calculated value on a new form and also will not be there when you create a new item. This is because a list item ID is not assigned until the item is first created. The ID will show up in the formula on the form when you open and save the form after the item was initially created.

  6. If you want the ID to show up in the formula when the list item is first created, you will need to use workflow actions to build the title and update the list item.


Reply