approveLeaveRequestEntry() 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

Syntax

  • AeXMLBridge.approveLeaveRequestEntry(UniqueID);

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

string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// and the next 30 days

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

TAeTimeOffRequest[] reqs = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfCreated, 1, minDate, maxDate);
// extract leave records for employee within date range passed

for(int i = reqs.Length - 1; i >= 0; i--)
// iterate through the list to find records in "submitted" state
{
if(reqs[i].ReqState == 1)
// "submitted" state when ReqState = 1
{
try
{
ws.approveLeaveRequestEntry(reqs[i].UniqueID);
}
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
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' date range will be from today

Dim maxDate As String = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")
' and the next 30 days

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

Dim reqs As TAeTimeOffRequest() = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfCreated, 1, minDate, maxDate)
' extract leave records for employee within date range passed

For i As Integer = reqs.Length - 1 To 0 Step -1
' iterate through the list to find records in "submitted" state
If reqs(i).ReqState = 1 Then
' "submitted" state when ReqState = 1
Try
ws.approveLeaveRequestEntry(reqs(i).UniqueID)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next

Remarks

  • This method marks a request as approved
  • 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

approveLeaveRequestEntryEx
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