I don't consider it wise to tell a newbie to immediately add code to their form. There are non-code methods for doing many things, and there are likely multiple ways to go about creating unique IDs without code. I just don't think it's good to
immeidately go to a code solution and continue to propose that after the person says they are a newbie and don't know where to put the code - it is not a good way to give advice, imo. He likely doesn't even have Visual Studio installed.
Smith, in my opinion, this is very easy to do without code as long as your ID does not have to be in the filename. If that's the case, then here are the simple steps:
1) First, incorporate my
Auto-Generating Filenames method. Make sure that when you publish your template with this method that you promote the strFilename field so that it's saved into the form library.
2) Next, create a new data connection to Receive from your Change Request form library (the same one where the form originates). In this data connection, choose the ID and strFilename fields for retreiving. Set the data connection NOT to automatically
retrieve - we will only do it on demand during the initial Submit.
3) In your custom (non-code) submit button within the submit rule that you created as part of my blog, add a few actions. Before the Close action but after the Submit action, add an action that queries the DC from step #2. Then, add an action
that sets your custom ID field to the ID of your DC from #2 but filtered where the strFilename field of the DC (SharePoint) is equal to the strFilename of the main data source (form). After that, add another Submit. The effect of the above
actions will be that you submit the form with an auto-generated filename, then the form queries the form library, the returned data set includes the form you just submitted and includes the unique ID of that form, you set the custom ID field of your
form to the ID of the form you just submitted, and then you re-submit so that your CustomID field is populated, and then it closes. If you want your custom ID to be something special like 1000-01, then you just need to use a concatenate formula in the
action where you set the custom ID field.