VETtrak and Moodle - Integration & Implementation

Are you a Moodle user? if so, you may be interested in how VETtrak can use the Moodle API to push and pull information between the two systems.


There are two aspects to configuring the integration. There is a Moodle component and a VETtrak component. Lets begin by looking at the Moodle configuration side. 

This is an overview of the functionality in the updated integration:

  • Link occurrences to Moodle courses. Link your VETtrak occurrences to courses in Moodle, or create new courses in Moodle for occurrences from VETtrak.
  • Map occurrence units/tasks to Moodle activities. You can map multiple units and tasks in your VETtrak occurrence to multiple course activities in Moodle, allowing those units and tasks to be resulted in VETtrak as the corresponding activities are completed in Moodle.
  • Transfer enrolments to Moodle. Send one or multiple enrolments in an occurrence, along with the client details, to Moodle for online learning.
  • Remove enrolment from Moodle. You can right-click an enrolment that has been transferred to Moodle to remove it from Moodle.
  • Auto-update course in Moodle. Updating the dates or status of an occurrence in VETtrak will automatically update the dates or visibility of the corresponding course in Moodle.
  • Download results. A screen in VETtrak allows you to download the activity data from Moodle and record corresponding unit and task results in VETtrak. This screen allows you to review and adjust any of the result data before saving it into VETtrak.
  • Update enrolment status on completion. You can configure the integration to update the status of the enrolment in VETtrak when the student completes the course in Moodle.
  • Auto-push VETenrol web enrolments to Moodle. Each occurrence can be configured to automatically send processed web enrolments to Moodle, allowing students to start their online learning automatically after online enrolment if desired.

Lets start with the Moodle configuration.


Moodle setup


Installing Moodle is outside the scope of this article so we will assume that your Moodle instance is setup and installed.


With Moodle installed and setup we need to change some settings before VETtrak can communicate with your Moodle instance.

Login as your admin user and navigate to the ‘Site Administration’ page (/admin/search.php)

From here we can do some searches to quickly find the settings required.

Rest protocol

Search for ‘REST protocol’ and enable it under the Active web service protocols section (click the eye):

Web services authentication

Now Search for ‘Web services authentication’ and enable it:

Extended characters in usernames

Now Search for ‘Allow extended characters in usernames’ and enable it:

This is required to allow email addresses to be used for the Moodle user name.

API debug messages

Now Search for ‘Debug messages’ and set it to NORMAL:

External service

Now we need to add an external service to expose the API end points required for the integration with VETtrak. Go to /admin/settings.php?section=externalservices and click ‘add’

We suggest that you add configure the Service as shown below, making sure its enabled and flagged for authorised users only:



Now add the required list of functions clicking the ‘Functions’ section on your new service. Search each of them and hit add until you have added the whole list.

API Functions

The follow is a list of Moodle API functions required by the VETtrak Moodle integration:

  • core_webservice_get_site_info
  • core_course_get_categories
  • core_course_get_courses_by_field
  • core_course_get_contents
  • core_course_create_courses
  • core_course_update_courses
  • core_user_get_users
  • core_user_create_users
  • core_user_update_users
  • core_enrol_get_enrolled_users
  • enrol_manual_enrol_users
  • enrol_manual_unenrol_users
  • core_course_get_course_module
  • gradereport_user_get_grade_items
  • core_completion_get_course_completion_status
  • core_course_get_courses
  • core_course_import_course

Token/Auth user

VETtrak can communicate with Moodle using two methods, either using a user accounts username/password or a token on behalf of a user. Choose one of the following options:

  1. Username/password: Add the user you wish to authenticate with by clicking the ‘Authorised users’ section on your service.
  2. Token: Navigate to manage tokens and add a new token. Set it up using your new web service and a user that has been added to the service (/admin/settings.php?section=webservicetokens)

The Token method is recommended.

Now lets look at the VETtrak side.


VETtrak setup

Now that Moodle should be correctly installed and configured open VETtrak and setup a Moodle LMS in the configuration manager. You will need to have both the LMS integrations feature and the Moodle results plugin in your registration key for the Moodle LMS product to be available. Contact VETtrak Support if you do not have the LMS integration add-on or the Moodle Resulting plugin available in your registration key.  

Getting started

Navigate to Configuration->LMS Integrations and right click click on that menu item to reveal the following page:

Step 1

Add a name for the integration, code (if desired), choose the transfer levels that can be used and the organisations if you have Multi RTO enabled. Choosing a default organisation is good idea (especially if you only have one RTO).  

