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:
- Add a Calculated Value control to the form.
- Configure the Calculated Value control you just added with these settings (see image below):
- Name = GeneratedTitle (or whatever name you would like).
- Title = Generated Title (or whatever you would like).
- Connected to = SharePoint list column you would like to store the result in (if you want to save the value to a list column).
- Formula =
SelectChoice1 + "-" + SelectChoice2 + "-" + formatDate(Current Date,"yyyy") + "-" + ID
- 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.
- Preview the form to test this functionality.
- Save / Publish the form.
- 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.
- 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.