View ConnectToCrm.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crmClient = new CrmServiceClient(ConfigurationManager.ConnectionStrings["D365"].ConnectionString); | |
if (crmClient.IsReady) | |
{ | |
using (var ctx = new OrganizationServiceContext(crmClient)) | |
{ | |
var result = ctx.CreateQuery<Contact>() | |
.Where(a => a.FirstName == "Jan") | |
.Select(a => new Contact | |
{ |
View ServiceResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ServiceResponse | |
{ | |
public string RecognitionStatus { get; set; } | |
public int Offset { get; set; } | |
public int Duration { get; set; } | |
public Nbest[] NBest { get; set; } | |
} | |
public class Nbest | |
{ |
View ConvertSpeechToTextPlugin.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConvertSpeechToTextPlugin : IPlugin | |
{ | |
public void Execute(IServiceProvider serviceProvider) | |
{ | |
var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); | |
var tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); | |
var organizationServiceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); | |
var orgService = organizationServiceFactory.CreateOrganizationService(null); | |
tracingService.Trace("Plugin started"); |
View ValidationPlugin.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Xrm.Sdk; | |
using Microsoft.Xrm.Sdk.Messages; | |
using Microsoft.Xrm.Sdk.Metadata; | |
namespace Validation.Plugin.CoreLib |
View showLocalizedMessage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showAlertDialog() { | |
var localizedResult = Xrm.Utility.getResourceString("odx_/resx/messages", "qualifyingLeadMessage"); | |
var alertStrings = { | |
confirmButtonLabel: "OK", | |
text: localizedResult | |
}; | |
var alertOptions = { | |
height: 200, | |
width: 400 |
View open_webresource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openWebResource() { | |
var windowOptions = { | |
openInNewWindow: false, | |
height: 400, | |
width: 400 | |
}; | |
Xrm.Navigation.openWebResource("new_mywebresource.html", windowOptions, "someAdditionalParameter"); | |
} |
View open_url.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openUrl() { | |
var url = "http://google.com"; | |
var openUrlOptions = { | |
height: 400, | |
width: 800 | |
}; | |
Xrm.Navigation.openUrl(url, openUrlOptions); | |
} |
View open_form.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openEntityForm() { | |
var entityFormOptions = { | |
entityName: "account", | |
useQuickCreateForm: false | |
}; | |
var formParameters = { | |
name: "Sample Account", | |
description: "This is example of how you can prepopulate the fields on opened entity" | |
}; |
View open_file.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function openFile() { | |
var file = { | |
fileContent: "bXkgc2VjcmV0IGNvbnRlbnQ=", //Contents of the file. | |
fileName: "example.txt", //Name of the file. | |
fileSize: 24, //Size of the file in KB. | |
mimeType: "text/plain" //MIME type of the file. | |
} | |
Xrm.Navigation.openFile(file, 2); | |
} |
View show_error_dialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function showErrorDialog() { | |
var errorOptions = { | |
details: "This is simply the message that can be downloaded by clickick 'Download log file'", | |
errorCode: 666, //this is error code if you want to show some specific one. If you specify invalid code or none, the default error code wouldbe displayed | |
message: "Message show in the dialog" | |
}; | |
Xrm.Navigation.openErrorDialog(errorOptions).then( | |
success => { |
NewerOlder