dynamics 365 change default from field in email - dynamics-crm

I'm looking to change the default from user when an email is created. Setting it through a workflow doesn't work, and business rules does not allow to set the default from behavior. Has anyone been able to do this successfully?

I found this answer by stringing together a few different answers. Note: I couldn't find any documentation on official Microsoft Dynamics functionality, so although it worked for me on version 8 of Dynamics 365 (cloud) it could stop working in the future.
I created a javascript file that ran on load. If the form had form state, create, then I would use the following script to change the value:
function _setFromUser() {
var legalQueueID = "00000000-0000-0000-0000-000000000000";
var recordName = "Legal Contracts Queue";
var entityName = "queue";
Xrm.Page.getControl("from").getAttribute().setValue([{ id: legalQueueID, name: recordName, entityType: entityName }]);
}
Hope this helps someone else!

Related

Connections entity - Audit menu missing

We have migrated a CRM 2011 successfully to Dynamics 365, Version 9.
We have determined that the audit history for connections is not present in the UI.
Is it because the connection form is still in CRM 2011 style (out-of-the-box)? If so, where do you find the connection audit history?
Auditing is enabled in CRM, on the connection entity and also some fields are configured for auditing.
I would assume this is expected behavior & working as per design in various CRM versions.
Connection entity Form editor showing left navigation with "Audit History" menu.
Actual Connection form rendering is not showing the left navigation. I remember this was the case with CRM 2011 form also.
If you want to show the "Audit history" explicitly, you can always go for some unsupported solution like discussed here.
Keep an iframe & point the url something like this: (Obviously you have to script to parameterize it)
https://devcrm.crm.dynamics.com/userdefined/areas.aspx?formid=52078acf-77c4-4e18-86b8-ebffcafc0698&inlineEdit=1&navItemName=Audit History&oId={3877A32E-EA20-E911-A952-000D3A34E213}&oType=3234&pagemode=iframe&rof=true&security=852023&tabSet=areaAudit&theme=Outlook15White
Code from the above UG discussion link:
function buildIframeSource() {
var url = window.parent.Xrm.Page.context.getClientUrl();
var recordId = window.parent.Xrm.Page.data.entity.getId().replace("{", "").replace("}", "");
var element = document.getElementById("areaAuditFrame");
element.src = url + "/userdefined/areas.aspx?formid=52078acf-77c4-4e18-86b8-ebffcafc0698&inlineEdit=1&navItemName=Audit%20History&oId=%7b" + recordId + "%7d&oType=10270&pagemode=iframe&rof=true&security=852023&tabSet=areaAudit&theme=Outlook15White";
};

Using MS Teams as Channel: Authentification Dialog (GetTokenDialog class from Microsoft.Bot.Builder.Dialogs) doesn't popup

