Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi,

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.

Thanks!

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

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?

Thanks!

By: Jianchun You 13 Dec 2019

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi,

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),
  getScreenElementName(screenElementIndex),
  getScreenElementType(screenElementIndex),
  getScreenElementConfig(screenElementIndex));

SearchEngine se;
se.addField("project.project_id");
se.addField("project.name");
se.addCriteria("project.name", "contains", "xyz");
for(se.select();!se.eof();se.next())
{
  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

 

By: Michel Krohn-Dale 16 Dec 2019

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi Michel.

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!

By: Jianchun You 16 Dec 2019

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi,

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 field
2. Ok button script on screen: Set value from Listbox field into ticket field (ticket.x_projekt)

 

By: Michel Krohn-Dale 18 Dec 2019

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi Michel,

Thanks! My Prolem is now solved.

By: Jianchun You 18 Dec 2019

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi Michel,

 

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?

 

Thanks!

By: Jianchun You 3 Feb 2020

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Hi,

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?

By: Michel Krohn-Dale 3 Feb 2020

RE: Is it possible to define own restriction to Project Relation List for Page to Edit Ticket

Thanks Michel!

By: Jianchun You 3 Feb 2020