Residencies = new Mongo.Collection('residencies');

var ResidenciesSchema = new SimpleSchema({
  residentId: {
    type: String,
  },
  homeId: {
    type: String,
    autoform: {
      options: function() {
        // Get all Groups
        var groups = Groups.find().fetch();

        // Create an array of Group IDs
        var groupIDs = _.map(groups, function (group) {
          return group._id;
        });

        // Create select options for Homes input
        // Grouping homes by group
        var homeSelectOptions = _.map(groupIDs, function (groupId) {
          // Find the name of this group
          var groupName = Groups.findOne(groupId).name;

          // Get all homes of this group
          var groupHomes = Homes.find({groupId: groupId}).fetch();

          // Create a homes array with name/ID pairs for label/value
          var homesOptions = _.map(groupHomes, function (groupHome) {
            // Combine resident first name and last initial
            var homeName = groupHome.name;

            // Create option for this resident, with ID as the value
            return {label: homeName, value: groupHome._id};
          });

          // Return residents and home as option group
          return {optgroup: groupName, options: homesOptions};
        });

        return homeSelectOptions;
      }
    }
  },
  moveIn: {
    type: Date,
    autoValue: function () {
      if (this.isSet) {
        // Get move in date from form
        const moveInDate = new Date(this.value);

        // set move in to midnight UTC
        moveInDate.setUTCHours(0,0,0,0);

        return moveInDate;
      }
    },
  },
  moveOut: {
    type: Date,
    optional: true,
    autoValue: function () {
      if (this.isSet) {
        // Get move out date from form
        const moveOutDate = new Date(this.value);

        if (moveOutDate) {
          // set move out to midnight UTC
          moveOutDate.setUTCHours(0,0,0,0);

          return moveOutDate;
        }
      }
    },
  }
});

// Add i18n tags
ResidenciesSchema.i18n("residencies");

Residencies.attachSchema(ResidenciesSchema);

@@ -122,21 +122,491 @@
 String,%0A
+    autoform: %7B%0A      options: function() %7B%0A        // Get all residents%0A        const residents = Residents.find(%7B%7D, %7Bsort: %7BfirstName: 1, lastInitial: 1%7D%7D).fetch();%0A%0A        // create options list for select%0A        residentOptions = _.map(residents, function (resident) %7B%0A          // Create option for this resident, with ID as the value%0A          return %7Blabel: resident.fullName(), value: resident._id%7D;%0A        %7D);%0A%0A        return residentOptions;%0A      %7D,%0A    %7D%0A
   %7D,%0A
-
   homeId
@@ -1516,39 +1516,40 @@
 on for this 
-resident
+home
 , with 
+home 
 ID as the va
@@ -2103,16 +2103,106 @@
 %0A    %7D,%0A
+    autoform: %7B%0A      afFieldInput: %7B%0A        type: %22bootstrap-datepicker%22%0A      %7D%0A    %7D,%0A
   %7D,%0A  m
@@ -2561,17 +2561,108 @@
    %7D,%0A  
-%7D
+  autoform: %7B%0A      afFieldInput: %7B%0A        type: %22bootstrap-datepicker%22%0A      %7D%0A    %7D,%0A  %7D,
 %0A%7D);%0A%0A//

Add autoform options for residents select