How can I use the new authentification feature in Bot Builder with MS Teams?
There seems to be an issue with Teams (see Login user with MS Teams bot or https://github.com/Microsoft/BotBuilder/issues/2104), seems if this is not considered in GetTokenDialog?
Is there any chance to get around this?
Just found the reason why it won't work with Teams. In method Microsoft.Bot.Connector.Activity.CreateOAuthReplyAsync(), Parameter asSignInCard has to be set to True for MSTeams, then, the line new CardAction() { Title = buttonLabel, Value = link, Type = ActionTypes.Signin } has to be changed to new CardAction() { Title = buttonLabel, Value = link, Type = ActionTypes.OpenUrl } because MS Teams can obviously not deal with Action type Signin. Hope, the MS developers will fix that method soon.
There are a few things you need to do to get this to work. First you need to create a manifest file for your bot in teams and whitelist token.botframework.com. That is the first problem.
From teams itself in AppStudio you create a Manifest. I had to play around with this a little bit. In AppDetails... Let it generate a new ID. Just hit the button. The URLs really don't matter much for testing. The package name just needs to be unique so something like com.ilonatag.teams.test
In the bots section you plug in your MS AppId and a bot name. This is a the real MSAPPID from your bots MicrosoftAppId" value=" from web.config in your code.
Ok now in "finish->valid domains" I added token.botframework.com and also the URL for my bot just in case. so something like franktest.azurewebsites.net
This part is done but you are not quite done... in your messages controller you need to add this since Teams sends a different verification than the other clients.
if (message.Type == ActivityTypes.Invoke)
{
// Send teams Invoke along to the Dialog stack
if (message.IsTeamsVerificationInvoke())
{
await Conversation.SendAsync(message, () => new Dialogs.RootDialog());
}
}
It took me a bunch of going back and forth with Microsoft to get this sorted out.
This is a known problem using OAuthCard in MS Teams. To solve it, you can change the Button ActionType from signIn to openUrl using this solution on github

CRM: What is the difference between update Plugin and Update in XrmServiceToolkit

Is there any difference between updating an entity using a Plugin vs Updating an entity using XrmServiceToolkit?
var entityA= new XrmServiceToolkit.Soap.BusinessEntity("entA", id);
entityA.attributes["attrA"] = { value: attrValue1, type: "OptionSetValue" };
entityA.attributes["attrB"] = { value: attrValue2, type: "Money" };
XrmServiceToolkit.Soap.Update(entityA);
I know plugin can be used to connect to external databases but for a very basic update, is there any difference?
Thank you!
Operations in plugins are seemless integrated with the business logic of your CRM platform. Plugins are invoked in any scenario, regardless if they are triggered by a webpage (Javascript calls, e.g. using XrmServiceToolkit), workflow, external systems, integration tools or even other plugins.
An update done on your web page by Javascript only works on that form. If you only need it there, it's fine. If you need to cover other scenarios as well, you may have to look for another solution.

MSCRM Addcustom filter

I am using MS CRM 2013 and created a custom filter on ownerid. It works ok but just that it returns both team and user. I just want to have user. If I provide the entityname as below:
Xrm.Page.getControl("ownerid")
.addCustomFilter(thisfetch, "systemuser");
Then it filters on user and returns filtered users and all teams.
How can I fix it?
thisfetch is my filter criteria.
Please help.
Instructing the Lookup dialog to only allow SystemUser is currently not supported.
There are unsupported workarounds but as pointed out in the linked article they can easily break due to changes in the DOM.
plain js
function setToFieldFilter()
{
document.getElementById("to_i").setAttribute("lookuptypenames", "systemuser:8:User");
document.getElementById("to_i").setAttribute("lookuptypes", "8");
}
function onLoad()
{
Xrm.Page.getControl("ownerid").addPreSearch(setToFieldFilter);
}
jquery
$("#to_i").attr("lookuptypenames", "systemuser:8:User");
$("#to_i").attr("lookuptypes", "8");
Sources
CRM 2013 : Change default entity for a Lookup field
Filter PartyList entities Lookup using Jscript in Microsoft Dynamics CRM 2011

Dynamics CRM MessageBox

I have some JavaScript in Dynamics that does some work and needs to prompt the user with a Yes/No question.
I'd like to have the popup themed like the rest of Dynamics. Is there any page I can use with window.ShowModalDialog or some part of the API to provide a standard looking Dynamics message box?
Thanks.
there isn't a built-in feature to prompt the user in Dynamics CRM using javascript, however, you could build one the use the OpenDialog function to prompt it like Dynamics CRM does using one of these JS functions
Xrm.Utility.openDialog //2016
Xrm.Internal.openDialog //2015 - 2013
Hope it helps
No, CRM doesn't have any function like that built in. You'll have to create your own page.
Maybe you can use a managed solution here https://alertjs.codeplex.com/
The latest Javascript API has the following method, its simple and amazing.
var confirmStrings = { text:"This is a confirmation.",cancelButtonLabel:"No", title:"Confirmation Dialog" };
var confirmOptions = { height: 200, width: 450 };
Xrm.Navigation.openConfirmDialog(confirmStrings, confirmOptions).then(
function (success) {
if (success.confirmed)
console.log("Dialog closed using OK button.");
else
console.log("Dialog closed using Cancel button or X.");
});
Maybe you can use "dialogs" and trigger that to open by using a javascript?
You can use the dialog template found in the SDK to create a dialog with CRM 4.0 look and feel:
(SDK Path)\visualstudiotemplates\cs\addonwebpage
Hope that the below code snippet would be helpful
protected void doBatch()
{
if (Box::yesNo("Vent radioactive gas?", DialogButton::No) == DialogButton::Yes)
{
super();
}
}

Resources