Step 2

On the second page of the LMS integration configuration wizard you will be presented with the Moodle configuration frame.

VETtrak provides two options to authenticate with Moodle. Either simple using a username/password or a token.

It is suggested that the Token method be used and is a better option for security reasons

Once an authentication method has been chosen the Moodle API connection can be tested via the ‘Test connection’ button.

Here are some details about each of the Moodle specific config items:

  1. When checked a Course completions tab becomes visible in the Transfer Results from Moodle LMS wizard. This tab will list any students’ courses that have been completed in Moodle. Whether they have completed the course will depend on the course completion settings on the Moodle course.
  2. Role ID is required when enrolling a student into a Moodle course. This should be the ID that aligns with your Moodle student role. By default, this is 5 and generally will not need to be edited.
  3. If checked, when VETtrak creates a new user in Moodle it will set their ‘Authentication method’ to ‘VETtrak authentication’, use this only when using the Moodle VETtrak authentication plug-in to allow new students create from VETtrak to log into Moodle using their student portal credentials. Unchecked, VETtrak will tell Moodle to create the password itself. If you have configured SMTP settings correctly in Moodle this will email the student temporary account details with a link to setup their Moodle account.
  4. As Moodle does not provide us with a start date for activities, the scenario can arise where all we know is the graded date, which is used to default the finish date of the result in VETtrak. This leaves an error stating that the result must have a started date. When this preference is checked we will use the start date of the VETtrak enrolment to avoid this error and streamline the process. However, the start date of the enrolment will be ignored when:
    • More than one activity is mapped to the unit/task as we use the earliest graded date of the two as the start date
    • An expected start date has been entered against the unit in the training plan
  5. By default VETtrak does a single match attempt using Client Code. Optionally, an additional match can be configured:
    If no match is found or no match rules are configured VETtrak will create a new Moodle user – unless a Moodle user ID is present in the LMS student identifier field within the personal wizard.
    • “Match VETtrak client code with Moodle user ID number’

      When checked, VETtrak clients will be matched with Moodle users that have an ID number matching their VETtrak client code.

    • “Match VETtrak client with Moodle user by fields’

      Selected fields will be used to check for an existing Moodle user before creating a new one. Fields are combined via an AND operation. E.g. Email and First name must both match if selected

Click Next to continue

Unit Result Mapping


Set up Unit and Task result mapping as required and finish the setup wizard.


Mapping a VETtrak Occurrence to a Moodle Course 

Navigate to the occurrence you wish to align to a Moodle course in the Programme Manager, right click and choose Link occurrence to Moodle course.

VETtrak will attempt to locate the course in Moodle, looking for a Course ID that matches the occurrence ID. If it doesn't find one it is possible to create a new course. Enter the short and full name for the course and pick a category then create course in Moodle to have that course auto created.

Alternatively if the course already exists in Moodle, you can add the Occurrence ID into the Course ID number field in Moodle as shown below:  

Then come back to VETtrak and click on Check again, this time the screen will be updated to show a list of Moodle Activities in that course: 

Choose the Units and or Tasks (if configured) that map to the various Moodle activities.

Be aware that only specific Moodle Activities support being mapped to VETtrak Units and Tasks.

Please refer to the table below for a list of Moodle Activity items that are valid for use.

Moodle Activity types that CAN be usedMoodle Activity types that can NOT be used
  • Assignments
  • Attendance
  • Checklist
  • H5P
  • Lessons
  • External tool
  • Quizzes
  • SCORM Packages

  • BigBlueButton
  • Books
  • Chats
  • Choices
  • Custom certificate
  • Databases
  • Feedback
  • Folders
  • Forums
  • Glossaries
  • IMS content package
  • Labels (Text and media area)
  • Pages
  • File
  • Surveys
  • URLs
  • Wikis
  • Workshops
Note: You can choose to automatically send new enrolments to Moodle as well. If not enabled, you can do this by right-clicking in the Enrolment node and choosing Transfer enrolments to Moodle.

Occurrence edits

Occurrence changes can impact the linked Moodle course:

  • Changing the start/finish date will change the dates of the linked Moodle course
  • Changing the status will change the visibility of the course in Moodle.

Enrolment edits

Enrolment changes do not cause any changes to the enrolment in Moodle once it has been pushed due to limitations with the Moodle API.


Transferring enrolments to Moodle

