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 :
Customer Service forum

What message and what entity to use for my plugin

(0) ShareShare
ReportReport
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:
I have the same question (0)
  • Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    first, you can try to set the email body into one of field in case ( perhaps you create a custom field to hold it).  Register your plugin on case entity and create message ( pre or post , depending your preferences and requirements), get the value from the field and start to read the body message and update the field according to the logic.

  • HomayounAugust Profile Picture
    90 on at

    Hi,

    Thank you for your response. If I register the plugin on case how can I get the email information including the body within the plugin? I mean there is an Activities tab on the case but how can I get to it?

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    There is a field inside email called regarding,  it should reference to the case. So you can use the caseid to search the field in email.

    35.png

  • HomayounAugust Profile Picture
    90 on at

    Hi,

    Thanks again. I know about the regarding field. It is actually regardingobjectid. This field is on Email and not case so if I register the plugin on Case, how can I get to the related email? If I register the plugin on email which is what I am doing currently, I can get the case from regarding but somehow the service.update doesn't update the case. That is what I need. I need to update the case per email.

  • HomayounAugust Profile Picture
    90 on at

    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?

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    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>

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    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)

  • HomayounAugust Profile Picture
    90 on at

    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
    33,628 on at

    Hi,

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

  • HomayounAugust Profile Picture
    90 on at

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

    August

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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans