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 :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Automatic Email Tracking and auto attaching to regarding

(1) ShareShare
ReportReport
Posted on by 14
I want to be able to automatically email tracking and it automatically attach to where it belongs. We receive a lot of email communications for work orders and I would like for the email to automatically attach to the specific work order number -- when we are emailing or being emailed about a job the work order number is always in the subject 
I have the same question (0)
  • Suggested answer
    Dengliang Li Profile Picture
    Microsoft Employee on at
    Hi,
     
    This can be implemented by adding JavaScript to the onload event of the email form and the onchange event of the Regarding column.
     
    function onload(executionContext){
      var formContext = executionContext.getFormContext();
     
      // Gets the value of regarding field
      var regarding = formContext.getAttribute("regardingobjectid").getValue();
     
      // If the value of regarding filed is null or not a work order, exit the function.
      if(regarding === null || regarding[0].entityType !=="msdyn_workorder" ){
      return;
    }
    // Gets the work order number
    var workorderNum = regarding[0].name;
     
    // Set the work order number to the value of the subject field.
    formContext.getAttribute("subject").setValue(workorderNum)
     
    }
     
     
    function onchange(executionContext){
      var formContext = executionContext.getFormContext();
      var regarding = formContext.getAttribute("regardingobjectid").getValue();
     
      // If the value of regarding filed is null or not a work order, clear the subject field and exit the function.
      if(regarding === null || regarding[0].entityType !=="msdyn_workorder" ){
      formContext.getAttribute("subject").setValue(null)
      return;
    }
     
    // Gets the work order number
    var workorderNum = regarding[0].name;
     
    // Set the work order number to the value of the subject field.
    formContext.getAttribute("subject").setValue(workorderNum)
     
    }
     
     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more.
    If you have further questions, please feel free to contact me .
     
    Best Regards,
    Dengliang Li
     
     

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 > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Siv Sagar Profile Picture

Siv Sagar 52 Super User 2025 Season 2

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 42 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans