moodle-tool_trigger
moodle-tool_trigger copied to clipboard
User Lookup: Specified userid field not present in the workflow data
Hi there, every time I try to use a User Lookup step in a trigger, I get the log below when running the scheduled task:
Execute scheduled task: Process workflows scheduled task. (tool_trigger\task\process_workflows)
... started 12:43:01. Current memory use 5.6MB.
Executing workflow: 1
Execute workflow step: 1, \tool_trigger\steps\lookups\user_lookup_step
Debug info:
Specified userid field not present in the workflow data:
Backtrace:
* line 76 of /admin/tool/trigger/classes/helper/processor_helper.php: call to tool_trigger\steps\lookups\user_lookup_step->execute()
* line 199 of /admin/tool/trigger/classes/task/process_workflows.php: call to tool_trigger\task\process_workflows->execute_step()
* line 142 of /admin/tool/trigger/classes/task/process_workflows.php: call to tool_trigger\task\process_workflows->process_item()
* line 91 of /admin/tool/trigger/classes/task/process_workflows.php: call to tool_trigger\task\process_workflows->process_queue()
* line 253 of /lib/cronlib.php: call to tool_trigger\task\process_workflows->execute()
* line 120 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
* line 73 of /lib/cronlib.php: call to cron_run_scheduled_tasks()
* line 81 of /admin/cron.php: call to cron_run()
... used 13 dbqueries
... used 0.010113954544067 seconds
Scheduled task complete: Process workflows scheduled task. (tool_trigger\task\process_workflows)
A simple scenario would be to send an email with the user's firstname/lastname/username when the "user has logged in". I have the same issue on Moodle 3.9 and 3.10. The email action which is below the Lookup step is not executed.
Would you know where the issue comes from? Thank you
HI @philipsiwinski
Can you please provide following information:
- Moodle version
- Plugin version (git hush is preferable)
- Exact steps to replicate including exact setup steps from scratch
This will help to investigate.
Thanks @dmitriim,
I experienced the issue with Moodle 3.10+ (Build: 20201217)
, Moodle 3.9.5+ (Build: 20210324)
and Moodle 3.9.3+ (Build: 20210115)
with the latest version of the plugin on Moodle plugins (2021030400)
.
Today I tried to download a zip from github (2021030401)
. I was still having the issue after I updated the installed plugin.
I think the issue fixed itself after changing the value of the new "User id data field" field in the User Lookup step, saving, setting it back to userid
and saving. Now the lookup works fine and the email action step works with profile fields.
Later, I tried to uninstall the latest version from github and install the version from Moodle plugins. The issue did not come back. I will try to take more time to prepare clear steps to reproduce the issue.
Thanks a lot.
thanks @philipsiwinski
It seems to have happened to me as well, except I have not checked the scheduled task logs.
If you downloaded version 2021030400 to define the trigger with the User Lookup step, then it did not have the useridfield
in the UI form, even though the field is defined and used in the implementation class. In fact, it assumes a valid value will be available regardless, "failing" the step if it did not find the user through the undefined field. In my case, the step would silently fail.
The master branch seems to have fixed this.
If you would rather not use the master branch, you could either set the field name directly in the database, or export the workflow, add the missing field to the JSON, then re-import.