Answered by:
Auto Generate Unique Name For InfoPath Form

Question
-
Hi all! Iv'e searched quite a it and have seen this topic come up with several kinds of solutions but unfortunately none that worked for me. I have several Form Libraries for submitting requests where I use Submit Buttons to generate a file name appended with a unique sequence number. I've used several variants such as appending timestamp etc... which work but doesnt look very nice.
Once the Form is submitted a workflow generates a Task, that once completed and the Task is updated, the form is converted to PDF and archived to a different library. I have set up a Sequence Number List that has a single row in it with 2 columns, Seq Number and Record ID both unique numbers. Record ID is fixed at 1, which I use in the filter and Sequence Number will get incremented after each use. Now in my submit button I cannot seem to retrieve the sequence number at all. I can in a test workflow, and increment it as well, but I need the value for the file name so that doesnt work. I've tried a bunch of things but here it is in it's basic form. I defined a column on the form called seq num, defined a receive data connection from SP library list, then I try to Set the form column using Set a Fields value, to the external sequence number.... ultimately I want to update it to plus 1, but I can't even see it yet....
Am I going about this right or missing something? Is there a better way, one that works? Any help would be greatly appreciated.... Hope I gave enought detail.
Thanks,
Guy
Friday, January 13, 2012 3:21 AM
Answers
-
OK, I was able to figure this out and it works great! The reason I couldnt see the Sequence Number from the external List was that in my data connection i intentionaly do not retriev data when the form is open as i want the sequence generation/update to happen as quickly as possible, for obvious reasons. What I didnt realize (kinda new with infopath) is that when you uncheck that option you also need to retrieve the data explicitly via query data. I did that and now have the sequence number, add 1 to it and append it to my File Name and Request ID. The other problem is updating the value on the external list to value + 1. It appears this is not possible from with infopath with a Submit Button. Please advise if wrong, would be nice to do it here.
Anyway, I got around this by adding the update sequence number to the workflow and execute it when workflow context is start on item creation. This updates almost instantly... I also added Specific Sequence number columns for different Form Libraries all in the same row and it work perfectly and can scale very easily....
-Guy
- Marked as answer by Emir Liu Thursday, January 19, 2012 2:39 AM
Friday, January 13, 2012 4:19 PM -
You can use the number() function to increment the number from the list, then +1.
If your file_name was say: FILE_1234, you can do
concat("FILE_", number(substring( file_name, 6) ) + 1)Also, you should probably query data when you click the button, that way it checks for the latest number and increment accordingly, and reduces chance of collision.
jliu - johnliu.net - sharepointgurus.net- Marked as answer by Emir Liu Thursday, January 19, 2012 2:39 AM
Sunday, January 15, 2012 12:29 AM
All replies
-
OK, I was able to figure this out and it works great! The reason I couldnt see the Sequence Number from the external List was that in my data connection i intentionaly do not retriev data when the form is open as i want the sequence generation/update to happen as quickly as possible, for obvious reasons. What I didnt realize (kinda new with infopath) is that when you uncheck that option you also need to retrieve the data explicitly via query data. I did that and now have the sequence number, add 1 to it and append it to my File Name and Request ID. The other problem is updating the value on the external list to value + 1. It appears this is not possible from with infopath with a Submit Button. Please advise if wrong, would be nice to do it here.
Anyway, I got around this by adding the update sequence number to the workflow and execute it when workflow context is start on item creation. This updates almost instantly... I also added Specific Sequence number columns for different Form Libraries all in the same row and it work perfectly and can scale very easily....
-Guy
- Marked as answer by Emir Liu Thursday, January 19, 2012 2:39 AM
Friday, January 13, 2012 4:19 PM -
You can use the number() function to increment the number from the list, then +1.
If your file_name was say: FILE_1234, you can do
concat("FILE_", number(substring( file_name, 6) ) + 1)Also, you should probably query data when you click the button, that way it checks for the latest number and increment accordingly, and reduces chance of collision.
jliu - johnliu.net - sharepointgurus.net- Marked as answer by Emir Liu Thursday, January 19, 2012 2:39 AM
Sunday, January 15, 2012 12:29 AM