web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Related emails are not showing in UCI

(0) ShareShare
ReportReport
Posted on by 40

Hi All

We have a customization to show all related emails for any specific Email(to show all replies, forwarded emails). Related emails showing in a subgrid of the Email form. This is perfectly working fine with classic interface. But related emails are not showing in UCI. Email entity is added to sitemap. Could you help me to understand what else I need to do for make it work.

Regards

Saman

I have the same question (0)
  • Verified answer
    Henry J. Profile Picture
    5,237 on at

    Hello Saman,

    Can you share details on how this was implemented on the email form?
    I'm assuming that there could be more than just a subgrid, perhaps JavaScript functions using unsupported or deprecated methods? Maybe plugins triggering on the RetrieveMultiple message?

    Thank you
    Henry

  • Saman Premathilaka Profile Picture
    40 on at

    Hi Henry

    Thanks for response. As you suggested Issue was with FetchXml.There was nothing wrong with RetrieveMultiple Plugin  as it developed to support fetchexpressions. Solution wans Intercept the fetchxml with by passing custom attributes. Source code added to below.

    Regards

    Saman

  • Suggested answer
    Saman Premathilaka Profile Picture
    40 on at

    This is solved by intercepting FetchXML. Values for custom attributes not passed from the UI. No change for plugin code as it was debeloped to support FetchExpressions. Source code as below.

    function SetReleatedEmailSubgrid(executionContext) {

    var isUnified = isUCI();

    if (isUnified) {

    var formContext = executionContext.getFormContext();

    var objSubGrid = formContext.getControl("RelatedEmails");

    var entityId = Xrm.Page.data.entity.getId();

    if (objSubGrid == null) {

    setTimeout(SetReleatedEmailSubgrid(executionContext), 2000);

    return;

    }

    //cc_relatedemailsid is a custom field

    var FetchXml = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' returntotalrecordcount='true' page='1' count='4' no-lock='false' >" +

    "<entity name='email' >" +

    "<attribute name='statecode' />" +

    "<attribute name='subject' />" +

    "<attribute name='to' />" +

    "<attribute name='from' />" +

    "<attribute name='statuscode' />" +

    "<attribute name='prioritycode' />" +

    "<attribute name='createdon' />" +

    "<order attribute='createdon' descending='true' />" +

    "<filter type='and' >" +

    "<condition attribute='cc_relatedemailsid' operator='eq' value='" + entityId + "' />" +

    "</filter>" +

    "<attribute name='activityid' />" +

    "<link-entity name='email' from='activityid' to='cc_relatedemailsid' alias='bb' >" +

    "<filter type='and' >" +

    "<condition attribute='activityid' operator='eq'  value='" + entityId + "' />" +

    "</filter>" +

    " </link-entity>" +

    "</entity>" +

    "</fetch>";

    objSubGrid.setFilterXml(FetchXml);

    objSubGrid.refresh();

    }

    }

    function isUCI() {

    return Xrm.Internal.isUci()

    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 58 Most Valuable Professional

#2
#ManoVerse Profile Picture

#ManoVerse 42

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans