XWeb:GetQuery Member Information
Case Study
We have a Customer Key (cst_key) of an Individual and we want to know if this individual is a Member. There are three ways to find this out on this page, from Simple, to Medium, to Complex.
Request Simple
Here is the simplest version. We pass the known cst_key of the Individual as part of the szWhereClause
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.avectra.com/2005/">
<soapenv:Header>
<ns:AuthorizationToken>
<ns:Token>56c2ffc4-ede7-49cd-9c96-f4f63b6b0af7</ns:Token>
</ns:AuthorizationToken>
</soapenv:Header>
<soapenv:Body>
<ns:GetQuery>
<ns:szObjectName>Individual</ns:szObjectName>
<ns:szColumnList>vst_member_flag</ns:szColumnList>
<ns:szWhereClause>cst_key='93e12046-e259-4576-afc8-648a2a72391e'</ns:szWhereClause>
<ns:szOrderBy></ns:szOrderBy>
</ns:GetQuery>
</soapenv:Body>
</soapenv:Envelope>
Response Simple
In the response, this line tells us what we need to know. A value of "1" means they receive member benefits, and "0" means they do not.:
<vst_member_flag>0</vst_member_flag>
Here is the complete response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<AuthorizationToken xmlns="http://www.avectra.com/2005/">
<Token>56c2ffc4-ede7-49cd-9c96-f4f63b6b0af7</Token>
</AuthorizationToken>
</soap:Header>
<soap:Body>
<GetQueryResponse xmlns="http://www.avectra.com/2005/">
<GetQueryResult>
<IndividualObjects recordReturn="1" xsi:schemaLocation="http://www.avectra.com/2005/ Individual.xsd">
<IndividualObject>
<ind_cst_key>93e12046-e259-4576-afc8-648a2a72391e</ind_cst_key>
<vst_member_flag>0</vst_member_flag>
</IndividualObject>
</IndividualObjects>
</GetQueryResult>
</GetQueryResponse>
</soap:Body>
</soap:Envelope>
Request Complex
netFORUM has a concept in Membership called "receives member benefits" that is slightly different from simply "being a member". If you are a Member, then you receive member benefits, but the converse is not necessarily always true. A trade organization, for example, may be a Member, and its active employees might receive member benefits by virtue of being connected to that Member organization, but depending on how netFORUM is configured, these individuals might or might not also be called a "Member". (See Member#Member_and_Receives_Member_Benefits for more on this topic.)
So, depending on what you are looking for, you might want to evaluate either/or:
- cst_member_flag - is a member - 1 if yes, 0 if no
- vst_member_flag - receives member benefits - 1 if yes, 0 if no. If cst_member_flag is 1, then vst_member_flag must always be 1.
In the request, we ask for both fields. Depending on what you want, you might want to get both, or just one or the other:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.avectra.com/2005/">
<soapenv:Header>
<ns:AuthorizationToken>
<ns:Token>1bb9d050-e988-4b66-a5d5-d6a6121f22a0</ns:Token>
</ns:AuthorizationToken>
</soapenv:Header>
<soapenv:Body>
<ns:GetQuery>
<ns:szObjectName>Individual</ns:szObjectName>
<ns:szColumnList>vst_member_flag,cst_member_flag</ns:szColumnList>
<ns:szWhereClause>cst_key='93e12046-e259-4576-afc8-648a2a72391e'</ns:szWhereClause>
<ns:szOrderBy></ns:szOrderBy>
</ns:GetQuery>
</soapenv:Body>
</soapenv:Envelope>
Response Complex
Here is a sample response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<AuthorizationToken xmlns="http://www.avectra.com/2005/">
<Token>1bb9d050-e988-4b66-a5d5-d6a6121f22a0</Token>
</AuthorizationToken>
</soap:Header>
<soap:Body>
<GetQueryResponse xmlns="http://www.avectra.com/2005/">
<GetQueryResult>
<IndividualObjects recordReturn="1" xsi:schemaLocation="http://www.avectra.com/2005/ Individual.xsd">
<IndividualObject>
<ind_cst_key>93e12046-e259-4576-afc8-648a2a72391e</ind_cst_key>
<vst_member_flag>0</vst_member_flag>
<cst_member_flag>0</cst_member_flag>
</IndividualObject>
</IndividualObjects>
</GetQueryResult>
</GetQueryResponse>
</soap:Body>
</soap:Envelope>
Request with More Membership Information
The examples above return only a 1 or 0. Sometimes you might want to know more about the membership, such as the member type (mbt_code), status (mbs_code) , join date, expiration date, termination date, termination reason, etc. Note that a single individual may possibly have more than one membership, or might not have any memberships. Note that this will work only for customers who own the membership. If you try this query with the customer key of an Individual who receives member benefits by being linked to a Member Organization, then this query will not work -- it returns zero records. You will need to run this query based on the customer key of the customer from whom the individual receives member benefits (which is typically the Individual's primary organization but not always).
Here is a start:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.avectra.com/2005/">
<soapenv:Header>
<ns:AuthorizationToken>
<ns:Token>1bb9d050-e988-4b66-a5d5-d6a6121f22a0</ns:Token>
</ns:AuthorizationToken>
</soapenv:Header>
<soapenv:Body>
<ns:GetQuery>
<ns:szObjectName>mb_membership</ns:szObjectName>
<ns:szColumnList>mbr_cst_key, mbt_code, mbs_code, mbr_join_date, mbr_expire_date, mbr_terminate_date, mbr_terminate_reason</ns:szColumnList>
<ns:szWhereClause>mbr_cst_key='3bb9d050-e988-4b66-a5d5-d6a6121f22a0'</ns:szWhereClause>
<ns:szOrderBy>mbr_cst_key</ns:szOrderBy>
</ns:GetQuery>
</soapenv:Body>
</soapenv:Envelope>
Response with More Membership Information
Here is a sample response:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Header>
<AuthorizationToken xmlns="http://www.avectra.com/2005/">
<Token>1bb9d050-e988-4b66-a5d5-d6a6121f22a0</Token>
</AuthorizationToken>
</soap:Header>
<soap:Body>
<GetQueryResponse xmlns="http://www.avectra.com/2005/">
<GetQueryResult>
<mb_membershipObjects recordReturn="300" xsi:schemaLocation="http://www.avectra.com/2005/ mb_membership.xsd">
<mb_membershipObject>
<mbr_key>0d62f8b1-2935-4571-bd91-36374db0a6f3</mbr_key>
<mbr_cst_key>3bb9d050-e988-4b66-a5d5-d6a6121f22a0</mbr_cst_key>
<mbt_code>Local Regional Member Secondary</mbt_code>
<mbs_code>Active</mbs_code>
<mbr_join_date>11/1/2006 12:00:00 AM</mbr_join_date>
<mbr_expire_date>11/1/2007 12:00:00 AM</mbr_expire_date>
<mbr_terminate_date>11/17/2006 12:00:00 AM</mbr_terminate_date>
<mbr_terminate_reason xsi:nil="true"/>
</mb_membershipObject>
<mb_membershipObject>
<mbr_key>3bbfa068-818f-45f0-a60d-9d96408fa9d1</mbr_key>
<mbr_cst_key>3bb9d050-e988-4b66-a5d5-d6a6121f22a0</mbr_cst_key>
<mbt_code>Local Remodeler</mbt_code>
<mbs_code>Active</mbs_code>
<mbr_join_date>1/1/1995 12:00:00 AM</mbr_join_date>
<mbr_expire_date>1/1/2008 12:00:00 AM</mbr_expire_date>
<mbr_terminate_date xsi:nil="true"/>
<mbr_terminate_reason xsi:nil="true"/>
</mb_membershipObject>
</mb_membershipObjects>
</GetQueryResult>
</GetQueryResponse>
</soap:Body>
</soap:Envelope>