approveLeaveRequestEntryEx() 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 add comments to the record

Syntax

  • AeXMLBridge.approveLeaveRequestExtryEx(UniqueID, Comments);

Parameters

  • Integer - UniqueID value from a valid TAeTimeOffRequest structure
  • String - comments (optional)

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
string minDate = DateTime.Now.ToString("yyyy-MM-dd");                     
string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// date range will be from today to 30 days

string empID = "1234";
// using employeeID "1234"

string comments = "Approved by Mrs. Smith";

TAeTimeOffRequest[] reqs = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilter.rfCreated, 1, minDate, maxDate);
// retrieve employee's leave requests and iterate through them to find

for(int i = reqs.Length - 1; i >= 0; i--)
// submitted (ReqState = 1) requests
{
if(reqs[i].ReqState == 1)
{
try
{
ws.approveLeaveRequestEntryEx(reqs[i].UniqueID, comments);
}
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
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' date range will be from today to 30 days
Dim maxDate As String = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")

Dim empID As String = "1234"
' using employeeID "1234"

Dim comments As String = "Approved by Mrs. Smith"

Dim reqs As TAeTimeOffRequest() = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilter.rfCreated, 1, minDate, maxDate)
' retrieve employee's leave requests and iterate through them to find

For i As Integer = reqs.Length - 1 To 0 Step -1
' submitted (ReqState = 1) requests
If reqs(i).ReqState = 1 Then
Try
ws.approveLeaveRequestEntryEx(reqs(i).UniqueID, comments)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next

Remarks

  • This method is used when supervisors approve leave requests made by employees
  • The UniqueID specifies the leave request to be approved
  • The comments value can be used to send comments back to the employee who made the request
  • Field ReqState in TAeTimeOffRequest structure must have a value of ‘1’ for the leave request to be approved

Possible Errors

  • UniqueID not located

Alternate Methods

approveLeaveRequestEntry
approveLeaveRequestEntryMess

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

Back to Top