Download CRM 365 V9.X Tools using PowerShell

This configuration explains about how to download D365 utility tools step by steps.

Step1 : Create a folder in your particular drive where you want to download the tools.
Step2 : Open the Power Shell Run, in power shell console, move or change the directory folder to particular folder.








Step3 : Copy and paste the below scripts in that folder directory and press enter.



$sourceNugetExe = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$targetNugetExe = ".\nuget.exe"
Remove-Item .\Tools -Force -Recurse -ErrorAction Ignore
Invoke-WebRequest $sourceNugetExe -OutFile $targetNugetExe
Set-Alias nuget $targetNugetExe -Scope Global -Verbose
##
##Download Plugin Registration Tool
##
./nuget install Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool -O .\Tools
md .\Tools\PluginRegistration
$prtFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PluginRegistrationTool.'}
move .\Tools\$prtFolder\tools\*.* .\Tools\PluginRegistration
Remove-Item .\Tools\$prtFolder -Force -Recurse
##
##Download CoreTools
##
./nuget install Microsoft.CrmSdk.CoreTools -O .\Tools
md .\Tools\CoreTools
$coreToolsFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.CoreTools.'}
move .\Tools\$coreToolsFolder\content\bin\coretools\*.* .\Tools\CoreTools
Remove-Item .\Tools\$coreToolsFolder -Force -Recurse
##
##Download Configuration Migration
##
./nuget install Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf -O .\Tools
md .\Tools\ConfigurationMigration
$configMigFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.ConfigurationMigration.Wpf.'}
move .\Tools\$configMigFolder\tools\*.* .\Tools\ConfigurationMigration
Remove-Item .\Tools\$configMigFolder -Force -Recurse
##
##Download Package Deployer
##
./nuget install Microsoft.CrmSdk.XrmTooling.PackageDeployment.WPF -O .\Tools
md .\Tools\PackageDeployment
$pdFolder = Get-ChildItem ./Tools | Where-Object {$_.Name -match 'Microsoft.CrmSdk.XrmTooling.PackageDeployment.Wpf.'}
move .\Tools\$pdFolder\tools\*.* .\Tools\PackageDeployment
Remove-Item .\Tools\$pdFolder -Force -Recurse
##
##Remove NuGet.exe
##
Remove-Item nuget.exe



Step 4 : Once script will be completed then you can see in the folder, new tools folder are created.



GET/SET Value to Different Data Types field in Dynamics 365 using JavaScript

 GET/SET Value to Different Data Types field

Whenever you create function events on Entity's, we pass Execution Context of the form data to the function. We get he form context from Execution Context. Sample Code is as below.

function testFunction(executionContext) {

var formContext = executionContext.getFormContext();

}


Lets check GET/SET for different Data Types, here my prefix of fields schema name is dnlb.

Single Line Text or Multi Line Text

GET

var name = formContext.getAttribute("dnlb_name").getValue(); 

SET

formContext.getAttribute("dnlb_name").setValue("dotNetLittleBoy");


Two Options

GET

var isValid = formContext.getAttribute("dnlb_isvalid").getValue();

SET

formContext.getAttribute("dnlb_isvalid").setValue(true);  


Option Set

GET value

var typecode = formContext.getAttribute("dnlb_typecode").getValue();

GET Text:

var typecodeText = formContext.getAttribute("dnlb_typecode").getText(); 


SET

Set using value

formContext.getAttribute("dnlb_typecode").setValue(99000000);

Set Option set using Text

var text = "TypeA";

var optionSetValues = formContext.getAttribute("dnlb_typecode").getOptions();

for (i = 0; i < optionSetValues.length; i++) {

    if (optionSetValues[i].text == text) {

formContext.getAttribute("dnlb_typecode").setValue(optionSetValues[i].value);

    }


Multi Select Option Set

GET values

var appcodeVal = formContext.getAttribute("dnlb_applicationcode").getValue();

GET Text

var appCodeName = formContext.getAttribute("dnlb_applicationcode").getText();  


SET

Set using value

formContext.getAttribute("dnlb_applicationcode").setValue([990000000,990000001,990000005]);

Set using Text

var commonAppCode=[];

var optionText = ["AppCodeA","AppCodeB","AppCodeC"];

var optionSetValues = formContext.getAttribute("dnlb_applicationcode").getOptions();

for (i = 0; i < optionText.length; i++) {

    for (j = 0; j < optionSetValues.length; j++) {

        if (optionText[i] === optionSetValues[j].text) {

            commonAppCode.push(optionSetValues[j].value);

         formContext.getAttribute("dnlb_applicationcode").setValue(commonAppCode);

        }

    }


Whole Number

GET

var studentAge = formContext.getAttribute("dnlb_studentAge").getValue();

SET

formContext.getAttribute("dnlb_studentAge").setValue(25); 


Decimal Number

GET

var testdn = formContext.getAttribute("dnlb_test").getValue(); 

SET

formContext.getAttribute("dnlb_test").setValue(40.6); 


Floating Point Number

GET

var testfn= formContext.getAttribute("dnlb_testfn").getValue();

SET

formContext.getAttribute("dnlb_testfn").setValue(0.00009); 


Date

GET

var dob = formContext.getAttribute("dnlb_dobdate").getValue();

SET

formContext.getAttribute("dnlb_dobdate").setValue(d); //d value should be in utc format based on date type as Date Only or Date Time both.


Currency

GET

var amount = formContext.getAttribute("dnlb_totalAmount").getValue(); 

SET

formContext.getAttribute("dnlb_totalAmount").setValue(176.98); 


Lookup or Customer

GET

var studentGuid = formContext.getAttribute("dnlb_studentId").getValue()[0].id;  

var studentEntityType = formContext.getAttribute("dnlb_studentId").getValue()[0].entityType;

var studentName = formContext.getAttribute("dnlb_studentId").getValue()[0].name;

SET

var studentLookup = new Array()

studentLookup[0]= new Object();

studentLookup[0].id = "{{RECORD_ID_WHICH_TO_BE_SET}}";  

studentLookup[0].entityType = "dnlb_student";            

studentLookup[0].name = "dotNetLittleBoy";

formContext.getAttribute("dnlb_studentId").setValue(studentLookup); 



Happy Coding !!!


Featured Posts

Download CRM 365 V9.X Tools using PowerShell

This configuration explains about how to download D365 utility tools step by steps. Step1 : Create a folder in your particular drive where y...

Popular Posts

Contact Me

Name

Email *

Message *