Simple Automation with Infopath 2003 and SPS 3.0 - Calculate Directory / Filename to save as

I have a simple Infopath Form with various text fields, date fields, option buttons, etc.  I have published to form to a sharepoint "server" (actually, a server running SPS 3.0 -- the free version).  I would like to add two command buttons (say "btnDrafts" and "btnSubmit"), with the caption "Save As Draft" and "Submit to Policy Committee".  

If the user clicks on btnDraft, the form would be saved in a Drafts subfolder of the current location of the empty template, in SPS, with a concatenation of the last name of the author (txtAuthorLastName (textbox)), the title of the policy (txtTitle), the current system date (in YYYYMMDD) format, and the letters "DRF" (e.g., DoeWorkHours20091230DRF).

If the user clicks on btnSubmit, the form would be saved in a "Submit to Policy Committee" subfolder of the current location of the empty template, in SPS, with the same name, except without the "DRF" at the end (e.g., "DoeWorkHours20091230").

While the user can obviously save the form wherever they want, I'm not worried about restricting them, at this point, from saving it elsewhere using the file : Save As... menu.

Realizing that Infopath 2007 and Sharepoint Server might be more amenable to this process, it is unfortunately ruled out due to financial restrictions.

I'd prefer to use VBScript over JScript (assuming I have to use either) to perform this task, because I'm more use to Visual Basic .NET (we have Visual Studio 2008).  I'm really not that familiar with the Object Model, and getting a solid model to a tangible example in our situation might greatly assist in learning it.


Who is Participating?
Clay FoxConnect With a Mentor Director of Business IntegrationCommented:
This is all simple.

Best practice is to disable the save and save as and have buttons like you have outlined.

No need for code.

Go to tools and Data Connections and add a submit connection to SharePoint.  Set it up for your draft locations and use a concat function to create your naming scheme.  Then create another submit connection for the policy committe.  Then just have a rule on the first button to use the draft submit and the other to use the second.

This is all standard functionality that you do not have to over complicate.  Once you try it you will see.
kmoloneyAuthor Commented:
I think I've got you, except where do I access the concat function to assign the name of the form?

Sorry such a novice...
kmoloneyAuthor Commented:
Oh sorry, I see the function for the form name....
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

kmoloneyAuthor Commented:
Clayfox...pretty sure you've got the answer, although I'm a little confused about another thing...

In SPS, I created two subfolders within the SPS Site where I put the main form (local DNS reference to our location:  http:\\sharepoint\QualityReview\)  - DRAFTS and SUBMIT, and followed your instructions.  I get an error saying that it cannot locate the folder.  Now, I'm just finishing up New Year's eve break, so I'll be back in the office on 1/5.  But I was curious about that:  if I create a folder within a site, does it create it as I would expect the same MD command (e.g., \\QualityReview\Drafts and \\QualityReview\Submit), with the same hierarchy, or do I have to actually create the directory differently?  I was going to try that, but then it was 5:00 p.m. on the day before my vacation.

Thanks for your help.

Clay FoxDirector of Business IntegrationCommented:
Subfolders are a lot tougher.  It would be better to use two libraries, or just have the status as a promoted property and use filters on  the list.

Filtered views are always a better road than traditional subfolders in SP.
kmoloneyAuthor Commented:
I'm sure your solution will work, although I haven't been able to get to the solution yet.  It was clear and concise.  Thanks.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.