ASP.NET VETtrak API web services
ContentsIndexHome
PreviousUpNext
VT_API.AddEmployeeEnrolmentToBooking Method

Enrols an employee directly into a private employer booking, or an employer enrolment. 

A Client Code (clientCode) and an Enrolment ID (enrolmentId) are passed as parameters. The Enrolment ID must be either:

  • The occurrence ID for a booking, or
  • The enrolment ID for an employer enrolment
 

An enrolment is created which links the Client with the Employer's Booking or Enrolment. Both of the above parameters must be valid, otherwise no enrolment will be created. In particular, the Enrolment ID must be for a booking or employer enrolment, and the client must not already be enrolled in the occurrence. 

If you need to enrol a new client, call AddClient or AddClientAfterCheck first to create the new client, then pass the client's code into this function. 

The new enrolment will get any units (except those marked as optional), tasks (except those linked only to optional units) and staff that are on the occurrence, and the enrolled client will be added to all classes in the occurrence. If the booking or employer enrolment is using corporate pricing with actual employees as the calculation method, the price on the booking or employer enrolment will be updated. No invoices will be created or modified by this function. 

If the client being enrolled does not have an employer, its employer will be set to the employer that owns the booking or employer enrolment being enrolled into. 

If the "auto link enrolments" preference is ticked, it will check if the enrolling client has any existing active enrolments with a date range that overlaps the new occurrence enrolment and contain any of the units in the occurrence that the new enrolment is going into. If so, these existing enrolments will be linked to the new enrolment, and the units will not be enrolled again in the new enrolment. 

This function may also automatically transfer the new enrolment to an LMS for online learning, if the relevant add-on is installed and the occurrence is configured to do so. 

If successful, the function returns a TAuthClieEnro object containing a TClieEnro object, which contains, among other things, the ID of the new enrolment. 

A token is passed for authentication. If the authentication fails, or other errors occur, no enrolment is created. The result of the authentication is represented by a TAuthenticate object. 

Requires a valid registration key entry for the Bookings feature. 

This function has security level "Protected", and can only be accessed by users that have explicitly been granted permission to the API.

C#
[WebMethod(Description = "Enrols the employee with the specified code into the booking or employer enrolment with the specified ID")]
public TAuthClieEnro AddEmployeeEnrolmentToBooking(string token, string clientCode, int enrolmentId, int? referralId, string description, int? studyReasonId);
Parameters 
Description 
string token 
String containing a token. 
string clientCode 
String containing the Code of the Client to enrol. Maximum length 10 characters. 
int enrolmentId 
Integer ID of the Booking or Employer Enrolment to enrol the client in. 
int? referralId 
Integer ID of the referral source for the enrolment. Pass 0 or null for none. Call GetReferralSources for a list of referral sources to use. 
string description 
String description to record against the enrolment. 
int? studyReasonId 
Integer ID of the study reason for the enrolment. Pass 0 or null to default to the study reason on the occurrence. Call GetStudyReasonsForOccurrence for a list of valid study reasons that can be used. 

TAuthClieEnro : an Authenticated Client Enrolment object.

Copyright (c) VETtrak 2022. All rights reserved.