Skip to main content

Notifications

Announcements

No record found.

Customer Service forum

What message and what entity to use for my plugin

Posted on by 90

Hi,

I need help with the following:

I have already got the email to Case OOB process to work. The incoming email contains some custom field values within its body. I am trying to intercept the process, parse email body and set those values on Case. I have looked at many online posts but still having trouble to get this to work.

I registered my plugin on Create of Email but the regardingobjectid which should reference the Case says the given key is not present in data dictionary... so basically the email does not contain that attribute. Do you have any advice in terms of the best approach for doing this? Would it be a good idea to register the plugin on Case instead of Email? Any other suggestions? Any references to how to parse the email body would be helpful too. 

Thank you so much in advance. Looking forward to your response.

August

Categories:
  • HomayounAugust Profile Picture
    HomayounAugust 90 on at
    RE: What message and what entity to use for my plugin

    Hi,

    Your solution by adding a custom field to the case and copying the email body to it I believe is excellent. As you know, I still have to get rid of the html tags and do a lot of parsing but I think this should achieve what I am looking for. Thank you again. I really appreciate your help.

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: What message and what entity to use for my plugin

    Hi,

    you also can do below things, then you can set the plugin trigger on email update. but i personally dont prefer this method, because what if there are multiple emails available, then you have to write additional code to check. 

    36.png

  • Verified answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: What message and what entity to use for my plugin

    Hi,

    That is why we have second options, copy the email body message to a custom field in Case.

    37.png

  • HomayounAugust Profile Picture
    HomayounAugust 90 on at
    RE: What message and what entity to use for my plugin

    Hi,

    It seems like this is not going to work. When the plugin triggers on create of case from email the regarding field of email has not been set yet. The case gets created and then the regarding field is set on email so it seems like we cannot register the plugin on create of case.

  • HomayounAugust Profile Picture
    HomayounAugust 90 on at
    RE: What message and what entity to use for my plugin

    I can't thank you enough. Thank you so much for all your help Fun Wei Jie.

    August

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: What message and what entity to use for my plugin

    Hi,

    if you are using automatic create and update rule, yes do it there , you can map it from there

  • HomayounAugust Profile Picture
    HomayounAugust 90 on at
    RE: What message and what entity to use for my plugin

    Hi,

    How do I set the email body text to a custom field on Case. I can create a custom hidden field on Case but how do I map it to email body? Do it through Record Creation and Update Rule workflow?

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: What message and what entity to use for my plugin

    Hi ,

    yes, you are right,

    but you also can save the effort by setting the email body text into one of the field in Case.  ( I personally would prefer this method)

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: What message and what entity to use for my plugin

    Hi,

    pass in the case guid into "passinthecaseid", refer below link on how to construct the query using fetchxml

    [View:https://msdn.microsoft.com/en-us/library/gg328117.aspx:750:50]

    Sample code ( please read through the above link)

    <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>

     <entity name='email'>

       <attribute name='subject' />

       <attribute name='regardingobjectid' />

       <attribute name='from' />

       <attribute name='to' />

       <attribute name='prioritycode' />

       <attribute name='statuscode' />

       <attribute name='modifiedon' />

       <attribute name='activityid' />

       <attribute name='description' />

       <order attribute='subject' descending='false' />

       <filter type='and'>

         <condition attribute='regardingobjectid' operator='eq' value = '"+passinthecaseid+"' />

       </filter>

     </entity>

    </fetch>

  • HomayounAugust Profile Picture
    HomayounAugust 90 on at
    RE: What message and what entity to use for my plugin

    I think I know what you mean now. So you are saying that I register the plugin on Case. Then within the plugin search for emails where the regarding field is set to this case and retrieve the email from there. Am I right?

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans