Dynamics 365 Get Guid Button - dynamics-crm

Does anyone know of a managed solution to import into Dynamics 365 that adds functionality for a custom button to copy the Guid of any entity to your clipboard?
In a previous environment we used this one
Of course this can't be imported into the newer Dynamics 365.
I know how to parse out the Guid from the URL, but the button to autocopy it to the clipboard was amazing.

The Chrome Extension Level Up has button for Record Id, or you can use the bookmarklet code. Just add the below code to a bookmark in your browser:
//get record id
javascript: (function () { var form = $("iframe").filter(function () { return $(this).css("visibility") == "visible" })[0].contentWindow; window.prompt("Copy to clipboard: Ctrl+C, Enter", form.Xrm.Page.data.entity.getId().slice(1, -1)) })();

Try Level Up for Dynamics 365 Chrome Extension, it provides a great variaty of common JScript actions and shortcuts to help with extensibility, diagnostics and administration
if what you need is to pulish an option to your user to get the GUID of a record and prevent the execution of other JS logic such as display all hidden attributes, then you will have to create a ribbon button and execute JS logic contained in a webresource, to make it compatible with CRM v9 and forward, past the execution context to your function (PrimaryControl) and call the native Xrm function executionContext.getFormContext().data.entity.getId()

Another extremely useful Chrome called Dynamics Power Pane. Use it together with Level Up for Dynamics 365 will be very powerful.

Related

Outlook Add-in that just directs to a website

I want to program a simple Outlook add-in that opens a browser and take the user to a specific site.
I've had a look at using Yeoman, but this add-in opens a task pane where I'm just looking to take that single actions.
Is there a simple way to do this?
EDIT:
I managed to get this done, but I not have the following issue: I have a single button (via Yeoman's generator) that when clicked executes the following:
function action(event) {
const message = {
type: Office.MailboxEnums.ItemNotificationMessageType.InformationalMessage,
message: "Window opened.",
icon: "Icon.80x80",
persistent: true,
};
// Show a notification message
window.open("https://myurl.com");
Office.context.mailbox.item.notificationMessages.replaceAsync("action", message);
// Be sure to indicate when the add-in command function is complete
event.completed();
}
I get the following error in Outlook itself:
We deployed the app using the MS 365 admin center, but I'm not sure if there is something additional that I need to do in this case to run the webserver?
There is an Office.js API that will open a browser window:
Office.ui.openBrowserWindow( -- URL string here -- );
This will cause the computers default browser to open to the specified URL. You could have a button in the task pane whose handlers calls this method. Alternatively, you could have a custom button on the ribbon that calls a FunctionFile that calls this method.
If you want to display any web site to the user as a result of the button click or some action on the pane, try doing window.open('https://yoursite.com'). This should work if the domain is whitelisted in your manifest. For example:
function redirectFunction() {
window.open("https://othersite.com")
//window.location.href = "https://othersite.com";
}

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";
};

How to execute JS Code when Outlook is started with Web Add Ins?

I want to make a async request to my server every time a user of my plugin starts outlook (or at least before they open an email).
I have a web Add In with a function file. This file is called whenever a user press a button for this addin. The function file is only loaded after a button (of my plugin) press.
Try this:
// This function is called when Office.js is ready to start your Add-in
Office.initialize = function ()
{
$(document).ready(function ()
{
//call your function here
This is not possible with WebAddIns as the Outlook Add-Ins Teams said in the comments under the question.
One solution is to create a VSTO AddIn and make the request there.

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