empCancelLeaveRequestEntry() Method

Table of Contents

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

Function

  • Used to cancel a previously created leave request

Syntax

  • AeXMLBridge.empCancelLeaveRequestEntry(UniqueID, Comments, LinkBack);

Parameters

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

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
string minDate = DateTime.Now.ToString("yyyy-MM-dd");                      
string maxDate = DateTime.Now.AddDays(90).ToString("yyyy-MM-dd");
// set date range used to extract leave requests

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

TAeTimeOffRequest[] reqs = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfCreated,1, minDate, maxDate);
// retrieve employee's leave requests within date range

foreach (TAeTimeOffRequest req in reqs)
// iterate through the leave requests
{
DateTime leaveDate = Convert.ToDateTime(req.StartDate);
int diffDays = (leaveDate - DateTime.Now).Days;

if ((req.ReqState == 2) && (diffDays > 7))
// can only cancel when status is approved and leave date is > 7 days
{
string comments = "Any Comments";
string linkBack = "";

try
{
ws.empCancelLeaveRequestEntry(req.UniqueID, comments, linkBack);
}
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
26
27
28
29
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' set date range used to extract leave requests
Dim maxDate As String = DateTime.Now.AddDays(90).ToString("yyyy-MM-dd")

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

Dim reqs As TAeTimeOffRequest() = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.rfCreated, 1, minDate, maxDate)
' retrieve employee's leave requests within date range

For Each req As TAeTimeOffRequest In reqs
' iterate through the leave requests

Dim leaveDate As DateTime = Convert.ToDateTime(req.StartDate)
Dim diffDays As Integer = (leaveDate - DateTime.Now).Days

If (req.ReqState = 2) AndAlso (diffDays > 7) Then
' can only cancel when status is approved and leave date is > 7 days

Dim comments As String = "Any Comments"
Dim linkBack As String = ""

Try
ws.empCancelLeaveRequestEntry(req.UniqueID, comments, linkBack)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next

Remarks

  • This method marks a leave request for cancellation
  • The supervisor must then approve or deny this cancellation request
  • The UniqueID specifies the leave request to be cancelled
  • The string parameter LinkBack can be used to navigate back to Attendance on Demand or another application that may contain an Attendance on Demand application or Attendance on Demand functionality
  • The Comments value can be used to send comments back to the employee who made the request
  • Can only cancel leave requests in an “approved” status that are more than 7 days in advance of current date

Possible Errors

  • Leave request with ID unavailable

Alternate Method

empCancelLeaveRequestEntryMess

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

Back to Top