Derived search field disappear, metadata refresh bring it back.

Hi,

So I change the view below to link to PhoneLink and Phone table to get the person mobile number. Then I put the [MobileNumber] into Person Search Screen.

But it disappear from the person search screen some time, metadata refresh bring it back though.

May I know where went wrong?

CREATE VIEW vSearchListPerson AS
SELECT
RTRIM(ISNULL(Pers_FirstName, '')) + ' ' + RTRIM(ISNULL(Pers_LastName, '')) AS Pers_FullName,
epd_pers.epd_EmailAddress as Pers_EmailAddress, epd_pers.epd_PhoneCountryCode as Pers_PhoneCountryCode,
epd_pers.epd_PhoneAreaCode as Pers_PhoneAreaCode, epd_pers.epd_PhoneNumber as Pers_PhoneNumber,
epd_pers.epd_PhoneFullNumber AS Pers_PhoneFullNumber, epd_pers.epd_FaxCountryCode as Pers_FaxCountryCode,
epd_pers.epd_FaxAreaCode as Pers_FaxAreaCode, epd_pers.epd_FaxNumber as Pers_FaxNumber,
epd_pers.epd_FaxFullNumber AS Pers_FaxFullNumber, 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, Person.*, Company.*,
Address.* ,phone.Phon_Number as [MobileNumber]
FROM Person
LEFT JOIN CRMEmailPhoneData epd_pers ON epd_pers.epd_EntityID = 13 AND epd_pers.epd_RecordID = Pers_PersonID
LEFT JOIN Company ON Pers_CompanyId = Comp_CompanyId AND Comp_Deleted IS NULL
LEFT JOIN CRMEmailPhoneData epd_comp ON epd_comp.epd_EntityID = 5 AND epd_comp.epd_RecordID = Comp_CompanyID
LEFT JOIN Address ON Pers_PrimaryAddressId = Addr_AddressId AND Addr_Deleted IS NULL
LEFT JOIN PhoneLink on PLink_EntityID=13 AND PLink_RecordID=Pers_PersonId AND PLink_Type='mobile' AND PLink_Deleted IS NULL
LEFT JOIN Phone on PLink_PhoneId=phone.Phon_PhoneId AND Phon_Deleted IS NULL
WHERE Pers_Deleted IS NULL

  • 0

    Hi,

    You haven't got any metadata for the [MobileNumber] field, so you might find that things get a little flaky. Try adding a dummy text field to the Person entity called pers_mobilephonenumber. You won't want to store any data in it. Once you've done this, take out the Person.* from the view, and enumerate the Person fields required (Pers_PersonId, Pers_Firstname, Pers_Lastname etc). You can then alias off Phone.Phon_Number as Pers_MobilePhoneNumber and use it on the screen.

    What you're doing involves making changes to a system view, which may cause issues on upgrades, or in normal operation if the view returns unexpected results, but so long as you're aware of it (and have tested your changes!) you should be ok.

    Thanks,

    Rob