code: public static int getFieldID(FieldType type)
     {
        int result;
        switch (type.getFieldTypeClass())
        {
           case TASK:
           {
              result = MPPTaskField.TASK_FIELD_BASE | MPPTaskField.getID((TaskField) type);
              break;
           }
  
           case RESOURCE:
           {
              result = MPPResourceField.RESOURCE_FIELD_BASE | MPPResourceField.getID((ResourceField) type);
              break;
           }
  
           case ASSIGNMENT:
           {
              result = MPPAssignmentField.ASSIGNMENT_FIELD_BASE | MPPAssignmentField.getID((AssignmentField) type);
              break;
           }
  
           default:
           {
              result = -1;
           }
  
        }
        return result;
     }
docs: Retrieve an MPP9/MPP12 field ID based on an MPXJ FieldType instance.
  
  @param type FieldType instance
  @return field ID