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

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested answer

Updating a Case Description with the content of the first activity in timeline

(0) ShareShare
ReportReport
Posted on by 50

Hi,

I am hoping to find a simple solution that can update an automatically created case with the content of the first activity(email) in the timeline.

I have found older solutions to this that involved either JavaScript or Plugins, but I am hoping in 2019 someone has found a simpler solution.

Forum-Question-_2D00_-Case-description.png

It may be that @Leo Zhang can help?

Thanks @luhao for pointing me in the right direction.

Look forward to a simple solution (hopefully a simple update workflow?!)  Could be done as and when case is assigned maybe?

Thanks

Mark

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Updating a Case Description with the content of the first activity in timeline

    Hello,

    I believe workflow that will handle "Create" of activity can help you. Implementation should be pretty simple - triggered on create of activity, check that regarding is case, update the case's description with the description of activity. Sounds easy but... there are a lot of scenarios that can't be handled without plugins like:

    1. Imagine that your latest activity is deleted. Obviously description has to be changed to the 2-nd activity that was on the list before deletion.

    2. Imagine that activity's description was updated - there is no guarantee that it was the latest activity so it's not clear should be the description of case updated or not.

    I can continue the list because I implemented similar task using plugins.

    My recommendation - if you don't have developer - hire him/her to do the plugin that will resolve your issue.

    Good luck.

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at
    RE: Updating a Case Description with the content of the first activity in timeline

    Hi partner,

    Thanks for your invitation,

    1.About updating case description based on the latest email.

    Only when an email's regarding field is related to this case, then this email will show on the timeline. So you could use workflow to update the case automatically.

    a).Set the trigger condition.

    pastedimage1573200698614v1.png

    pastedimage1573200874866v2.png

    the email receiver should be the customer of the case.

    b).Create an update action.

    pastedimage1573200941855v3.png

    pastedimage1573200962176v4.png

    map the description of email to case description.

    Note that this function is only available when you sending and receiving emails in Dynamics 365. If the email is from outside, you should use Dynamics 365 app for outlook to track the case for the email so that the "regarding" feild will be related to the case, otherwise the process will throw error.

    2.About set the email content to case description.

    I saw a similar issue in another thread, and the customer finally resolved the issue by replacing the mapping field from "description(email)" to "EmailMessage(Email)".

    https://community.dynamics.com/365/customerservice/f/dynamics-365-for-customer-service-forum/371033/strange-text-showing-in-the-front-of-all-email-case-descriptions

    But I then tried in my instance with "description" and "EmailMessage", I found a strange thing that when I use "description", then it showed me orginal html code like yours. And when I use "EmailMessage", it showed the Subject of the email and without other code.

    Unfortunately, due to some rules of D365, we could not get the email content directly without coding. The more common method at present is still using custom workflow with C# to do this.

    https://community.dynamics.com/365/financeandoperations/b/nareshsdynamicsaxblog/posts/create-custom-workflow-in-d365-dynamics-365

    https://zapobjects.com/microsoftdynamics365_crm_email_parser_app/implementing-email-case-functionality-simple-way-using-zap-email-parser-microsoft-dynamics-365-crm/

    But in your case, I found another easier way to do this. We could use JS code to extract the message content from the HTML code and make it as a value to reset to the description field.

    Please add this js function to the form onload event. And it means you need to open the case form at least one time to convert the original html code to correct content in decsription field.

    function getContent(executionContext){
        var formContext = executionContext.getFormContext();
        var content=formContext.getAttribute("description").getValue();
        var content=content.split('mal">')[1];
        var content=content.split('<o:p>')[0];
        formContext.getAttribute("description").setValue(content);
        //alert(content);
    }

    Original:

    pastedimage1573201838661v5.png

    Now:

    pastedimage1573201983846v1.png

    Hope it helps,

    Best Regards,

    Leo

  • Mark.Fletcher Profile Picture
    50 on at
    RE: Updating a Case Description with the content of the first activity in timeline

    Leo, thanks for your help with this.

    My boss says I can give it a try, but on a copy of the standard Case form!!

    I have a couple of questions as I have never done JS stuff before!  See screenshot:

    2019_2D00_11_2D00_11_5F00_19_2D00_22_2D00_19.png

    I assume once the conversion has taken place (on load), then nothing will happen on NEXT load of the form?!

    Cheers,

    Mark

  • Suggested answer
    LeoAlt Profile Picture
    16,331 Moderator on at
    RE: Updating a Case Description with the content of the first activity in timeline

    Hi partner,

    Your understanding is correct.

    For example I want to let system alert a message "123" when loading the case form, I will do the following steps.

    Pay attention that if you want to add js code to case in UCI(Customer Service Hub), you should add the js function to "case for Interactive experience" form.

    1.Create a web resource with js code.

    pastedimage1573543396464v1.png

    pastedimage1573543485533v2.png

    2.Add the js function to the form onload event.

    pastedimage1573543582239v3.png

    Note that if you used my code in my last answer, you should select the "Pass execution context as first parameter" because we should use "executionContext" to get the formcontext.

    pastedimage1573543663846v4.png

    Save and publish.

    Then refresh the case form and the alert message will show to us when loading the form.

    pastedimage1573543843322v5.png

    The onload events of form will always be triggered when loading the form (refresh the form, open the form...).

    About form events, you could refer to the following doc.

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/configure-event-handlers-legacy

    Hope it helps.

    Best Regards,

    Leo

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 46 Super User 2025 Season 2

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 46

#3
CU23101130-0 Profile Picture

CU23101130-0 17

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans