Posts

JavaScript/ Jquery Reference for Microsoft Dynamics CRM Portal (formerly AdxStudio)

//Get value of field from current page var  name  =  $( '#new_name' ).val(); //Find the checkbox value $( '#new_arepartsreplaced' ).is( ":checked" ); //Get value of field from parent page var  WorkOrder  =  $( '#msdyn_name' ,  window .parent. document )[ 0 ].value; //Get record id from url of parent page var  WOId  =   window .parent.location.href.substr( window .parent.location.href.indexOf( "?id" )  +   4 ); //Get Picklist value from parent page var  Status  =  $($( '#new_status' ,  window .parent. document )[ 0 ]).find( "option:selected" ).prop( "value" ); //Disable DateTime Field $( "#msdyn_timetopromised_description" ).parent().find( '.form-control' ).prop( 'disabled' ,  true ); $( "#msdyn_timetopromised" ).parent().find( '.input-group-addon' ).hide(); //Disable Lookup $( "#new_workorder" ).prop( 'disabled'...

How to Query Entity in Dynamics CRM Portal - AdxStudio(Using Odata method and Liquid Template Method)

There are bascially 2 ways we can query entity in CRM Customer portal: Method 1: Via Liquid Template Method 2: Via Odata In this blog I am going to show how we can query crm entity using above 2 methods one by one. Mthod 1: Using Liquid Template Follow the below steps for creating code: Step1 : Create a new Web Template where you'll have to add your fetch xml code. [? A Web Template includes the actual coded design on the record itself.  Because of this, the code can be accessed from the UI or even programmatically via SDK or API.] A liquid code contains below tags: Tags – Liquid tags are the programming logic that tells templates what to do. Tags are wrapped in: {% %} characters.   Some tags can take parameters.  Examples: if unless else elsif case and or for cycle tablerow include assign increment. Objects – Liquid objects contain attributes to output dynamic content on the page. For example, the page object contains an attribute called title that ca...

How to import CSV files into DataTable in C#

Below is code the which you can use for converting a csv file into Data Table in C#. This method also handles comma values inside a double quoted value. 1. Provide the file path of your csv file: string sCsvFilePath = @"C:\Downloads\Sample.csv"; 2. Call Custom Method: DataTable  dtTable = ConvertCSVtoDataTable(sFilePath); 3. Copy and Paste below: public   static   DataTable  ConvertCSVtoDataTable( string  sCsvFilePath) {      DataTable  dtTable =  new   DataTable ();      Regex  CSVParser =  new   Regex ( ",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))" );      using  ( StreamReader  sr =  new   StreamReader (sCsvFilePath))     {          string [] headers = sr.ReadLine().Split( ',' );          foreach ...

How to bind Dynamics CRM data to dropdown using JavaScript/ HTML?

Image
In this blog, I 'll show how we can create a dropdown and bind it with value from Entity record values e.g we need to show all On-Demand process inside an entity as a dropdown list. So for this I have used 2 methods: ODATA and WebAPI call.. For Users using older version of CRM can use ODATA method. In this below example I am binding all system view in the dropdown inside an HTML web resource. Copy and paste code as below: 1. ODATA Method: <head>     <script type="text/javascript" src="/_common/ClientGlobalContext.js.aspx"></script> </head> <body style="overflow-wrap: break-word; height: 24px; word-wrap: break-word;">     <select id="viewdropdown" onchange="GetSelectedviewValue(this)" style="height:24px; width:495px; margin-left:16px">         <option selected="" value="Loading...">Loading...</option>     </select>     <script> ...

How to Write a Plugin when a Case is resolved with use Email Template in C#

In this blog, I am going to explain how we can fire a plugin on Resolved Case. Additionally I have added methods which shows how we can use Email Template too. Follwing points is important when working on resolved case plugin: 1. To fire a plugin when an incident is resolved we need to register the plugin in "Close" message for the incident entity. 2. In Input parameters of the context we need to check for IncidentResolution (this entity holds information of case being closed). Put below codes inside your Plugin, In my sample code I am creating an email activity after case gets resolved.         public class IncidentPostCloseHandler : IPlugin         {             public void Execute(IServiceProvider serviceProvider)             {                 try                 {       ...

Validate Input Phone Number in Microsoft Dynamics CRM using JavaScript

Sometime we get requirement to validate a phone number like to check only numeric value allowed with all round bracket and '+' sign etc in the number. So below is a basic JavaScript fucntion which validates a phone number like: (022)6655-7878 or +91-7878787878 or +44-6756-6767-4234 and so on function CheckPhoneNoFormat(context) {     var oField = context.getEventSource().getValue();     if (typeof (oField) != "undefined" && oField != null) {         try {             var telnum = oField;             // Convert into a string and check that we were provided with something             var telnum = telnum + " ";             if (telnum.length == 1) {                 telNumberErrorNo = 1;                 return false    ...

How to get the entity schema name list registered in your Dynamics CRM Organization using C#.

Use the following code for fetching entity list names in your console application:   public static EntityMetadata[] GetEntities(IOrganizationService organizationService)         {             Dictionary attributesData = new Dictionary ();             RetrieveAllEntitiesRequest metaDataRequest = new RetrieveAllEntitiesRequest();             RetrieveAllEntitiesResponse metaDataResponse = new RetrieveAllEntitiesResponse();             metaDataRequest.EntityFilters = EntityFilters.Entity;             // Execute the request.             metaDataResponse = (RetrieveAllEntitiesResponse)organizationService.Execute(metaDataRequest);             var entities = metaDataResponse.EntityMetadata;             return entitie...
go to top image