How to limit the list of tables for a Document ID field?

ty_roach
Tera Guru

I've created a Document ID field following the Creating a Document ID field wiki article.   In my case I made my u_document_id field dependent on my u_table field, which I made a choice list of two values: cmn_location and service_offering.   I was hoping that would limit the list of table options for my u_document_id field but it did not.   When I click my u_document_id field, I get the modal DocumentID popup which shows "Table Name" field and "Document" field and all tables are available in the "Table Name" field.   It does not seem to be limiting my list of choices as I wanted.

How do I accomplish this?

1 ACCEPTED SOLUTION

mmongeau
Giga Guru

It can be done using the tableChoicesScript dictionary attribute documented here (tested in Helsinki).


Create a Script Include with a method named process() that returns an array of table names.


Add the tableChoicesScript attribute to the table field (not the Document ID field) and point it at the custom Script Include.



Attributes:   tableChoicesScript=myTableFilter



Script Include:   myTableFilter



var myTableFilter = Class.create();


myTableFilter.prototype = {


      initialize: function() {


      },



  process: function() {


            return ['incident','problem'];


  },



      type: 'myTableFilter'


};



Michael


View solution in original post

2 REPLIES 2

mmongeau
Giga Guru

It can be done using the tableChoicesScript dictionary attribute documented here (tested in Helsinki).


Create a Script Include with a method named process() that returns an array of table names.


Add the tableChoicesScript attribute to the table field (not the Document ID field) and point it at the custom Script Include.



Attributes:   tableChoicesScript=myTableFilter



Script Include:   myTableFilter



var myTableFilter = Class.create();


myTableFilter.prototype = {


      initialize: function() {


      },



  process: function() {


            return ['incident','problem'];


  },



      type: 'myTableFilter'


};



Michael


Michael:



Sorry for my slow response to your reply.   Your suggestion worked!   I never knew that.   Thank you!   BTW, it worked in Geneva too (since that is the version I'm dealing with).