Migrating `core_enrol_edit_user_enrolment` to `core_enrol_submit_user_enrolment_form`

Re: Migrating `core_enrol_edit_user_enrolment` to `core_enrol_submit_user_enrolment_form`

by István Holbok -
Number of replies: 1

I ran into the same problem. The "core_enrol_submit_user_enrolment_form" webservice parameters are not documented.
The Webservice documentations contains the following data: 

Submit form data for enrolment form

Arguments

formdata (Required)  - The data from the event form

General structure

string   //The data from the event form

XML-RPC (PHP structure)

[formdata] => string

REST (POST parameters)

formdata= string

---------

The event form (it is a modal) collects the following data:

<input name="ue" type="hidden" value="740"> where ue is the id of the ##__user_enrolments table
<input name="ifilter" type="hidden" value="">
<input name="sesskey" type="hidden" value="hCLcwZGuII">
<input name="_qf__enrol_user_enrolment_form" type="hidden" value="1">

status (0 active, 1 suspended)
timestart
timeend

The ue (as unique ID) would be enough to find the record if it is part of the POST request. But, the webservice API returns:

[exception] => dml_missing_record_exception
[errorcode] => invalidrecord
[message] => The user_enrolments table do not contains record.
[debuginfo] => SELECT * FROM {user_enrolments} WHERE id IS NULL

The call was:
/webservice/rest/server.php?moodlewsrestformat=json&wstoken=...&
wsfunction=core_enrol_submit_user_enrolment_form&
formdata=%7B%22ue%22:%22740%22,%22timestart%22:%22%22,%22timeend%22:%221661990399%22%7D

Is there any idea? It would be help to solve this issue.