Enrolments can be automatically pushed to Moodle when the automatically send has been enabled on an occurrence. To initiate a manual transfer of enrolments, right click on the Enrolments node of the Occurrence when viewing in the Programme Manager and choose Transfer enrolments to Moodle:

Enrolments that have a green Status are able to be transferred to Moodle, the white status indicates that the enrolment has already been transferred and red indicates an issue is preventing that enrolment from being transferred.

You are able to fix issues at either the client or enrolment directly from here by choosing the appropriate option form the Open dropdown list. Once corrected the status will be updated if the record is able to be pushed.

Use the Transfer button to initiate the push of the enrolment to Moodle.

To match an existing student already enrolled into Moodle. Add the VETtrak Client Code to the Moodle User ID field for the student by Editing their profile in Moodle. Then transfer the enrolment as above, VETtrak will find that users enrolment based on the Client Code and User ID matching:

The following Client Fields will sync with Moodle when a linked client is edited within VETtrak:

Moodle fieldVETtrak Field
idnumberClient Code (CLIE_CODE)
usernameClient Username (CLIE_USERNAME)
firstnameClient Given Name (CLIE_GIVEN)
middlenameClient Middle/Other Name (CLIE_OTHER)
lastnameClient Surname (CLIE_SURNAME)
emailClient Email (CLIE_EMAIL)
suspendedClient Is Inactive (CLIE_ARCHIVED)

Note: Upon Editing a Client and making it inactive, the clients Moodle user will be suspended


Resulting units/tasks

Results can be managed in two ways, either at the occurrence level or for all linked courses.

At the occurrence level, you can initiate a result transfer by right clicking on the enrolments node of the Occurrence in the Programme Manager and choosing the Transfer results from Moodle option.

This can also be actioned for all courses via the Utility->LMS Integration->Transfer result from Moodle menu option.

When the screen is displayed, click on the download button to have VETtrak fetch all the unrecorded results for this course. It is possible to stop this process from executing by pressing the Stop Download button which appears while VETtrak is downloading results.

To process results, either choose the Process All button to process all results with a green status. Alternatively you can process one record at a time by using the Add button next to each individual record.

You can also update dates and change result types prior to processing, should that be required.


Task and Unit Results  

We categorise results retrieved from Moodle into 3 buckets, Started, Passed, and Failed. A unit/task is considered:

  • Started – when some mapped activities have a grade greater than or equal to the passing grade in Moodle but not all. See Activity Start Dates below for more information.  
  • Passed – when all mapped activities have a grade that is greater than or equal to the passing grade in Moodle.
  • Failed – when any mapped activities have a grade that is lower than the passing grade in Moodle.

When recording results for failed is turned off, units/tasks will be considered started instead of failed.

Results will not show for units/tasks that have already been completed. Additionally, units/tasks will not be started if they are already started.


Course completions

Course completions will only be shown if the enrolment is still active and Moodle has marked the student as completed the course. Moodle has a very flexible configuration for course completions. The VETtrak status date will be the date when the latest completion condition was met in Moodle. E.g.

For a Moodle course that is configured to complete when Activity A, B and C are completed. If a student completes the activities in order A, B, and then C the status will be set to the date that student completed Activity C.


Troubleshooting results

If a course or activity completion is not registering in the Integration, please check either the Course participation or Activity completion reports against the Moodle course just to confirm that the result have been recorded as expected.


Activity Start Dates

For some organisations, the Moodle Activity Start date will be a critical determinant as to when claiming can be commenced for a unit and is, therefore, a key part of the information that needs to extracted from Moodle. 

Unfortunately, the Moodle LMS does not make activity start dates accessible via its API. This means that there is no way VETtrak can reliably ascertain a Unit or Task start date.

Now to overcome this limitation, VETtrak supports a special feature that can use the earliest Moodle activity completion date as the start date or the VETtrak Unit or Task, when multiple activities are mapped to that Unit or Task.

So what this means is that you can insert at the start of a block of activities mapped to a VETtrak Unit or Task, a special "autocomplete" activity that can be set up so it is auto-completed by the student who is then allowed to progress onto the actual learning activity. This activity might be a simple one question quiz that asks the student a confirmation question

All you need to do in VETtrak is make sure these activities are mapped to the appropriate Unit/Task in VETtrak. You will need one of these activities for each group of Moodle activities that are mapped to a single VETtrak unit/task.

When VETtrak encounters a completed activity VETtrak will find the earliest completed date from all the activities and use that as the unit/task commencement date.




Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.