I have made three forms in InfoPath to use in SharePoint, all of them with the same rules and data connections. Two of them work just fine, but I am having trouble when submitting my form for Travel Expences, which is the largest and most complex of them.
Background:
My form automatically creates a filename when it is submitted the 1st time, and does not change this filename if it’s opened and adjusted later.
I have solved this by having one field for the author’s initials, and one ItemNo field which is populated on the 1st Submit.
On opening the form I made a rule to keep the ItemNo if the value is larger than 100.
I have made one data connection to retrieve the Accounting Library’s ID and two data connections for submitting the form.
I have two Rules for submitting my form
Rule 1: If ItemNo is empty
a) A data connection query to receive ID from the Accounting Library
b) Insert formula: ItemNo = 1000 + max(@ID) + 1
c) Submit using data connection: Submit 1st time to library
The filename for submitting the form is: concat(today(); " "; initials; " Travel "; 1000 + max(@ID) + 1)
Rule 2: if ItemNo is larger than 100
a) Submit using data connection: Submit 2nd time to library
The filename when submitting 2nd time is: concat(today(); " "; initials; " Travel "; ItemNo)
Problem:
Most often when submitting the form the first time (using a submit button), it creates two almost identical items – only the filename differs – and then comes the message that the item is sent and the prompt for ok. In the Library the two forms have the same date and time and they have identical ItemNo. But their filenames differ:
2008-12-11 SO Travel NaN.xml
2008-12-11 SO Travel 1057.xml
Can it be that the query needs a little pause for the ItemNo field to be populated, and if so, how do I do that (I don’t know any programming)
I hope someone has an answer for me
Toril