Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Remove Send from Queue Only - Custom Form

$
0
0

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:

Default Email Form Properties:

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! 


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images