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

  • Approve the cancellation of a leave request and send an email notification

Syntax

  • AeXMLBridge.approveCancelLeaveRequestEntryMess(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
string minDate = DateTime.Now.ToString("yyyy-MM-dd");                      
string maxDate = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd");
// use a date range of 30 days

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

TAeTimeOffRequest[] reqs = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.Created, 1, minDate, maxDate);
// retrieve a list of all employee leave requests for date range

for (int i = reqs.Length - 1; i > = 0; i--)
// iterate through the list to find leave requests in cancel state
{
if (reqs[i].ReqState == 4)
{
TAeTimeOffRequestNofitication notify = new TAeTimeOffRequestNotification();
notify.BodyText = "Your cancel request was approved";
notify.SubjectLine = "Cancelled Leave Request Approved";
notify.eMailAddr = "someone@somewhere.com";
// build the email message

try
{
ws.approveCancelLeaveRequestEntryMess(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
Dim minDate As String = DateTime.Now.ToString("yyyy-MM-dd")
' use a date range of 30 days
Dim maxDate As String = DateTime.Now.AddDays(30).ToString("yyyy-MM-dd")

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

Dim reqs As TAeTimeOffRequest() = ws.extractEmployeeLeaveRequestsByIDNum(empID, TRTOFilterEnum.Created, 1, minDate, maxDate)

For i as Integer = reqs.Length - 1 to 0 Step -1
If (reqs(i).ReqState == 4)
Dim notify as TAeTimeOffRequestNotification = New TAeTimeOffRequestNotification()
notify.BodyText = "Your cancel request was approved"
notify.SubjectLine = "Cancelled Leave Request Approved"
notify.EmailAddr = "somebody@somewhere.com"

Try
ws.approveCancelLeaveRequestEntryMess(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 is required upon approval of a leave cancellation request
  • The UniqueID specifies the leave request to be cancelled
  • Field ReqState in TAeTimeOffRequest structure must have a value of ‘4’ for the cancel leave request to be approved

Possible Errors

  • Leave request with ID unavailable
  • yyyy-mm-dd is required [Date supplied in invalid format]

Alternate Method

approveCancelLeaveRequestEntry

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

Back to Top