Summary:

When you add users to a communication you may receive an error message saying the organiser is not present in the user list even though the organiser is present in the user list.


Symptoms:

The "Organizer" field is visible in "CustomCommunicationDetailBox" (hidden=false;).
"User A" logs into SCRM and opens a Person. User A goes to the Communication tab and clicks "New Task" (i.e.).
They change the "Organizer" and remove "User A" from the "Users-Selection" field in the "CommunicationSchedulingBox". 
They add some users to the "Users-Selection" field and add the user they put into "Organizer", ensuring that the Organizer is not at the first position of the field.

When trying to save the first time an error message pops up:

"You cannot save an appointment if the organiser is not present in the user list. In order to save this appointment please choose a different organiser from the 'organiser' field or ensure that the specified organiser has been added to the user list."

After changing the fields again, the communication can be saved but the User at the first position of the User-Selection field is switched with "User A" who was removed from the field.


Cause:

This is caused by the javascript on the page adding the users to the cmli_comm_userid selection list on the screen in the incorrect order. This means the wrong user is removed from the users field when you click remove.


Workaround:

Add the following script into the custom content for the screen: Administration -> Customisation -> Communication -> CommunicationSchedulingBox 

<script>

cmli_comm_useridOnChange = function () {     reSort();     openscheduler(); }

$("#cmli_comm_useridView").change(reSort());

function reSort() {     var len = document.forms['EntryForm'].cmli_comm_useridView.length;     var sortedArray = [];

    for (i = 0; i < len; i++) {         sortedArray[i] = document.forms['EntryForm'].cmli_comm_useridView[i];     }

    for (i = 0; i < len; i++) {         document.forms['EntryForm'].cmli_comm_userid[i].value = sortedArray[i].value;         document.forms['EntryForm'].cmli_comm_userid[i].text  = sortedArray[i].text;

    } }

 

</script>