group by in SearchEngine

lock
push_pin
done
Beantwoord
5

hi,

we want to auto-fill in Tickets the extra-field "Cost Center" (in Germn "Kostenstelle") depending on its Ticket Person (in German "Ansprechpartner"), because each person in our Company belongs to a certain Cost Center:

This Association is stored in our Active Directoary. But in crm scripts there is no Connection to our AD. My Idee will be, seach in all Tickets, what is the most Cost Center for that Person, this will be auto. filled in new Ticket. In SO Database, i reach that with SQL-Statement for my Person, important is here group by in SQL:

Now i want to convert it in SearchEngine in crm scripts,

 

but it posts me Runtime Error  by Using grouping.

 

Thanks!

30 sep 2026 | 12:55 p.m.

Alles Antwoorden (5)

Is bypassing of NetServer enabled in the registry? As documented here:

Running a query

30 sep 2026 | 01:30 p.m.

Hi David,

thanks! I have updated the Reg ID 235 to Value 1, but it executed after 60 Sec. Timeout and posted me the same Runtime Error as above. Any Issues may be at setGroup(true)?

30 sep 2026 | 03:14 p.m.

This time it works and delivery me the same results as in Database.

i use "in" in stead of "OperatorIn", 

Problem is, it ran almost one min., i do believe if this runs in Trigger, it will last many times to save the Ticket.

and how could i sort by this with desc:

se2.addField("ticket.id", "COUNT");
 
Thanks!
30 sep 2026 | 03:32 p.m.

Using:

se2.setLimit(1);
se2.addOrder("ticket.id", "COUNT", false);
now I get Results sorted and limited. now the single Problem is, it lasts to long runtime.
30 sep 2026 | 03:53 p.m.

Hi David, it works now in Trigger. Thanks a lot!

1 okt 2026 | 08:56 a.m.

Reply toevoegen