Posts

ADF - (Part3) Integrate Data From CRM to External system Using Stored procedure

Image
 In this blog we will see how we can use stored procedure to transform our data in ADF.  For better understanding you can check my previous blog for better understanding. When we integrate CRM data to external system SQL, then for  Option-Set fields present in CRM, we get Option-Set values and not Text value. eg. we have Credit Hold option set field in CRM and after integration we are getting option set value. To solve this problem we will create OptionSetMetaData table in SQL which will store details about option-set fields SQL query to create OptionSetMetaData table CREATE TABLE [dbo].[OptionSetMetadata]( [ID] [uniqueidentifier] NULL, [EntityName] [varchar](50) NULL, [OptionSetFieldName] [varchar](50) NULL, [OptionSetText] [varchar](50) NULL, [OptionSetValue] [int] NULL ) //To Insert Records in sql Table Insert Into OptionSetMetadata Values (NEWID(), 'account', 'Credit Hold', 'Yes', 1) Insert Into OptionSetMetadata Values (NEWID(), 'account...

ADF - (Part 2) Integrate Data From CRM to External system

Image
 In this blog we will integrate data from Microsoft Dynamic CRM to External system's SQL databse. we are going to integrate Account and Contact tables from CRM to external system Before starting with this, you should have following things :  1. Microsoft Dynamics CRM Environment 2. Microsoft SQL Server Management Studio Software(SSMS) 3. Azure Portal account First connect to your SQL server in SSMS and create Account and Contact Table. You can use following query to create table CREATE TABLE Account( [AccountId] [uniqueidentifier] NULL, [AccountName] [varchar](200) NULL, [CreditHold] [int] NULL ) CREATE TABLE Contact( [ContactId] [uniqueidentifier] NULL, [name] [varchar](200) NULL, [MobileNumber] [varchar](50) NULL, [FirstName] [varchar](200) NULL, [LastName] [varchar](200) NULL, [AccountID] [uniqueidentifier] NULL, [AccountName] [varchar](200) NULL ) After creating tables, Navigate to Azure Data factory in azure portal, and Create Dataset for your source and de...

ADF - (Part 1) Create Resource Group and Azure SQL DB

Image
Resource Group in Azure is container which will hold your related Azure service or resources.  eg. If you want to create SQL server in azure portal then you can create SQL server and link that SQL server to particular resource group. You can check out below video for creating Resource group and Azure SQL DB.

Perform logic on change of DateTime field

 Writing business logic on change of DateTime field in CRM portal using jQuery is different than normal on change function. eg. If we want to check whether entered date is in past or not then we will use following syntax :  In our case Start Date is the field where we are adding validation. Schema name for start date is new_startdate var dpcontrol = $("#new_startdate_datepicker_description").closest("div.control"); $(dpcontrol).on("dp.change", function (e) { var dateVal = $("#new_startdate").val(); if (dateVal != null) { var newDate = new Date(dateVal), now = new Date(); newDate.setHours(0,0,0,0); now.setHours(0,0,0,0); if (newDate

jQuery Basic Syntax

 In Microsoft D365, jQuery is mostly used in different CRM portal for development purpose. Providing basic syntax required to Get/Set field value in jQuery :  1. TextField :  var firstname = $("#firstname").val();  //get var lastname = $("#lastname").val("Tendulkar");  //set  2. OptionSet :  var type = $("#typecode").val(); //get var type = $("#typecode").val(16350000);  //set (enter code of optionset field) 3. Lookup :  //Get Lookup Value var lookupGUID = $(“#new_accountid”).val(); var lookupValue = $(“#new_ accountid_name”).val(); var entityName= $(“#new_accountid_entityname”).val(); //set Lookup Value $(“#new_accountid”).val(lookupId); $(“#new_accountid_name”).val(lookupName); $(“# new_accountid_entityname”).val(EntitySchemaName); 4. CheckBox :  //Get Checkbox value var isChecked = $(“#{field_name}”).is(“:checked”); if (isChecked == true) { alert(“Checked!”); } else if (isChecked == false) { alert(“Unchecke...

Trigger Workflow Using JavaScript

 In Microsoft Dynamics 365, we can trigger the workflow based on OOB condition(eg. record is created or on change of field, etc). If we want to trigger the workflow on specific condition which is not present as a OOB then we can use JavaScript to trigger the workflow. You can follow following code for executing workflow using JavaScript: ExecuteWorkflowUsingJS: function(executionContext) { var formContext = executionContext.getFormContext(); var ExecuteCustomWorkflowRequest = function(entityID, WorkflowID) { this.EntityId = { "guid": entityID }; this.entity = { id: WorkflowID, entityType: "workflow" }; this.getMetadata = function() { return { boundParameter: "entity", parameterTypes: { "entity": { "typeName": "Microsoft.Dynamics.CRM.workflow", ...

Web API for Create, Update, Delete record

  1. Create Web API Request :  Syntax:  Xrm.WebApi.createRecord(entityLogicalName, data).then(successCallback, errorCallback); //json object var entity = {}; entity.address1_country = "India"; entity["areaid@odata.bind"] = "/areas(0b4ecbb5-e574-eb11-a812-0022481a9090)"; //lookup field Xrm.WebApi.online.createRecord("account", entity).then( function success(result) { var newEntityId = result.id; }, function(error) { Xrm.Utility.alertDialog(error.message); } ); 2. Update Web API Request :  syntax :  Xrm.WebApi.updateRecord(entityLogicalName, id, data).then(successCallback, errorCallback); //json object var entity = {}; entity["areaid@odata.bind"] = "/areas(0b4ecbb5-e574-eb11-a812-0022481a9090)"; //lookup field entity.address2_country = "India"; Xrm.WebApi.online.updateRecord("account", "0b4ebjb5-e574-eb11-a812-0022481a9090", entity).then( function success(re...