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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Timeline Activity Not Appearing after Changing Sender E-mail

(1) ShareShare
ReportReport
Posted on by 227
Hello,

When replying mails from timeline activity:

I'm modifying the default sender adress to the queue entity for every E-Mail form using below JS. However, e-mails sent this way are not recorded in the timeline of the case.

How can I change this behaviour?

Thanks.
 
function setSender(executionContext, entityType, name, ID) {
    var formContext = executionContext.getFormContext();
    // Check if the script has already run
    if (sessionStorage.getItem(/setSenderExecuted/)) {
        return; // Exit the function if the script has already run
    }
    // Set the /From/ field
    var lookup = new Array();
    lookup[0] = new Object();
    lookup[0].id = ID; 
    lookup[0].name = name; 
    lookup[0].entityType = entityType;
    formContext.getAttribute(/from/).setValue(lookup);
    // Mark the script as executed
    sessionStorage.setItem(/setSenderExecuted/, /true/);
}
 
I have the same question (0)
  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi,
    You need to set 'Regarding' column in the email through javascript.
    ‘Regarding’ column is also one special lookup, so you can also write code similar as 'From' column.
    --Changing attribute to regardingobjectid when set value.
    formContext.getAttribute('regardingobjectid').setValue(lookup);
    More details:

    I hope you can mark my answer verified if it answer your question! If you have any questions, please feel free to contact me.
    Regards,
    Leah
     
  • Barış Kuzu Profile Picture
    227 on at
    I couldn't find a way to access ticketnumber and title from e-mail form so that I can set regardingobjectid. Could you also help with that?
  • Suggested answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi,
     
    There is one lookup column in the email.
    --In replied emails, the Parent Activity Id column store the parent or initial email id.
    So you can retrieve parent email get regarding value through the column value .
  • Barış Kuzu Profile Picture
    227 on at
    Sorry, I'm new to all Power Apps world. I call this function onLoad when a user clicks reply in timeline of a case. 

    This is my incomplete code.  I can't access parentactivity id on the e-mail form. it's not there?

    I think one of the mistakes lies in the line:

    var lookupObject = formContext.getAttribute("ticketnumber"); // Get the Lookup Object
     
    var formContext;
    function getLookupValue(executionContext) {
        formContext = executionContext.getFormContext(); // Get formContext
        var lookupObject = formContext.getAttribute("ticketnumber"); // Get the Lookup Object
        if (lookupObject != null) {
             console.log("lookupObject value is not null")
            var lookupObjectValues = lookupObject.getValue(); // Get the Lookup Value
            if (lookupObjectValues != null) {
                var RecordId = lookupObjectValues[0].id; // Get the Lookup id
                var RecordName = lookupObjectValues[0].name; // Get the Lookup Name
                var EntitySchemaName = lookupObjectValues[0].entityType; // Get the Lookup EntityName
                // Call setLookupValue with the retrieved values
                setLookupValue(executionContext, "regardingobjectid", RecordId, RecordName, EntitySchemaName);
            }
        } else {
            console.log("lookupObject value is null")
        }
    }
    function setLookupValue(executionContext, regardingAttribute, RecordId, RecordName, EntitySchemaName) {
        if (regardingAttribute != null) {
            var lookupValue = new Array();
            lookupValue[0] = new Object();
            lookupValue[0].id = RecordId;
            lookupValue[0].name = RecordName;
            lookupValue[0].entityType = EntitySchemaName;
            formContext.getAttribute(regardingAttribute).setValue(lookupValue); // Set lookupValue from array
            console.log("Lookup value set for " + regardingAttribute);
        } else {
            console.log("Lookup value not set");
        }
    }
    // OnLoad function to initiate the process
    function onLoad(executionContext) {
        console.log("onLoad function called.");
        getLookupValue(executionContext);
    }

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 166

#2
ManoVerse Profile Picture

ManoVerse 149 Super User 2026 Season 1

#3
Zhilan Profile Picture

Zhilan 55

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans