Skip to content

Instantly share code, notes, and snippets.

View donschia's full-sized avatar
💭
Buidling PCF Controls

Don Schiavone donschia

💭
Buidling PCF Controls
View GitHub Profile
@NickPl
NickPl / xrmutil.js
Last active December 10, 2018 19:10
Utility Javascript class for Dynamics CRM 2016
/* jshint unused: false */
/* globals Xrm */
var XrmUtil = (function () {
// Private / Global var
var odataEndPoint = Xrm.Page.context.getClientUrl() + '/api/data/v8.2/';
// Private / Global function
var ErrorHandler = function (e, origin) {
try {
@paulclarkaranz
paulclarkaranz / Dynamics CRM Link To Record.user.js
Last active January 30, 2019 04:36
Install in Tampermonkey
@alirobe
alirobe / reduceCrmv9Spacing.js
Last active February 25, 2020 09:18
Reduce Dynamics 365 v9 Field Spacing
if(!window.parent.document.querySelector('style#v9removepadding')) {
var style = window.parent.document.createElement('style');
style.id = "v9removepadding";
style.innerText = ".acwallEmailView .emailexpandedaccordion { margin:0; width:100% } TABLE.ms-crm-FormSection td { padding: 4px 1px 1px 16px !important; min-height: 26px; }";
window.parent.document.body.appendChild(style);
}
@NickPl
NickPl / Plugin.cs
Last active December 10, 2018 19:21
Blog XrmMtl - Essential Plugin base class
namespace Xrm.Plugins.Sandbox
{
using Microsoft.Xrm.Sdk;
using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.ServiceModel;
using System.ComponentModel.Design;
@AshV
AshV / SetLookupViewByName.js
Last active December 10, 2018 19:10
Set Lookup View dynamically with JavaScript [ Dynamics CRM / 365 ]
// https://www.ashishvishwakarma.com/set-lookup-view-with-javascript-dynamics-crm-365/
function formOnLoad() {
setLookupViewByName("parentaccountid", "Customers", true);
}
function setLookupViewByName(fieldName, viewName, asynchronous) {
var req = new XMLHttpRequest();
req.open("GET", Xrm.Page.context.getClientUrl() + "/api/data/v8.2/savedqueries?$select=savedqueryid&$filter=name eq '" + viewName + "'", asynchronous);
req.setRequestHeader("OData-MaxVersion", "4.0");
@mdearing06
mdearing06 / compareentities.cs
Last active December 10, 2018 19:27
Compare Entities
void Main()
{
string prefix = "new";
var sourceConnectionString = $@"Url=https://SOURCE.crm.dynamics.com;AuthType=Office365;UserName=USERNAME;Password=PASSWORD;RequireNewInstance=true;";
var targetConnectionString = $@"Url=https://TARGET.crm.dynamics.com;AuthType=Office365;UserName=USERNAME;Password=PASSWORD;RequireNewInstance=true;";
var sourceCrmSvcClient = new CrmServiceClient(sourceConnectionString);
var targetCrmSvcClient = new CrmServiceClient(targetConnectionString);
@ace-racer
ace-racer / Common.cs
Created April 16, 2017 05:39
Code to update web resource colors on update of theme color in Dynamics 365
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using System.Collections.Generic;
namespace Contoso.CrmPlugins
{
public static class Common
{
/// <summary>
/// Retrieves the entity by unique values.
@Skytim
Skytim / DynamicsCRMEmailEditor.html
Created January 18, 2017 04:17
可以透過該Import以下Code修改CRM上的編輯器
<html>
<head>
<title></title>
<!--要注意這邊於Dynamics CRM 引用的問題-->
<script src="//cdn.ckeditor.com/4.4.7/standard/ckeditor.js"></script>
<script src="https://sigmueclab.crm5.dynamics.com/_static/_common/scripts/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
namespace nicknow.Logging
{
static class NonSandboxedExceptionLogging
{
///From the example at http://stackoverflow.com/a/12827271/394978
/// <summary>
/// This utility method can be used for retrieving extra details from exception objects. Cannot be used in code running in the Dynamics CRM Sandbox
/// </summary>
/// <param name="e">Exception.</param>
/// <param name="indent">Optional parameter. String used for text indent.</param>
@OlivierRoecker
OlivierRoecker / js
Created September 12, 2015 09:05
Dynamics CRM JavaScript : Transform Html string to Plain Text
function fct_GetPlainTextFromHtml(htmlString) {
string htmlTagPattern = "<.*?>";
var regexCss = new Regex("(\\<script(.+?)\\</script\\>)|(\\<style(.+?)\\</style\\>)", RegexOptions.Singleline | RegexOptions.IgnoreCase);
htmlString = regexCss.Replace(htmlString, string.Empty);
htmlString = Regex.Replace(htmlString, htmlTagPattern, string.Empty);
htmlString = Regex.Replace(htmlString, @"^\s+$[\r\n]*", "", RegexOptions.Multiline);
htmlString = htmlString.Replace("&nbsp;", string.Empty);
return htmlString ;
}