Need Comp_sector in a view

Hi!

I am looking to amend a view to include comp_sector. The base view would be for communications but the one field I am missing is the

sector/segment. Any help would be appreciated:

CREATE VIEW vSummaryCommunication AS
SELECT Communication.*, Comm_Link.*, vPersonPE.*, vCompanyPE.* FROM
Communication LEFT JOIN Comm_Link ON Comm_CommunicationId =
CmLi_Comm_CommunicationId LEFT JOIN vPersonPE ON CmLi_Comm_PersonId =
Pers_PersonId LEFT JOIN vCompanyPE ON CmLi_Comm_CompanyId = Comp_CompanyId WHERE
Comm_Deleted IS NULL AND CmLi_Deleted IS NULL

  • 0

    Hi,

    The view you are getting all your company fields from is vCompanyPE. On 7.2 f 1, comp_sector is included:

    SELECT epd_comp.epd_EmailAddress as Comp_EmailAddress,epd_comp.epd_PhoneCountryCode as Comp_PhoneCountryCode,epd_comp.epd_PhoneAreaCode as Comp_PhoneAreaCode,epd_comp.epd_PhoneNumber as Comp_PhoneNumber,epd_comp.epd_FaxCountryCode as Comp_FaxCountryCode,epd_comp.epd_FaxAreaCode as Comp_FaxAreaCode,epd_comp.epd_FaxNumber as Comp_FaxNumber,Company.*
    FROM Company
    LEFT JOIN CRMEmailPhoneData epd_comp ON epd_comp.epd_EntityID = 5 AND epd_comp.epd_RecordID = Comp_CompanyID
    WHERE Comp_Deleted IS NULL


    As it is selecting all fields from the company table.

    Can you check to see what the syntax is for your vCompanyPE. If Company.* is not present, you can add comp_sector into this view, then it would be available in the view with the syntax you provided above, as this selects vCompanyPE.*, all fields from vCompanyPE which comp_sector would then be part of.

  • 0

    You would not need to, as it selects all from Company:

    SELECT epd_comp.epd_EmailAddress as Comp_EmailAddress,epd_comp.epd_PhoneCountryCode as Comp_PhoneCountryCode,epd_comp.epd_PhoneAreaCode as Comp_PhoneAreaCode,epd_comp.epd_PhoneNumber as Comp_PhoneNumber,epd_comp.epd_FaxCountryCode as Comp_FaxCountryCode,epd_comp.epd_FaxAreaCode as Comp_FaxAreaCode,epd_comp.epd_FaxNumber as Comp_FaxNumber,Company.* FROM Company LEFT JOIN CRMEmailPhoneData epd_comp ON epd_comp.epd_EntityID = 5 AND epd_comp.epd_RecordID = Comp_CompanyID WHERE Comp_Deleted IS NULL

    Company.* means select all from table company.

    vCompanyPE selects all from company, where comp_sector presumably is held, then the syntax in your original post selects all from vCompanyPE, so comp_sector is available in the view. Run the view in Management Studio to check.

    If comp_sector is not being displayed for use in CRM, it could be security stopping it being displayed to the user.

  • 0

    What are you doing in CRM? Report? New tab? Escalation? Screen? List?

    Go to:

    Administration - Customisation - Company

    Look at the fields tab, can you see comp_sector?

    If you can, look at its field level security, what does that show?

  • 0

    Thank you for all your help.

    It is my understanding that I shouldn't change a core view or does that apply only to a system view? Here is the vCompanyPE (coreview):

    CREATE VIEW vCompanyPE AS SELECT epd_comp.epd_EmailAddress as Comp_EmailAddress,epd_comp.epd_PhoneCountryCode as Comp_PhoneCountryCode,epd_comp.epd_PhoneAreaCode as Comp_PhoneAreaCode,epd_comp.epd_PhoneNumber as Comp_PhoneNumber,epd_comp.epd_FaxCountryCode as Comp_FaxCountryCode,epd_comp.epd_FaxAreaCode as Comp_FaxAreaCode,epd_comp.epd_FaxNumber as Comp_FaxNumber,Company.* FROM Company LEFT JOIN CRMEmailPhoneData epd_comp ON epd_comp.epd_EntityID = 5 AND epd_comp.epd_RecordID = Comp_CompanyID WHERE Comp_Deleted IS NULL

    How would I insert the comp_sector in properly?

    (Thank you!!)

  • 0

    Hmmm ... I have administrator rights and I can't see this field. I am stumped. :-)

    Thanks!