The system correctly creates a Case when an email is received.
However, in our scenario, we have duplicate active Contacts:
Contact A belongs to BU "ABC"
Contact B belongs to BU "XYZ"
Each Contact has a custom flag indicating its BU assignment.
When sending an email to the XYZ BU-specific queue/email, the system still associates Contact A (ABC BU) as the from party on the email activity.
What I've Tried:
Post-Operation Plugin (on Create/Update of Email):
Objective: Update the From field based on the Contact set on the Case (Case is correctly set in Regarding).
Code Snippet:-
but i am getting an error as - Error occurred while processing Case: Cannot update parties unless email is in draft status.
​​​​​​
​​​​​Pre-Operation Plugin (on Create of Email):
Identify and set the correct Contact in the From activity party before the record is created.
Code Snippet:-
Unfortunately, this does not override the default Contact being set by the system. It continues to associate Contact A from the ABC BU.
Additionally-
I also reviewed the official Microsoft documentation for the Email entity here, which mentions the "_emailsender_value" field. This corresponds to the From party when the email status is "Received", but it appears that this field is system-controlled and not directly modifiable once the email is created.
​​​​​​​Any guidance or workaround would be appreciated! Thanks in advance!
Good morning, afternoon, or evening :) depending on your location! Key Observations:
The _emailsender_value field is system-controlled and cannot be modified once the email is created.
The error "Cannot update parties unless email is in draft status" indicates that updates to the "From" field are restricted for emails in a "Received" status.
The ARC rule is defaulting to the first matching contact, which may not align with your BU-specific requirements.
Suggested Workarounds: 1. Modify the ARC Rule Logic:
If possible, adjust the ARC rule to include additional criteria for selecting the correct contact. For example, use the custom BU assignment flag to prioritize contacts from the correct BU.
2. Pre-Operation Plugin Enhancements:
Ensure that your Pre-Operation Plugin logic is executed before the system sets the "From" field. You can achieve this by:
Registering the plugin on the Create message of the Email entity with a Pre-Validation stage.
In the plugin, explicitly set the "From" field using the correct contact reference:
Entity fromParty = new Entity("activityparty");
fromParty["partyid"] = new EntityReference("contact", contact.Id);
entity["from"] = new EntityCollection(new List<Entity> { fromParty });
tracingService.Trace("Updated 'From' field with matched Contact.");
3. Custom Workflow or Power Automate Flow:
Use a custom workflow or Power Automate flow to reassign the "From" party after the email is created. While this won't modify the system-controlled _emailsender_value, it can update related fields or create a new email activity with the correct "From" party.
4. Custom Email Creation Process:
Instead of relying on the ARC rule to create emails, implement a custom process to handle incoming emails. This process can:
Identify the correct contact based on BU-specific criteria.
Create the email activity with the correct "From" party.
Hope this helps some!
Was this reply helpful?YesNo
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.