The new Send Email task is better in most ways, but the old one was much easier to manipulate with custom code. I think I may just be missing something in my approach, so I could use some help with this.
The TO and CC fields are now Kendo MultiSelect controls, and there is much documentation out there about how to set the value of one. The very brief version of this is myControl.value(['big-scary-guid-for-first-person','big-scary-guid-for-second-person']);. Some apparent caveats: the value (guid in this case) needs to be part of the filtered list (the list that appears if you start typing in the field) which for it to match, and most pertinent to my question here, there is apparently some event that needs to be triggered to get the new value to show up on the screen.
I have been successful setting a filter and adding the value to the control, and I even see my selected value in the DOM (Kendo controls always maintain an old-school HTML control in the background and I can see my value get selected in the <select> tag), but the screen never gets updated. What am I missing here?
Here is my approach so far (just using TO for now) in pseudo code, to help answer the question:
toField.dataSource.filter({
field: 'Id',
operator: 'eq',
value: pageForm.viewModel.ContactPerson.Id<br> // ContactPerson is a custom relationship--substitute affected user (RequestedWorkItem) for the same result<br>});
<br>toField.listView.setDSFilter(toField.dataSource.filter());
toField.value([pageForm.viewModel.ContactPerson.Id]);<br>//In practice, you would merge the new value with the existing array , but I'm leaving that out for brevity<br><br>toField.trigger('change');<br><br>// Behold! Absolutely nothing changes on the page!<br>
var toField = $('select#userPickerTo').data('kendoMultiSelect');<br><br>toField.dataSource.filter({});<br>
This is based heavily on some of the Kendo docs. When I attempt something similar in JSBin or Dojo it works, but not in the SMP. What's different?
Answers
I am a big fan of the overall design of this new feature, but it has turned out to be nightmarish to customize. (Nothing new, just the same as we were doing with the old form).
It appears that it will be a while before there is anything to share.