Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to plan the auto-generated custom item name for Form library in a 2013 publishing website project.

In other words, I don't want our users to enter the name of the form every time they create an item.

We have multiple form libraries in the site. We need to use the following format:

<FormName> [ID: <ItemId>]

e.g. Car Insurance Request [ID: 573489]

where the ItemId is the one which SP created internally when item is created,

How to automatically set the name with desired format?

share|improve this question
add comment

2 Answers

In your InfoPath form create a data connection with type: Submit Data, while creating it, system will ask for the Document Library and select the doucment library and next to that you will get a field called "File Name" with expression button, Click on the Expression button and there you can specify the formula/Expression to specify how the file names should be. Then Click Next, then finish and then Publish your Infopath form to the Library.

Then in the document library, if you create a document using this InfoPath form, then the file name for the created forms will be as per the Formula/Expression mentioned in the created data connection.

share|improve this answer
    
You can create a data connection that would bring the ID values from the document library. Then in the concat operation insert the ID field within the max function. Then your formula would be like concat("Car Insurance Request [ID:',max(@ID)+1) –  Karthik Jaganathan Jul 31 '13 at 6:59
    
To insert the ID field, click on "Insert Field Or Group" button, then select the Data connection from which you can get the ID field, then select the ID field and click ok. To insert the MAX function, click on "Insert Function" button. –  Karthik Jaganathan Jul 31 '13 at 7:02
    
On clicking of Insert Field or group button, you will get a screen with a drop down, there select your Data connection. after selecting, it will display the fields returned by the data connection, expand the fields untill you get ID*, then select ID*. then click ok. –  Karthik Jaganathan Jul 31 '13 at 11:38
    
sorry raven, I totally forgot to think about that condition, I'm happy that you found the solution and its working for you. –  Karthik Jaganathan Aug 1 '13 at 9:10
    
If you find my answer is correct\helpful, please mark it as answer because it may help others too. –  Karthik Jaganathan Aug 1 '13 at 9:11
add comment
up vote 1 down vote accepted

I had to create a retrieve data connection, FetchID, to fetch the ID column.

Then in submit data connection, I used this formula:

xdMath:Eval(xdMath:Max(xdXDocument:GetDOM("FetchID")/dfs:myFields/dfs:dataField‌​s/d:SharePointListItem_RW/d:ID), 'concat("Car Insurance Request [ID: ", (d:ID or 0) + 1, "]")'). 

Hopefully it will help someone.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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