Skip to content

Instantly share code, notes, and snippets.

View AshV's full-sized avatar
🌴
Coding @ Maldives Beaches

Ashish Vishwakarma AshV

🌴
Coding @ Maldives Beaches
View GitHub Profile
public class WF : CodeActivity
{
[RequiredArgument]
[Input("Code")]
public InArgument<string> Code { get; set; }
[Output("Custom Team")]
[ReferenceTarget("team")]
public OutArgument<EntityReference> CustomTeam { get; set; }
<html>
<head>
<title>Speech SDK JavaScript Quickstart</title>
</head>
<body>
<!-- UI code goes here -->
<div id="warning">
<h1 style="font-weight:500;">Speech Recognition Speech SDK not found (microsoft.cognitiveservices.speech.sdk.bundle.js missing).</h1>
</div>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script src="https://www.gstatic.com/firebasejs/6.1.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/6.1.1/firebase-database.js"></script>
<script>
var firebaseConfig = {
@AshV
AshV / JsonNullHandling.cs
Last active February 5, 2019 10:52
Remove null properties while serializing JSON using Newtonsoft.Json
using Newtonsoft.Json;
JsonConvert.SerializeObject(
<your Object to be serialized>,
Newtonsoft.Json.Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}));
@AshV
AshV / email.json
Last active December 24, 2018 10:58
Email with CRM records available or without(directly using email Id) | Microsoft Dynamics 365 Sample
{
"regardingobjectid_contact@odata.bind": "/contacts(<regarding contact record guid>)",
"subject": "Email Subject",
"description": "Email Description",
"email_activity_parties": [
{
"partyid_systemuser@odata.bind": "/systemusers(<from system user record guid>)",
"participationtypemask": 1
},
{
@AshV
AshV / Microsoft-Dynamics-365-Server-2-Server-Authentication-Access-Token.cs
Created December 17, 2018 07:25
Microsoft-Dynamics-365-Server-2-Server-Authentication-Access-Token.cs
/// Required-Namespaces
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using System.Threading.Tasks;
/// Method-to-generate-Access-Token
public static async Task<string> AccessTokenGenerator()
{
string clientId = "Azure AD App Id";
string clientSecret = "Client Secret Generated for App";
string authority = "https://login.microsoftonline.com/< your app tenant guid >";
Xrm.WebApi.retrieveRecord(
"msdyncrm_customerjourney",
"945a02a0-b2db-e811-a967-000d3af29269",
"$select=msdyncrm_workflowdefinition").then(
function (result) {
debugger;
console.log(result);
var workflowdefinition = JSON.parse(result.msdyncrm_workflowdefinition);
// Retrieve nodes related to provided component.
@AshV
AshV / Execute-fetchXML-using-WebAPI-Dynamics-365.html
Created June 25, 2018 21:04
Execute fetchXML with WebAPI in Dynamics 365
<!DOCTYPE html>
<html>
<head>
<title>Execute fetchXML with WebAPI in Dynamics 365 using JavaScript</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/milligram/1.3.0/milligram.min.css" integrity="sha256-Ro/wP8uUi8LR71kwIdilf78atpu8bTEwrK5ZotZo+Zc=" crossorigin="anonymous" />
<style> button { width:100% } </style>
</head>
<body>
<h1>Testing : Execute fetchXML with WebAPI in Dynamics 365 using JavaScript</h1>
<button onclick="GetXHR()" id="GetXHR">Test using GET with XMLHttpRequest</button>
// https://stackoverflow.com/questions/1879395/how-do-i-generate-a-stream-from-a-string
public static Stream GenerateStreamFromString(string s)
{
MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(s);
writer.Flush();
stream.Position = 0;
return stream;
}
@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");