3

Is there a way in SPD to set the default value of the Title field? I want the default value to be CommentXX where XX is the ID of the list item that would be created. I tried using concat("Comment", ID) but the result is always Comment.

Is there ID field calculated after the item is actually created and that's why I don't get a number after Comment? If so, is there some way to implement this in SPD?

1

Add your submit library as a Receive data connection and select ID as a field you want to return. Set your formula equal to Concat("Comment",max(select ID from your data connection")+1)

This ends up querying your submit library to get the maximum ID number in the library already and adds 1 to it.

  • 2
    @bzh This isn't very reliable. You'll see issues when multiple users are opening/submitting the form at the same time. It is most reliable to do it with workflow after the item is created. – Eric Alexander Jun 27 '16 at 17:47
  • 1
    @bzh What eric said is correct. While this sort of works you will have some issues when users are submitting at the same time. You should create a workflow that updates the title field with the ID of the item it ran on. – Ramana Viswanadha Jun 27 '16 at 18:57
  • I tried doing this before, it only worked when I inserted a pause after the step that updates the title field. If I didn't include this step, the task list would still show (no title). Is there any way to avoid this step? – bzh Jun 27 '16 at 19:53
1

The ID field isn't very reliable when it comes to calculated fields. The best approach for this seems to be to grab the ID and set the value via SPD workflow. You can use =[ID] for items that already exist in a calculated field, but it doesn't work on creation of a new item.

Related: How to use calculated field to retrieve the ID of the item in the SharePoint 2007 List?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.