Some users may experience random login-problems to our Community. We are investigating the root cause of this. If you get an error message from CloudFlare, please send the RayID in the message to support@superoffice.com. You may also clear your browser cookies and cashe to solve it. Thanks for your understanding. 

Help with SuperOffice CRM Script: Finding Contacts by Category

lock
push_pin
done
Besvaret
2

I'm developing a CRMScript and need to search for contacts with category custom category. For testing I have just labeled it "C", but I'm getting the error "SearchEngine::useField() contact.category not found" when using either contact.category or contact.category_id in my SearchEngine criteria. What's the correct field name to use when searching for contacts by category in SuperOffice CRM, and should I be using the category name 'C' as a string or looking for an ID number instead? Any working code examples would be very helpful.

12. maj 2025 | 10.17 PM

Alle Svar (2)

Hi Kamil, the field in the database is named "category_idx".

Generally it is better to use ID's instead of names when you want to make a lookup like this. Here is an example;

SearchEngine se;
se.addField("contact.contact_id");
se.addField("contact.name");
se.addCriteria("contact.category_idx", "in", "2");
se.setLimit(1000);
for (se.execute(); !se.eof(); se.next())
{
    String name = se.getField("contact.name");
    printLine(name);
}
13. maj 2025 | 06.24 AM

Hi Kamil

In addition to what Frode said, you can find the field names you're looking for in the database reference:

https://docs.superoffice.com/en/database/tables/contact.html

13. maj 2025 | 06.39 AM

Tilføj svar