Query to find contact associated in Sub-accounts

Query to find contact associated in Sub-accounts

SELECT org.NAME "Account Name",aaauser.FIRST_NAME "Contact Name",ucinfo.EMAILID "Contact Email", au1.first_name "Subaccount Contact's name", aci.emailid "Subaccount's contact's email address" FROM AaaUser aaauser LEFT JOIN AaaUserContactInfo user_contact ON aaauser.USER_ID=user_contact.USER_ID LEFT JOIN AaaContactInfo ucinfo ON user_contact.CONTACTINFO_ID=ucinfo.CONTACTINFO_ID LEFT JOIN SDUser sduser ON aaauser.USER_ID=sduser.USERID LEFT JOIN Customer_Requester custreq ON sduser.USERID=custreq.REQUESTER_ID LEFT JOIN Customer cust ON custreq.CUSTOMER_ID=cust.CUSTOMER_ID LEFT JOIN AaaOrganization org ON cust.CUSTOMER_ID=org.ORG_ID LEFT JOIN Customer_Product cust_prd ON cust.CUSTOMER_ID=cust_prd.CUSTOMER_ID LEFT JOIN ComponentDefinition prd ON cust_prd.PRODUCT_ID=prd.COMPONENTID LEFT JOIN ComponentType prdType ON prd.COMPONENTTYPEID=prdType.COMPONENTTYPEID LEFT JOIN Department_Account dep_acc ON cust.CUSTOMER_ID=dep_acc.ACCOUNTID LEFT JOIN Customer_Fields account_udf ON dep_acc.DEPARTMENT_ACCOUNTID=account_udf.DEPARTMENT_ACCOUNTID LEFT JOIN DepartmentUser dep_user ON sduser.USERID=dep_user.USERID LEFT JOIN subaccount sac on org.org_id=sac.parentaccountid left join customer_requester cr on sac.subaccountid=cr.customer_id left join aaauser au1 on cr.requester_id=au1.user_id left join aaausercontactinfo auci on au1.user_id=auci.user_id left join aaacontactinfo aci on auci.contactinfo_id=aci.contactinfo_id WHERE (((((aaauser.DESCRIPTION LIKE '%Hosted%') AND (account_udf.UDF_CHAR1 = 'Active')) AND (prdType.COMPONENTTYPENAME = 'Hosted')) AND (prd.COMPONENTNAME = 'SMSC')) AND ((((dep_user.DEPARTMENTID = 1) AND ( dep_user.USERTYPE = 'Contact')) AND ((prd.DEPARTMENTID = 1) OR (prd.DEPARTMENTID IS NULL))) AND ((dep_acc.DEPARTMENTID = 1) OR (dep_acc.DEPARTMENTID IS NULL)))) AND (sduser.STATUS='ACTIVE') ORDER BY 1
                  New to ADManager Plus?

                    New to ADSelfService Plus?

                      • Related Articles

                      • Query to find Contact roles

                        All requests from their account and sub account  SELECT aaauser.FIRST_NAME "Contact Name",org.NAME "Account Name",ucinfo.EMAILID "Contact Email",ucinfo.LANDLINE "Contact Phone",ucinfo.MOBILE "Contact Mobile",ucinfo.FAX "Contact Fax" FROM AaaUser ...
                      • query to find the unapproved contacts -> PGSQL

                        Below is the query to find the unapproved contacts -> PGSQL-> can be used from version 11 SELECT aaauser.User_id AS "User ID", aaauser.first_name "First name", aaauser.last_name "Last name", hd.id "Portal ID", hd.displayname "Portal Name", ...
                      • Steps to Import accounts / contacts through schedule csv from SCP 11001 build

                        This is applicable only from 11001 builds. How to do? # Based on the Globalconfig table entry with category as 'CSVUserImportSchedule', this can be turned ON/OFF. By default this is turned OFF. Query to enable the feature - update Globalconfig set ...
                      • Query to display Accounts and Sub Accounts (8.1)

                        Execute the below query from the Reports Tab -> New Query (Applicable for 8.1 version) SELECT acc.NAME AS "Account",sorg.NAME AS "Sub Account" FROM Customer cust  LEFT JOIN AaaOrganization acc ON cust.CUSTOMER_ID=acc.ORG_ID  LEFT JOIN SubAccount ...
                      • Query to find the last logged time of a contact in the portal

                        select aas.session_id "SessionID", aal.name "User Name",aau.FIRST_NAME "Contact Name",org.NAME "Account Name", parentorg.NAME "Parent Account Name",suborg.name "Sub Account", aas.user_host "User Host", aas.application_host "Application Host", ...