Call the OnSubmitRequest event using Submit method

M

Mike B

A little background, I am looking at a way to move a document from one
library to another Library. After searching I found reference to using
the OnSubmitRequest event.

I took the sample provided in the SDK and got this working on a test
form. But, it seems that I am not able to set any fields while in the
OnSubmitRequest event code. While reading about the submit method I
saw a note that stated:

You can write a custom submit operation using the OnSubmitRequest
event, and then you can programmatically call the event using the
Submit method

But I have not been able to find any reference to how to do this.
Would it be just like calling a function in scripting? If so, I have
not been able to get this working.

Anyone have any ideas?

Thanks,
Mike
 
A

Alex [MSFT]

To programmatically call onSubmitRequest, you simply need to call
XDocument.Submit() - this will trigger InfoPath's submit operation, thus,
everything that Submit is configured to do (through Tools | Submitting
Forms) will happen, including the onSubmitEvent handler.

Good luck,
Alex @ Microsoft
 
M

Mike B

Alex,

Thanks for the reply and a follow-up question. Will the the
onSubmitRequest also get triggered when I send an email since I am
using objEmail.Submit()
ex. code
Set objEmail = XDocument.DataAdapters("Email")
'Email code
objEmail.Submit()

Also, is there any way inside of the onSubmitRequest code, to tell
which button was pushed? That way, if need be I could do something
different depending on the button used.

My process so far.
1)User opens form, button A is displayed. After filling out form, user
submits to WSS Library A. Admin is notified via email (custom code)
that form has been submitted, link to form included in message.

2)Admin opens form, Button B is displayed. fills out rest of Form,
submits to Library A and sets form as readonly (done via rules based on
a status field), status field is changed and form is then submitted to
Library B. Email is sent to originator and to IT contact. Admin,
would then have to go back to Library A and manually delete all
assigned forms.

3)IT contact opens form and types in notes or reassigns to another IT
contact. This entails resubmitting to library B. This can happen
multiple times. no email is sent.

What I am looking for is to automate the deletion of the original form
in Library A.

I do not want the onSubmitRequest to get triggered everytime, only when
the Admin submits to Library B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top