moodle-tool_trigger icon indicating copy to clipboard operation
moodle-tool_trigger copied to clipboard

Web Service Action Does Not Retain Look Up Fields

Open thebenkahn opened this issue 3 years ago • 1 comments

Hello - the web service step as an action is an awesome addition! I did notice that the step results after a web service step complete only contain the Webservice Function: data error exception fields. This seems to mean that look up fields from any previous steps are not available in subsequent steps, although they are still listed under 'Available fields' in the form when adding more steps. You can do a look up on the original event again but I don't believe that is intended/doesn't work that way with other action types?

Attaching a workflow as an example. Should work as is to test on a site with a least one course (id=2) and the Course Creator role (role id =2). On user creation it looks up the user, runs a WS action, looks them up again, and assigns a role.

  1. Import workflow
  2. Create a user
  3. Verify user added to course 2 via a WS action and assigned role 2 via a role assignment action
  4. Edit the workflow, and remove the "look up again" step
  5. Rerun the workflow or create another user
  6. Observe the the enroll via WS action works but role action errors since the user_id lookup field is not present

Webservice_Testing_20220519_1834.zip

thebenkahn avatar May 19 '22 18:05 thebenkahn

Hi @thebenkahn, thanks for the great bug report. We have just hit this internally, and Ive nailed the error down to some dodgy open transaction handling, and some weird behaviour from the Moodle WS API. I should have this fixed soon.

Peterburnett avatar May 30 '22 05:05 Peterburnett