I have a form that started via Workflow, has it's initial variables assigned to it's fields, and then is assigned to an approval task. There is then a timer on this approval task that triggers a workflow to update the variables. The first issue is that when the user loads the form, it still shows the original variable values from when the form was first assigned and not the latest ones assigned by the Workflow. I understand this is due to different submission ID's and thus I started writing the appropriate variables to SQL tables and now the form fills them based on lookups. This is also working fine with lookups but the issue now is that when the form loads, there does not seem to be a way to trigger the lookup automatically so it loads the current SQL values. If I change the single input field to something else and then back, it does trigger the lookups and the fields do correctly update to their new values. My goal was then to trigger a change via JavaScript but have not had any luck.
To simplify it (as my form is filling 5 tables and 20+ fields), here is an example. Field1 is triggering the SQL Lookups that fill Field 2 and Table1. The form is started with the Invoke Business Process Workflow activity and Field1, Field2, and Table1 are filled with their initial values via the Set Business Process Variables Workflow activity. This works fine to start the form, fill those fields, and assign it to the first approval step. When the user opens the form at this first approval step, they see the values that were assigned by the Workflow activity instead of the current values if the Lookups were to run.
- If they manually change Field1 to something else and then back, Field2 and Table1 update correctly
- If JavaScript tries to trigger a change event on Field1, nothing happens
So far I've tried many variations of triggering the change event, including those below:
- $('#q1').change();
- $('.class input').change();
- $('.class input).trigger('change');
- $('#q1').trigger('change');
I've also tried changing the value to something else, triggering the change event, changing it back to it's original value, and triggering the change event. Has anyone successfully triggered a Lookup when a form first loads based on a single line field that already has a value assigned?