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

Remove Send from Queue Only - Custom Form

(0) ShareShare
ReportReport
Posted on by 5

Hello,

I am not a developer, just a support specialist who is trying to fix a few things without escalation.

On our default Email form, we currently have an issue where we can't send from a user account (with Dynamics-enabled and Outlook connected) but only from a queue. This was written in by our original developers 5+ years ago and is no longer needed. You can see the popup here:

select_5F00_queue.png

Default Email Form Properties:

8228.FormProperties.png

Here is the JavaScript for new_EmailForm.js:

(function () {
var parentActivityLoaded;
var formContext;

parentActivityLoaded = function (activity) {
var fromAttribute, newValue, queueItem, queueRef;
queueItem = activity.Email_QueueItem.results[0];
queueRef = queueItem.QueueId;
newValue = {
entityType: queueRef.LogicalName,
id: queueRef.Id,
name: queueRef.Name
};
fromAttribute = formContext.getAttribute("from");
return fromAttribute.setValue([newValue]);
};

this.onLoad = function (context) {
formContext = context.getFormContext();

var fromAttribute, parentActivity, parentActivityId;
if (formContext.getAttribute("statuscode").getValue() === 1) {
parentActivity = formContext.getAttribute("parentactivityid").getValue();
if (parentActivity) {
parentActivityId = parentActivity[0].id.replace("{", "").replace("}", "");
return SDK.REST.retrieveRecord(parentActivityId, "Email", null, "Email_QueueItem", parentActivityLoaded, function () {
return Xrm.Utility.alertDialog("Failed to retrieve parent activity");
});
}
}
};

this.onSave = function (context) {
formContext = context.getFormContext();

var eventArgs, fromField;
eventArgs = context.getEventArgs();
fromField = formContext.getAttribute("from").getValue();
if (formContext.ui.getFormType() !== 4) {
if (fromField && fromField[0].entityType !== "queue") {
Xrm.Utility.alertDialog("Can't send email from users, select a queue instead");
return eventArgs.preventDefault();
}
}
};

}).call(this);

What can I change so that we can send as a user again? Let me know if I can provide anything else. Thank you! 

I have the same question (0)
  • meelamri Profile Picture
    13,218 User Group Leader on at

    Hi,

    Can you please share the onSave event handlers ? (Check in Event below Control - your screenshot 2)

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I believe all you need is to deactive or remove reference to "onSave" function from your "new_EmailForm.js" webresource in "OnSave" events.

    In order to access it in "Form Properties", "Events" dropdown choose "OnSave".

  • heidis_egab Profile Picture
    5 on at

    Hi Andrew,

    Perfect, thank you! For now, I just disabled it in Events and did not change the script, just in case we want it functioning again later for some reason. It is working fine now. Again, thanks!

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 202 Super User 2026 Season 1

#2
CU11031447-0 Profile Picture

CU11031447-0 100

#3
NeerajPawar Profile Picture

NeerajPawar 70

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans