ah ha! got it this time. i wasn't sure where to put it. woohoo! Thank
you!
now to find more info on getting it to create a name based on information
in
the document. I saw a post somewhere about it but it was way more than i
needed. I just want to create the name based on 3 fields so it's unique.
Thanks
:
Hello,
to get this to work you must have InfoPath Service Pack 1 up and running,
otherwise the required functionality is not there. If you follow the
instructions in my last post, and then click "Edit", you will end up in
the
script editor. And InfoPath has created a script block like this:
//=======
// The following function handler is created by Microsoft Office
InfoPath.
// Do not modify the name of the function, or the name and number of
arguments.
//=======
function XDocument::OnSaveRequest(eventObj) {
// Write the code to be run before saving here.
eventObj.IsCancelled = eventObj.PerformSaveOperation();
// Write the code to be run after saving here.
eventObj.ReturnStatus = true;
}
So, if you insert the line
XDocument.UI.SetSaveAsDialogFileName("customname.xml");
before the eventObj.IsCancelled line, you will end up with the Save-As
dialog poping up suggesting "customname.xml" as the filename.
Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website:
http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(
http://www.infinitec.de/software/mistaya.aspx)
Thanks... I think.
![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I'm going to play dumb here because I'm not
following. I see in the script editor where there's code but I'm not
sure
where to put this and what would need to be put in there. From what
I'm
finding though, it looks like i'll ahve to do some custom coding to get
it
to
use existing information in the document to automatically come up with
a
file
name? Do you know of any good sources for examples that i can use to
figure
out what to create?
Thank you!
:
Hello,
under Tools --> Form options --> Open and Save, check the "Save using
custom
code" box.
In the OnSave event, use the following code:
XDocument.UI.SetSaveAsDialogFileName("customname.xml");
e.IsCancelled = e.PerformSaveOperation();
// Write the code to be run after saving here.
e.ReturnStatus = true;
Greetings,
Henning Krause [MVP - Exchange]
==========================
Visit my website:
http://www.infinitec.de
Try my free Exchange Explorer: Mistaya
(
http://www.infinitec.de/software/mistaya.aspx)
I'm looking at creating an infopath form solution for a number of
tasks
that
currently use word docs. I'd like to be able to somehow automate
the
creation of the filename for when the user saves it. I don't want
to
end
up
with 500 docs named form1-form500. Something that will make it
unique
when
saved and the user won't have to give it a different name.
Is this possible?
Thanks