Return a List of Specified Field Values for All Entities of a Certain Type
PPM Pro provides two operations that work similarly, but one is used to return values from all entities of a specific type, and the other returns values from one instance of an entity.
-
findEntity returns values for all entities
-
selectEntity returns values for a specific instance of an entity
If you know the entityId, it is generally faster to use selectEntity. However, there are scenarios, like the one below, that use findEntity to issue a broader request.
This example is looking for all active users (the entity type and condition), and returns their user and login IDs.
-
User entityTypeId = 23
-
Active attribute = 2301, set to True
-
Fields to retrieve: userid (2315), login (2303), first name (1103) and last name (1104)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services" xmlns:xsd="http://objects.services/xsd">
<soapenv:Header/>
<soapenv:Body>
<ser:findEntity>
<ser:sessionId>F0C6EDD44B270B1F3DD0F1492A2A1585</ser:sessionId>
<!--entity type id is 23 for a user lookup -->
<ser:entityTypeId>23</ser:entityTypeId>
<!--Search condition – Active?(2301) should be 'true'-->
<ser:searchValuePairs>
<xsd:elementValue>true</xsd:elementValue>
<xsd:id>2301</xsd:id>
</ser:searchValuePairs>
<!--The list attributes to be fetched: userid(2315), login(2303), first name(1103), last name(1104)-->
<ser:fieldsRequest>2315</ser:fieldsRequest>
<ser:fieldsRequest>2303</ser:fieldsRequest>
<ser:fieldsRequest>1103</ser:fieldsRequest>
<ser:fieldsRequest>1104</ser:fieldsRequest>
</ser:findEntity>
</soapenv:Body>
</soapenv:Envelope>
Response (partial)
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:findEntityResponse xmlns:ns="http://services" xmlns:ax21="http://objects.services/xsd">
<ns:return xsi:type="ax21:EntityObj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax21:entityId>8349290</ax21:entityId>
<ax21:entityTypeId>23</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>8349290</ax21:elementValue>
<ax21:id>2315</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>John000</ax21:elementValue>
<ax21:id>2303</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>John</ax21:elementValue>
<ax21:id>1103</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Smith</ax21:elementValue>
<ax21:id>1104</ax21:id>
</ax21:methodValues>
</ns:return>
<ns:return xsi:type="ax21:EntityObj" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax21:entityId>8349357</ax21:entityId>
<ax21:entityTypeId>23</ax21:entityTypeId>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>8349357</ax21:elementValue>
<ax21:id>2315</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Mary7654</ax21:elementValue>
<ax21:id>2303</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Mary</ax21:elementValue>
<ax21:id>1103</ax21:id>
</ax21:methodValues>
<ax21:methodValues xsi:type="ax21:ValuePair">
<ax21:elementValue>Jones</ax21:elementValue>
<ax21:id>1104</ax21:id>
</ax21:methodValues>
</ns:return>