Index: src/hg/hgTables/joining.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgTables/joining.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -b -B -U 4 -r1.56 -r1.57
--- src/hg/hgTables/joining.c	17 Jun 2009 18:54:50 -0000	1.56
+++ src/hg/hgTables/joining.c	12 Apr 2010 05:32:51 -0000	1.57
@@ -315,9 +315,22 @@
 	struct dyString *dy)
 /* Make comma-separated field list in same order as fields are in
  * custom track. */
 {
-struct slName *fieldList = getBedFields(15);
+char *track = dtfList->table;
+struct customTrack *ct = ctLookupName(track);
+char *type = ct->dbTrackType;
+struct slName *fieldList = NULL;
+if (startsWithWord("makeItems", type))
+    {
+    struct sqlConnection *conn = hAllocConn(CUSTOM_TRASH);
+    fieldList = sqlListFields(conn, ct->dbTableName);
+    hFreeConn(&conn);
+    }
+else
+    {
+    fieldList = getBedFields(15);
+    }
 makeOrderedCommaFieldList(fieldList, dtfList, dy);
 slFreeList(&fieldList);
 }
 

