Infopath and sharepint

R

Ruky Obahor

I am building an absence request form that staff will fill out from within a
sharepoint form library. This form has a drop dowm list for staff to select
their manager. Is there a way that the chosen manager can be emailed a link
to the form to let them know that a form is awaiting thier approval.

Also when the manager has approved or declined their request can the staff
be emailed of this action.

can someone help me please
 
U

UKDeluded

Okay, I think this is a way to do it ...
If in yuor list of people you use the ID string for the individual and ni
that list have the managers' details as well you can create code on the
submit which emails the manager the list URL and set up a default view which
show only the elements pertaining to that person.
Then have a field in the form which is 'Pending/Approved' which the manager
can change (only enable once saved maybe or similar) and have an 'onchange'
event which emails the originator with the variable chosen in the box
(approved/declined).

Someone else may awnt to flesh out the details but at least it's a thought
process!!!
 
U

UKDeluded

Okay, hold it, far more cohesive version ...

1) Have a hidden data field which grabs manager email from user info supplied
2) Create new data connection 'submit' 'to email' where the 'To' is from the
hidden data field
3) On your form's SUBMIT button do 'Rules and Custom Code'
4) Select 'Rules'
5) Add an action rule to submit using data connection and have it leave the
form open and submit to the location
6) Add subsequent action to email form to data connection and close.
 
R

Ruky Obahor

Thanks for your help with this.
I have been able to email the form to the manager but what i want to do is
submit the form to a sharepoint library and then at the same time notify the
manager that a form is awaiting their approval.
I dont want the manager to get the form via email
 
U

UKDeluded

Then you'll have to go for some good old fashioned 'edit form code' on the
submit button. I would then just send a link to a filtered view.

Any others want to chip in???
 
M

Mike B

I am essentially doing the same thing. When the user clicks the email
button here is what happens.
* Sets a filename field, this field is created so it will be unique.
-FirstnameLastname-mmddyy-hhmmss
* Then using code and an Email Dataconnection, create an email, which
has:
- CC
- Subject
- Intro.
In the intro I have a link to the form in the form library.

The email is sent using Dataconnection
If the email is not canceled submit to WSS.

You will need 2 data connections.
1-Submit, submit to a WSS lirary
2-Email, I filled in the TO field, but this can be done in the code
below.
This is really my first stab at scripting in InfoPath so if anyone has
any suggestions, please let me know.
Here is the code, VBScript. Watch for line wrap.

Sub Email_OnClick(eventObj)

'check format on Phone and change if not XXX-XXX-XXXX
tPhone = XDocument.DOM.selectSingleNode("//my:phoneNumber").text
If len(tPhone) = 10 then
strPhone = left(tPhone,3) & "-" & mid(tPhone,4,3) & "-" &
right(tPhone,4)
XDocument.DOM.selectSingleNode("//my:phoneNumber").text = strPhone
ElseIf len(tPhone) < 10 then
Msgbox("Please enter in full phone number, including Area Code")
exit Sub
End If

If XDocument.DOM.selectSingleNode("//my:FileName").text = "" then
'Get Date/Time to allow for unique file name
strNow = Now

'Add 0 if Hour < 10
If len(Hour(strNow)) = "1" then
strHour = "0" & Hour(strNow)
Else
strHour = Hour(strNow)
End If

'Add 0 if Min < 10
If len(Minute(strNow)) = "1" then
strMinute = "0" & Minute(strNow)
Else
strMinute = Minute(strNow)
End If

'Add 0 if Seconds < 10
If len(Second(strNow)) = "1" then
strSecond = "0" & Second(strNow)
Else
strSecond = Second(strNow)
End If
'Set Time to equal HHMMSS
strTime = strHour & strMinute & strSecond

'Add 0 if month does not have 2 characters
If len(month(strNow)) = "1" then
strMonth = "0" & month(strNow)
Else
strMonth = month(strNow)
End If

'Add 0 if day does not have 2 characters
If len(day(strNow)) = "1" then
strDay = "0" & day(strNow)
Else
strDay = day(strNow)
End If

'Set Date to equal MMDDYY
strDate = strMonth & strDay & right(year(strNow),2)

'Combine the first and last names.
strFullName =
trim(XDocument.DOM.selectSingleNode("//my:firstName").text) & _
Trim(XDocument.DOM.selectSingleNode("//my:lastName").text)

'Set the file name = FullName-MMDDYY-HHMMSS
TheFileName = strFullName & "-" & strDate & "-" & strTime

'Set the filename Field
XDocument.DOM.selectSingleNode("//my:FileName").text = TheFileName
End If

'Email the link to the document
strFirstName = XDocument.DOM.selectSingleNode("//my:firstName").text
strUserName = XDocument.DOM.selectSingleNode("//my:userName").text
If NOT instr(strUserName,"@") then
strUsername = strUsername & "@ci.charlotte.nc.us"
End If

Set objEmail = XDocument.DataAdapters("Email") 'Requires a
dataconnection named Email
objEmail.CC = strUserName
objEmail.Subject = "BSS-IT Service Request"
objEmail.Intro = strFirstname & "," & vbcr _
& vbcr _
& "Your service request has been submitted to IT." & vbcr _
& "To view your pending request please click here:
http://Website/itservices/BSSITSRform/" & TheFileName & ".xml" & vbcr _
& "To view all assigned requests you have submitted, please click here
http://WebSite/itservices/BSSITSRForm/Forms/MyItems.aspx" & vbcr _
& vbcr _
& "You will be notified by email when your request has been assigned
to member of IT. " & vbcr _
& "If you have any questions about the request or would like to make
changes, please contact" & vbcr _
& "mailto:[email protected]?subject=" & TheFileName & " by clicking
the link or send an email " & vbcr _
& "to itservices and include the file name " & TheFileName & " in the
subject." & vbcr _
& vbcr _
& "Thank you," & vbcr _
& "IT Service Request Admin"


On error resume next
objEmail.Submit()
errNum = err.number
on error goto 0

If errNum <> 0 then
Msgbox ("Your request can not be submitted unless you click *SEND* on
the email Confirmation window." & vbcr _
& "Please resend your request and click Send on the confirmation
Window.")
XDocument.DOM.selectSingleNode("//my:FileName").text = ""
Exit Sub
Else
'Submit to WSS if email is successful.
strNow = Year(Now) & "-" & Month(Now) & "-" & Day(Now) & "T" &
Hour(Now) & ":" & Minute(Now) & ":" & Second(Now)
XDocument.DOM.selectSingleNode("//my:emailedOnDate").text = strNow
XDocument.DOM.selectSingleNode("//my:Status").text = "IsReadySubmit"
XDocument.DOM.selectSingleNode("//my:formStatus").text = "Pending"
Set objSubmit = XDocument.DataAdapters("Submit")'Requires a
Dataconnection named Submit
On error Resume Next
objSubmit.Submit()
On error Goto 0
msgbox ("Thank you," & vbcr _
& "Your IT Service Request has successfully been submitted," & vbcr _
& "if prompted, please click NO to the next message dialog." & vbcr _
& "Clicking yes will resubmit the form with a different name without
notifiying IT.")
'Close the document after submit
XDocument.View.Window.Close()
End If
End Sub
 
R

Ruky Obahor

Thanks for this.
I will try it out and if i run in to any problems will let you know
 
V

Vanessa

You can accomplish this via SharePoint. When you setup your forms via
SharePoint, add the manager field as a column name. The managers can then
setup an alert on that site to inform them when the a new record is created
or one has been updated.

It's an option.
 

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