approveLeaveRequestEntryMess() Method

Table of Contents

  1. Function
  2. Syntax
  3. Parameters
  4. Return Value
  5. Sample Code
  6. Remarks
  7. Possible Errors
  8. Alternate Methods
  9. Related Methods

Function

  • Approve an existing time off request and send out an email notification reflecting this

Syntax

  • AeXMLBridge.approveLeaveRequestEntryMess(UniqueID, AeTimeOffRequestNotification);

Parameters

Return Value

  • None

Sample Code

C#

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
sstring minDate = DateTime.Now.ToString("yyyy-MM-dd");
string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// set the date range

string empID = "1234";
// using employee# "1234"

TAeTimeOffRequest[] reqs = ws.extractEmployeeLeaveRequestsZByIDNum(empID, TRTOFilterEnum.rtfCreated, 1, minDate, maxDate);
// retrieve the employees leave requests within the date range

for(int i = reqs.Length - 1; i >= 0; i--)
// iterate through the list looking for ReqState = 1 (submitted)
{
if(reqs[i].ReqState == 1)
{
TAeTimeOffRequestNotification notify = new TAeTimeOffRequestNotification();
notify.BodyText = "Leave Request Approved";
notify.Comment = "per Spvr";
notify.eMailAddr = "someone@somewhere.com";
notify.SubjectLine = "Leave Request Update";

try
{
ws.approveLeaveRequestEntryMess(reqs[i].UniqueID, notify);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}

VB.Net

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
Dim maxDate As String = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")
' set the date range

Dim empID As String = "1234"
' using employee# "1234"

Dim reqs As TAeTimeOffRequest() = ws.extractEmployeeLeaveRequestsZByIDNum(empID, TRTOFilterEnum.rtfCreated, 1, minDate, maxDate)
' retrieve the employees leave requests within the date range
For i As Integer = reqs.Length - 1 To 0 Step -1
' iterate through the list looking for ReqState = 1 (submitted)
If reqs(i).ReqState = 1 Then
Dim notify As New TAeTimeOffRequestNotification()
notify.BodyText = "Leave Request Approved"
notify.Comment = "per Spvr"
notify.eMailAddr = "someone@somewhere.com"
notify.SubjectLine = "Leave Request Update"

Try
ws.approveLeaveRequestEntryMess(reqs(i).UniqueID, notify)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next

Remarks

  • This method is used when an email notification to the employee is required upon approval of a leave request
  • The UniqueID specifies the leave request to be approved
  • Field ReqState in TAeTimeOffRequest structure must have a value of ‘1’ for the leave request to be approved

Possible Errors

  • Leave request with UniqueID unavailable

Alternate Methods

approveLeaveRequestEntry
approveLeaveRequestEntryEx

approveCancelLeaveRequestEntry
approveCancelLeaveRequestEntryMess
denyCancelLeaveRequestEntry
denyCancelLeaveRequestEntryMess
describeLeaveRequestEntry
empCancelLeaveRequestEntry
empCancelLeaveRequestEntryMess
empRemoveLeaveRequestEntry
empRemoveLeaveRequestEntryMess
extractEmployeeLeaveRequest
extractEmployeeLeaveRequestsByIDNum
extractEmployeeLeaveRequestHist
extractLeaveRequestsByState
extractTimeOffRequestStates
leaveRequestIsCancelable
leaveRequestIsRemovable
removeLeaveRequestEntry
submitTimeOffRequest
submitTimeOffRequestEx
submitTimeOffRequestMess

Back to Top