Skip to content

Instantly share code, notes, and snippets.

@melamriD365
melamriD365 / migrate-configuration-data.yml
Created January 6, 2025 00:30
Automatic Configuration Data Deployment in Dataverse Solutions Using GitHub Actions
name: migrate-configuration-data
on:
workflow_dispatch:
inputs:
sourceEnvironmentUrl:
description: "Source environment URL (e.g., https://source.crm.dynamics.com)"
required: true
targetEnvironmentUrl:
description: "Target environment URL (e.g., https://target.crm.dynamics.com)"
@melamriD365
melamriD365 / ORConditionBetweenRelationships.xml
Created January 2, 2025 23:03
OR Conditions Between Different Relationships in Dataverse
<fetch distinct="true">
<entity name="meaf_project">
<!-- Attributes to retrieve -->
<attribute name="meaf_projectid" />
<attribute name="meaf_name" />
<attribute name="meaf_description" />
<!-- Link-entities for User Roles: Project Manager, Contributor, Reviewer -->
<link-entity name="systemuser" from="systemuserid" to="meaf_managerid" alias="manager" link-type="outer" />
<link-entity name="systemuser" from="systemuserid" to="meaf_contributorid" alias="contributor" link-type="outer" />
<link-entity name="systemuser" from="systemuserid" to="meaf_reviewerid" alias="reviewer" link-type="outer" />
@melamriD365
melamriD365 / run-pfx-script.yml
Created January 1, 2025 16:46
Github Action to run a PowerFx Script by using PAC CLI
name: run-pfx-script
on:
workflow_dispatch:
inputs:
EnvironmentUrl:
description: "Environment URL (e.g., https://environment.crm.dynamics.com)"
required: true
jobs:
@melamriD365
melamriD365 / AccountForm.js
Created September 20, 2022 21:52
Sample usage of the OnOutputChange event for model-driven app forms Client API
var MEA = window.MEA || {};
var accountForm = MEA.accountForm || {};
(function () {
this.OnLoad = function (onLoadContext) {
var formContext = onLoadContext.getFormContext();
var phoneControl = formContext.getControl('telephone1');
phoneControl.addOnOutputChange(this.OnOutputChangeHandler);
};
this.OnOutputChangeHandler = function (OnOutputChangeContext) {
@melamriD365
melamriD365 / AccountForm.js
Created September 12, 2022 14:06
Deep link a Model Driven App to open on a specific tab (form tab)
var MEA = window.MEA || {};
var accountForm = MEA.accountForm || {};
(function () {
this.OnLoad = function (onLoadContext) {
var formContext = onLoadContext.getFormContext();
var extraParameters = Xrm.Utility.getGlobalContext().getQueryStringParameters();
var tabName = extraParameters["tab_name"];
if(tabName != undefined){
var defaultTabObj = formContext.ui.tabs.get(tabName);
@melamriD365
melamriD365 / Plg_ExecuteFetchXml.cs
Created March 16, 2022 19:01
Power Automate - Dataverse] How to execute a fetchXml query that includes options not supported by the List rows connector?
// <copyright file="Plg_ExecuteFetchXml.cs" company="">
// Copyright (c) 2022 All Rights Reserved
// </copyright>
// <author></author>
// <date>3/14/2022 2:38:36 PM</date>
// <summary>Implements the Plg_ExecuteFetchXml Plugin.</summary>
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
@melamriD365
melamriD365 / AccountForm.js
Created March 1, 2022 20:32
OnChange events always called twice after new record creation (Good Practice)
var MEA = window.MEA || {};
var accountForm = MEA.accountForm || {};
(function () {
this.OnLoad = function (onLoadContext) {
console.log("onLoad ....");
var eventArgs = onLoadContext.getEventArgs();
var formContext = onLoadContext.getFormContext();
if (eventArgs.getDataLoadState() == 1) {
formContext.getAttribute('telephone1').addOnChange(this.OnChangeHandler);
@melamriD365
melamriD365 / AccountForm.js
Last active March 2, 2022 11:43
OnChange events always called twice after new record creation (Bad Practice)
var MEA = window.MEA || {};
var accountForm = MEA.accountForm || {};
(function () {
this.OnLoad = function (onLoadContext) {
console.log("onLoad ....");
var formContext = onLoadContext.getFormContext();
formContext.getAttribute('telephone1').addOnChange(this.OnChangeHandler);
};
this.OnChangeHandler = function (onChangeContext) {
@melamriD365
melamriD365 / OptimisticConcurrencyForm.js
Created January 9, 2022 13:40
Optimistic Concurrency in Model-Driven Apps Forms.
//Optimistic Concurrency in Model-Driven Apps Forms
var MEA = window.MEA || {};
var OptimisticConcurrencyForm = MEA.OptimisticConcurrencyForm || {};
(function () {
var versionNumber = null;
var entityReference = null;
this.OnLoad = async function (executionContext) {
var eventArgs = executionContext.getEventArgs();
if (eventArgs.getDataLoadState() == 1) {
@melamriD365
melamriD365 / CancelMergeForChilds_PostOperation.cs
Last active January 1, 2022 15:23
Dynamics 365 CRM [Dataverse] - How to cancel of the merge cascade for a given relationship ? (Post-Operation Plugin)
using System;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Metadata;
using Microsoft.Xrm.Sdk.Query;
namespace MergePoc.Plugins
{