Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Answered

Adding custom fields to Full-Text email search

Posted on by 55

I tried to enable full-text search in our MS CRM Instance but faced some issues. After FTS is enabled I can't use quick search at all because SQL errors occur. After some analysis, I found out that SQL queries that search trying to execute contain ActivityPointerBase table instead of EmailBase table, therefore, I can't use custom fields at all. There aren't any of them in ActivityPointerBase table. I can't disable them by the business requirements and can't enable FTS because quick search doesn't work at all. What can I do?


We're using CRM Dynamics 365 8.2 (on-premises)

  • ElevenZwolf Profile Picture
    ElevenZwolf 55 on at
    RE: Adding custom fields to Full-Text email search

    Thank you for the information. Can you mark my workaround post as the answer because I can't mark my own answer or should I mark one of your messages so the other people who face this problem will understand that this is not one of those never answered problems?

  • Suggested answer
    RE: Adding custom fields to Full-Text email search

    Hello ElezenZwolf,

    Hope you are well.

    After discussing this with PG, it was recognized the defect and created the workitem to fix it.

    This is although expected to be released only on the upcoming next onprem version that will be tentative to be released mid 2021.

    Thank you.

  • RE: Adding custom fields to Full-Text email search

    Hello Eleven,

    Thank you for the feedback.

    Yes, it's only happening with lookups and activity entity types.

    The workaround makes sense and is also a best practice once a slow SQL query is due to a lookup making a join on a huge secondary table.

    I'll still engage our Product Group to see if we can document it somehow.

    I'll get back at the end of week and will keep this thread open for this purpose.

  • Verified answer
    ElevenZwolf Profile Picture
    ElevenZwolf 55 on at
    RE: Adding custom fields to Full-Text email search

    After additional research we found out that the problem only occurs when we're using quick search on fields of lookup type. Text fields work perfectly fine. We're going to solve this problem with a workaround like this: create textfield and fill the value with a lookup name field using workflow or sql query. Obviously we'll also change lookup field in quickfind search view with a similar text field.

  • RE: Adding custom fields to Full-Text email search

    Seems this behavior happens with all entities of type activities.

    Let me try to understand if there is a design limitation here.

    On the meanwhile, are you still searching for a solution here or you found any workaround that fits your business logic?

    Thank you.

  • RE: Adding custom fields to Full-Text email search

    Hello ElevenZwolf,

    Hope you are well.

    I can actually replicate this same problem on my vanilla v9.

    I have been trying to find some official documentation that could justify this behavior, with statements around being by design or a limitation but i couldn't find them.

    My next step here is to test the same but using another type of entity other than Email, where i will basically add a lookup to another entity and enable quickfind "find" on that field.

    Will come back to you early next week.

  • ElevenZwolf Profile Picture
    ElevenZwolf 55 on at
    RE: Adding custom fields to Full-Text email search

    It's just a generic "invalid column name 'yg1_correspondence'" error, nothing special. After using SQL Profiler I found out that entire query looks like this:

    exec sp_executesql N'WITH __QuickFind__ as (select top 10001 [ActivityId] from (
    SELECT "email0".[ActivityId] AS [ActivityId] FROM [ActivityPointerBase] AS "email0" JOIN ContainsTable([yg1_correspondenceBase], (yg1_name), @yg1_correspondenceName0) AS "FTSLogical0" ON "email0".[yg1_correspondence] = "FTSLogical0".[Key]
    UNION 
    SELECT "email0".[ActivityId] AS [ActivityId] FROM [ActivityPointerBase] AS "email0" JOIN ContainsTable([ActivityPointerBase], (Subject, Sender, ToRecipients), @Subject0) AS "FTSExtension0" ON "email0".[ActivityId] = "FTSExtension0".[Key]
    UNION 
    SELECT "email0".[Key] AS [ActivityId] FROM ContainsTable([EmailBase], (yt1_copy_string), @yt1_copy_string0) AS "email0") as [__QuickFindInternal__])select 
    top 251 "email0".Subject as "subject"
    , "email0".RegardingObjectId as "regardingobjectid"
    , "email0".StatusCode as "statuscode"
    , "email0".ModifiedOn as "modifiedon"
    , "email0".yg1_statusactivity as "yg1_statusactivity"
    , "email0".CreatedOn as "createdon"
    , "email0".DirectionCode as "directioncode"
    , "email0".yt1_attachmentsarchived as "yt1_attachmentsarchived"
    , "email0".yg1_correspondence as "yg1_correspondence"
    , "email0".ActivityId as "activityid"
    , "email0".ProcessId as "processid"
    , "email0".yg1_existattachment as "yg1_existattachment"
    , "email0".yt1_hiddencopy_string as "yt1_hiddencopy_string"
    , "email0".yt1_copy_string as "yt1_copy_string"
    , convert(bigint, "email0".VersionNumber) as "versionnumber"
    , "email0".RegardingObjectIdYomiName as "regardingobjectidyominame"
    , "email0".RegardingObjectIdName as "regardingobjectidname"
    , "email0".RegardingObjectTypeCode as "regardingobjecttypecode"
    , "email0".yg1_correspondenceName as "yg1_correspondencename"
    , case when (select COUNT(*) from [__QuickFind__]) = 10001 then 1 else 0 end as [__QuickFindLimitValue__]
    , convert(bigint, "processidworkflowworkflowid".VersionNumber) as "processidworkflowworkflowid.versionnumber" 
    from
     Email as "email0" WITH (NOLOCK)  left outer join Workflow as "processidworkflowworkflowid" WITH (NOLOCK)  on ("email0".ProcessId  =  "processidworkflowworkflowid".WorkflowId) 
    where
     [email0].[ActivityId] in (select [ActivityId] from [__QuickFind__]) order by
     "email0".CreatedOn desc
    , "email0".ActivityId asc',N'@Subject0 nvarchar(200),@yg1_correspondenceName0 nvarchar(200),@Sender0 nvarchar(200),@yt1_copy_string0 nvarchar(200),@ToRecipients0 nvarchar(200)',@Subject0=N'((("zaza*" OR FORMSOF(FREETEXT, "zaza"))) OR ("zaza"))',@yg1_correspondenceName0=N'((("zaza*" OR FORMSOF(FREETEXT, "zaza"))) OR ("zaza"))',@Sender0=N'((("zaza*" OR FORMSOF(FREETEXT, "zaza"))) OR ("zaza"))',@yt1_copy_string0=N'((("zaza*" OR FORMSOF(FREETEXT, "zaza"))) OR ("zaza"))',@ToRecipients0=N'((("zaza*" OR FORMSOF(FREETEXT, "zaza"))) OR ("zaza"))'

    We require to use search on fields "yg1_correspondence" and "yt1_copy_string". The first one is a lookup field and the second is the regular string.

    It's weird that there's ActivityPointerBase in the query because I also used profiler with FTS turned off and there was only EmailBase table in the query.

  • Suggested answer
    RE: Adding custom fields to Full-Text email search

    Helo ElevenZwolf,


    Hope you are well.

    Can you share the SQL error that you are facing? 

    Custom fields on Email entity will be retrieved from the EmailBase, while all the other activities common fields, will use activityPointerBase.

    All activities views will still try to search in the fields that you configured for example on email Quick find, but for seeing a column on Email entity for a custom field, you need to go deeper on the activities section and go for the email entity views.

    But seems we don't have enough information right now to discuss understand the scenario any further.

    Can you extend your scenario please with more detailed explanations?


    Thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans