Default "Assigned To" field on Change Request Form to Active User
Best Answer
-
Nicholas_Velich Cireson Consultant Ninja IT Monkey ✭✭✭✭You can indeed use JavaScript to accomplish this. Here is an example that auto assigns the current user after a 3 second delay:setTimeout(function(){var assignedToField = $('[data-control-bind="AssignedWorkItem"]').data("kendoAutoComplete"); // Find the AssignedWorkItem control's Kendo Auto Complete dataassignedToField.dataSource.add(session.user); // Add the current user to the Kendo Auto Complete's data sourceassignedToField.value(session.user.Name); // Set the value from the data sourceassignedToField.trigger("change"); // Trigger the change, which will update the View Model NOW, rather than on a save/reload}, 3000);
This is obviously not ready for production, as you would need to add a few things:
1. Check to make sure the Assigned User is not already assigned
2. Check to make sure we are on the Change Request page
3. Check to make sure it is a new Change Request, as opposed to an existing one where the Assigned User was cleared
4. Timeout should be replaced with something more reliable, such as a mutation observer
Thanks,
Nick5
Answers
Not sure how you would do it sorry.
However we have a policy whereby the creator of the CR is not necessarily the implementer, therefore there would be no value in this to my Change Control system.
I can see the benefit though.
This is obviously not ready for production, as you would need to add a few things:
1. Check to make sure the Assigned User is not already assigned
2. Check to make sure we are on the Change Request page
3. Check to make sure it is a new Change Request, as opposed to an existing one where the Assigned User was cleared
4. Timeout should be replaced with something more reliable, such as a mutation observer
Thanks,
Nick
@Nicholas_Velich - Thank you, again!