Posts

Auto Number Id Generation for Any Entity using Plugin

Image
 In Microsoft dynamics, we have auto generated id for the case, quote and for some other. Like that if u want to generate any auto generate id then follow this post, you can achieve this easily.  Before going this post, you must have idea on shared variables and also crud operation by using plugin. We will discuss detailly. For the auto number generation, we required one backup entity to store the number. and one more entity to generate id.  In My Scenario, I am using opportunity entity for id generation and configuration for the backup entity. I am triggering my plugin on creation of opportunity entity. If any record is created at that time I need to generate id for the each record without duplication. I am creating two plugins for my scenario. Step1: Add the one class library project in visual studio  Step2: Install the nugget packages for the project like crm. sdk  Step: Add the common code to plugin. Follow the below code for the auto generation   using Microsoft.Crm.Sdk.Messages;

create HTML page show all contact related to specific account, add this webresource as a subgrid in the form

Image
  We need to create one html and add the JavaScript and CSS. After Add the webresource to Form. For this fist we need to create hml like below <!DOCTYPE html> <html> <head>     <title>Contact Records</title>     <style>         table, th, td {             border: 1px solid black;             border-collapse:collapse;             border-color:yellow;         }         td{             text-align:center;             color:blue;             background-color:blue;                      }         th{             background-color:red;         }         td{             color:blueviolet;         }     </style> </head> <body>     <table >         <thead>             <tr>                 <th>Column name1</th>                 <th>Column name2</th>                 <th>Column name3</th>                  <th>Column name upto n</th>             </tr>         </thead>      

Get and set using Plugin in MS Crm

 If you want to set up data immediately then go for the JavaScript. if you want to set or get the data on form save then use the plugin. in this post we will discuss about get and setting of data using plugin. Fist we discuss about getting the data. Single and multiple line of text: return type is string . string varname= targetobject.Contains(Schemaname)?(string ) targetobject[Schemaname]:null; Option set: return type is OptionSetvalue for getting the value of the option set OptionSetValue Varname= targetobject.Contains(Schemaname)?(OptionSetValue ) targetobject[Schemaname]:null; Varname.Value for the value reading Two Option Set return type is bool  bool Varname=  targetobject.Contains(Schemaname)?(bool ) targetobject[Schemaname]:null; Whole Number  return type is integer int Varname=  targetobject.Contains(Schemaname)?(int) targetobject[Schemaname]:null; Floating number and Decimal number return type is Dounble doubleVarname=  targetobject.Contains(Schemaname)?(double) targetobject[

Get and Set in MS Crm using JavaScript

  Getting the data from the form using JavaScript in the JavaScript, for every data type common to get the data. there some difference, in Crm we have following type of data types. we will discuss one by one. Single line of text, two option set, whole number, currency, decimal number, date and time, floating number, option set. for all these data types getting data is common. fist we need to create function with name like below for getValue return type is Number and for the getText return type is string  function nameoffunction (executionContext){ // it will get the all the form data var formContext = executionContext .getFormContext(); var variablename=  formContext. getAttribute("Filedschemaname").getValue(); // for getting the text of option set  var variablename=  formContext. getAttribute("Filedschemaname").getText(); } For the data type of lookup and customer we have a small chnage  var lookupId =   formContext. getAttribute ("fieldname").getValue()[