GetUserDefinedFields from all contact

lock
push_pin
done
Besvaret
1

Hi,

i have a field definied for contact

the field is SuperOffice:43.

By more contact are this field set to 44444.

How can i make a SearchEngine, to give me, all the contact that have SuperOffice:43 = 44444 ?

Have you got any Idea?

Thanks

14. nov. 2025 | 02.25 PM

Alle Svar (1)

My recommendation would be to use an archive provider query, it's faster.

#setLanguageLevel 4;

NSArchiveRestrictionInfo[] restrictions;
NSArchiveRestrictionInfo res1;
res1.SetName("contactUdef/SuperOffice:43");
res1.SetOperator("=");
res1.SetValues(String("44444").split(","));
restrictions.pushBack(res1);

NSArchiveOrderByInfo[] order;
 
String[] entities = String("contact").split(",");

Integer pageSize = 250;

NSArchiveAgent archiveAgent;
NSArchiveListItem[] rows = archiveAgent.GetArchiveListByColumns("SimpleContact", String("contactId,name,contactUdef/SuperOffice:43").split(","), order, restrictions, entities, 0, pageSize);

foreach (NSArchiveListItem row in rows) {
  Map rowData = row.GetColumnData();
  String contactId = rowData.get("contactId");
  String contactName = rowData.get("name");
  String contactUdef = rowData.get("contactUdef/SuperOffice:43");
  
  printLine(contactId + ": " + contactName + "=> " + contactUdef );
}

Hope this helps!

14. nov. 2025 | 02.44 PM

Tilføj svar