I am currently trying to get the values in a dropdown list to change depending on the current step. I am not very good with JavaScript, but I have the following that mostly works.
const updateProbationDropdown = async () => { var mNum = LFForm.getFieldValues({fieldId: 71}); if (mNum.match(/.*Probation.*/)) { await LFForm.changeFieldOptions( { fieldId: 40 }, [{label: "Current"},{label: "Ending Employment"}], "replace" ); } else { // do stuff when it is not probation } } // Check on change LFForm.onFieldChange(updateProbationDropdown, {fieldId: 71}); // Check on form load updateProbationDropdown()
Where fieldId 41 is the dropdown list.
I have a SQL Stored Procedure updating fieldId71 with the Step Name. However, the lookup is only performed once, and the field value becomes static for the following tasks/steps.
Is it possible to either update fieldId 71 JavaScript to get the current step name? Or, get the current step name in the JavaScript itself?
We're using the latest v12 Forms