Link to home
Start Free TrialLog in
Avatar of kmoloney
kmoloneyFlag for United States of America

asked on

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.

Thanks!

Kevin
ASKER CERTIFIED SOLUTION
Avatar of Clay Fox
Clay Fox
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kmoloney

ASKER

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...
Oh sorry, I see the function for the form name....
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.

Kevin
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.
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.