empCancelLeaveRequestEntryMess() 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 previously approved leave request and send an email notification

Syntax

  • AeXMLBridge.empCancelLeaveRequestEntryMess(UniqueID, AeTimeOffRequestNotification, LinkBack);

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
32
33
34
35
string minDate = DateTime.Now.ToString("yyyy-MM-dd");                      
string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// set date range to extract employee's leave requests

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

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

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 requests that are "approved" and > 7 days in advance
{
TAeTimeOffRequestNotification notify = new TAeTimeOffRequetNotification();
notify.BodyText = "Some body text";
notify.eMailAddress = "someone@somewhere.com";
notify.SubjectLine = "Cancel Leave Request";

try
{
string linkback = "";
ws.empCancelLeaveRequestEntryMess(req.UniqueID, notify, 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
30
31
32
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' set date range to extract employee's leave requests
Dim maxDate As String = DateTime.Now.AddDays(30).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

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 requests that are "approved" and > 7 days in advance

Dim notify As TAeTimeOffRequestNotification = New TAeTimeOffRequetNotification()
notify.BodyText = "Some body text"
notify.eMailAddress = "someone@somewhere.com"
notify.SubjectLine = "Cancel Leave Request"

Try
Dim linkback As String = ""
ws.empCancelLeaveRequestEntryMess(req.UniqueID, notify, linkback)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Next

Remarks

  • This method is used when an email notification to the supervisor(s) is required upon the request to cancel an approved leave
  • The UniqueID specifies the approved 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
  • Can only cancel leave requests that are in an “approved” status and are more than 7 days in advance of the current date

Possible Errors

  • Leave request with ID unavailable

Alternate Method

empCancelLeaveRequestEntry

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

Back to Top