I have created a user-Feld to Project Relation for Tickets. My Question is, by Page to "Edit Ticket", coudl I seach Project in this List with my own restriction for example for all projects which any project features = xyz.
I have also create my Listbox.
just how to insert my searchEngine in the scripts where I can deifne my own restriction to Project Relation List?
Its possible to do this with ListBox or Select relations, depending on what you prefer.
For ListBox you can programmatically add options like this in Creation script;
HtmlElement el = addHtmlElement(getScreenElementId(screenElementIndex),
se.addCriteria("project.name", "contains", "xyz");
el.setFieldValue("add", Map().insert("name", se.getField("project.name")).insert("value", se.getField("project.project_id")));
For Select relations you can add in Simple values;
column.0.displayField = project.name
column.0.label = Name
column.0.operator = OperatorContains
column.0.searchField = project.name
column.length = 1
criteria.0.field = project.name
criteria.0.indent = 0
criteria.0.operator = OperatorContains
criteria.0.rowOperator = OperatorAnd
criteria.0.value = xyz
criteria.length = 1
FlagNoNewButton = true
FlagOnlyOne = true
idField = ticket.x_project
label = Project
Thanks for your both Solution!
with your scripts for my Listbox, it works fine what i need!
with the scripts for my List to Project Reletion, i have user-filed x_projekt to that and although it displays in Page of Edit Ticket, but this feld doesn't automatically display in Screen -> in my copy of Edit Ticket 80 "ej_editTicket_80_kopieren" where i have connected to Edit ticket with ScreenChoosers, so i can only manully created a second List to Project Reletion Projekt2, but I think this has no connection with my x_projekt.
Neverthekless, the first one for my Listbox is a good solution. Thanks!
As you dont want to use the automatical generated field for x_project, but your own definition of this field you will need to do some behind code.
1. Loading script on screen: Load value from existing ticket (ticket.x_projekt) into your Listbox field2. Ok button script on screen: Set value from Listbox field into ticket field (ticket.x_projekt)
Thanks! My Prolem is now solved.
it works to set restriction with searchEngine in Creation Scripts to Listbox in Edit Ticket.
Default is always the first item selected in List.
But, it only displays my restricted List, If I select one item of list and save te Ticket, the Ticket still keeps the first item saved to this Ticket, no matter what I selected.
Question: how to save my selected item to current Ticket?
In my example I have this code in OK button, note that I have put it below standard code to set extra fields.
Could it be that you are missing this in your screen?