Record Producer Select Which Variables Appear on Drop Down Menu

Scott93
Tera Contributor

On our demand table we have a routing precedence column with 5 different labels.  The demand table and routing precedence labels are shared across many different catalog items /record producers.   

 

There is a request for one particular record producer to only show two of the 5 different lables on the drop down menu. Below are the 5 choices.  We only want Low and Urgent to appear. 

 

Current choices but only want two of these to appear.Current choices but only want two of these to appear.

 Just in case here are the labels in the dmn_demand table. 

demand table routing precedence column choices.jpg

 

Issue is most options search the demand table's list view to return values.  In our case we want to populate the demand table's routing precedence fields with the choice selected in the record producer.   

 

I believe the best option is the Lookup Select Box but I cannot filter out 3 of the column labels to just show Low and Urgent on the submission form. 

 

There are a lot of enteries on the Developer Forum such as filter to show choices from the sys_user table list view but I haven't had any luck in options for the Lookup label field(s) or Reference qualifiers.  Not as easy as adding "Low,Urgent" or "u_Low,u_Urgent" in the label field.

 

lookup select box.jpg

 

Any suggestions would be appreciated. 

2 ACCEPTED SOLUTIONS

@Scott93 You should add the client script in the Client Script related list of the Record Producer. The What is will contain script is a server side script and it will not be able to run the client side code.

 

Screenshot 2024-04-05 at 12.21.43 AM.png

View solution in original post

Jim Coyne
Kilo Patron

The actual simplest way to solve the problem would be to use a Select Box and enter in the 2 choices with the same values and labels as the ones from the Demand table.

 

Duplicates choices, yes, but the less code we use, the better: easier maintenance and less chance of problems.

 

What you are doing now is getting values from another table, adding them to the drop down list and then removing more options than what you are leaving behind.  And anyone maintaining this after you has to be aware of the Client Script that removes the options (not an obvious thing, especially for a junior developer).  You are just adding complexity for no good reason.

 

The first answer to solving a problem should NOT be adding more code.

View solution in original post

10 REPLIES 10

Sandeep Rajput
Tera Patron
Tera Patron

@Scott93 Instead of choosing the variable type as Look up select box, you should choose Select box and in the type specification of the Select box choose choice table as Demand [dmn_demand] and Choice field as Routing Precedence.

Screenshot 2024-04-04 at 11.53.51 PM.png

Now in order to remove just show Low and Urgent as options. You simply need to use an onLoad Client script and add

 

function onLoad() {
g_form.removeOption('routing_precendence','Routine'); 
g_form.removeOption('routing_precendence','Priority');
g_form.removeOption('routing_precendence','Urgent/Critical');
}



 

 

Hope this helps.

Thank you Sandeep.   My question is where do I add the onLoad Client script?    I just tried it in the script section of the record producer's What it will contain tab. 

@Scott93 You should add the client script in the Client Script related list of the Record Producer. The What is will contain script is a server side script and it will not be able to run the client side code.

 

Screenshot 2024-04-05 at 12.21.43 AM.png

Sandeep thank you for continuing to work with me.

Please see screen shot below.   Still receive all choices from the demand table. 

I have tried different combinations such as:

  • Type = OnLoad
  • Isolate Script box checked or not checked.
  • Different combos of Applies on Catalog & Target record boxes.

    catalog client scripts.jpg