Place a key word to search

Sunday, August 19, 2018

Plugin Storage options

There are  3 storage options are: Database, Disk and GAC. The main differences between these  are: 
·         Database: The assembly dll is stored in the database, rather than the file system.   The major advantages are that the assembly need only be deployed once if you have multiple CRM servers, and that no additional action is required to restore / redeploy the assembly either during disaster recovery, or if redeploying to an alternate server. This is the preferred option in a production environment
·         Disk: The assembly dll is placed in the \server\bin\assembly directory on each server. You have to ensure the dll is placed in the correct place on all CRM servers, so the deployment overhead is a little greater. I normally use this option in development environments as you can redeploy newer versions solely by file transfer, rather than reregistering. Also, if debugging, the assembly .pdb file needs to be placed in the same location; with this option it's easy to ensure the dll and pdb are from the same build
·         GAC: The assembly is placed in the Global Assembly Cache on each CRM server, and again you will have to do this. The GAC does allow multiple versions of an assembly, but CRM doesn't, so you don't really gain anything by using the GAC.

There is one further consideration. If your plugin assembly has other dependent assemblies, then you can place this dependent assembly in the GAC whichever of the above options you take. However, if you use the Disk option, then the dependent assemblies can also be deployed into the \server\bin\assembly directory

Wednesday, August 15, 2018

Wednesday, August 1, 2018

How to send a mail on create of record stating that the record is created..

Hi Developers,

Here comes with a new scenario on sending a mail on create of record stating that the record is created.For example I'm  taking an example of on creation of contact mail should send by stating the record is created.the code snippet is as follows:


Explanation : As per sending mail we need to have a From address,To address,Subject ,Body
so first we need to get the from and to address and the we need to crete them accordingly with activity party then by using the system entity email we can send the mail to created record.
please make a note that the post operation used in plugin registration tool.
Hope you understood.

 As per the example
From - User
To - contact record





using System;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Discovery;
using Microsoft.Xrm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Client;
using Microsoft.Crm.Sdk.Messages;

namespace Sendemail
{
    /// <summary>
    /// Base class for all plug-in classes.
    /// </summary> 
    public class PluginBase : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new InvalidPluginExecutionException("serviceProvider");
            }

            IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory servicefactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = (IOrganizationService)servicefactory.CreateOrganizationService(context.UserId);
            ITracingService tracing = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
            if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {
                Entity entity = (Entity)context.InputParameters["Target"];
                if(entity.LogicalName == "contact")
                {
                    tracing.Trace("1");
                 

                    Guid contactid = context.PrimaryEntityId; // Current record
                    tracing.Trace(contactid.ToString());
                     Guid userid = context.UserId;//(Guid)contactrecord.Attributes["userid"];//from current record retrive the owner the name and id
                    tracing.Trace("userid ");                 
                    //#To Details and from details
                        // Create 'From' activity party for the email
                    Entity fromParty = new Entity("activityparty");
                    fromParty["partyid"] = new EntityReference("systemuser", userid);
                    tracing.Trace(fromParty["partyid"].ToString());
                    // Create 'To' activity party for the email
                    Entity toParty = new Entity("activityparty");
                    toParty["partyid"] = new EntityReference("contact", contactid);
                    tracing.Trace(toParty["partyid"].ToString());

                    //#Sending Mail
                    Entity Email = new Entity("email");
                    Email.Attributes["from"] = new Entity[] { fromParty };
                    tracing.Trace("from");
                    Email.Attributes["to"] = new Entity[] { toParty };
                    tracing.Trace("to");
                    Email.Attributes["subject"] = "New Opportunity Requirements";
                    tracing.Trace("subject");
                    Email.Attributes["description"] = "Hi contact is created";
                    tracing.Trace("description");
                      Guid EmailId = service.Create(Email);
                    tracing.Trace("created");
                 
                    SendEmailRequest req = new SendEmailRequest();
                    req.EmailId = EmailId;
                    req.IssueSend = true;
                    req.TrackingToken = "";
                    SendEmailResponse res = (SendEmailResponse)service.Execute(req);



                }
            }
         
        }
    }
}
             




Thursday, July 26, 2018

Different Versions of the CRM

Hi Developers here comes the different version and the code names for CRM Dynamics.

CRM
Version
Release Date
Code Name
Microsoft CRM 1.0
1.0
01-Jan-03
-           - - - - -
Microsoft CRM 1.2
1.2
08-Dec-03
-           - - - - -
Microsoft Dynamics CRM 3.0
3.0
05-Dec-05
-           - - - - -
Microsoft Dynamics CRM 4.0
4.0
01-Dec-07
Titan
Microsoft Dynamics CRM 2011
2011(5.0)
Beta in February 2010,February 2011
Polaris
Dynamics CRM 2013 
2013(6.0)
Beta in 28th of July 2013,November 2013
Orion(6.0) , Leo(6.1)
Dynamics CRM 2015
2015(7.0)
 September 2014
Vega(7.0) Carina(7.1)
Microsoft Dynamics CRM 2016
2016( 8.0, 8.1,8.2)
30-Nov-15
Ara , Naos , Centaurus
Dynamics 365
9.0
01-Oct-17
Potassium , Calcium

Tuesday, July 24, 2018

How to Create and update the records automatically

Here's come a new scenario like to create the automated records and to perform different activities on them. Usually we have the some fixed source type activities in creation of automatic creation and updation of the records. There are 7 source types on which we can perform.They are as follows
  1. Phone Call
  2. Email
  3. Appointment
  4. Service Activity
  5. Task
  6. Social Activity
  7. Custom Activities
we will have different rules on different source types to perform the automatic actions on records.



Thursday, July 19, 2018

How to Set the look up value by default?

 function loopupvalue()
    {  var lookupValue = new Array();
        lookupValue[0] = new Object();
        lookupValue[0].id = "475B158C-541C-E511-80D3-3863BB347BA8"; //Guid of the A. Datum//
        lookupValue[0].name = "A. Datum";
        lookupValue[0].entityType = "account";
        Xrm.Page.getAttribute("parentcustomerid").setValue(lookupValue);
           
   }

A simple way for the bulk update in CRM Dynamics

There are many ways for bulk update a simple and easy way is as follows.
for example Take entity contacts 
1)Open main form page

2)Select the records which you want to update

3)Update the fields with new data

4)Click on Change


Wednesday, July 18, 2018

what is the difference between custom workflow and system workflow?

So many developers say's many differences with my knowledge i'm sharing few oh the differences which are as follows:

System Workflow :
--> It is out of box feature(OOB) which follows the predefined steps for development.

Custom Workflow :
-->It is the code based file which helps us to implement which is not possible from OOB feature of the system workflow.This code base file should be a DLL(Dynamic-link library) file which should be called from the out of the box workflow designer.
-->From custom workflow we can have the operations such as CRUD,Associate,Disassociate,Execute.where we can develop according to requirement 

Question: How to lock a field if a another  field contains data?

Answer : For example we have a lookup field as parentcustomerid and a country name as another field.so if the parentcustomerid has data then the field should be lock if the parentcustomerid does not have the data then it should get unlock.Here comes the code

function lockfield()
    {
        var field = Xrm.Page.getAttribute("parentcustomerid").getValue();

        if (field != null) {

            Xrm.Page.getControl("sample_countryname").setDisabled(true);
        }
        else
        {
            Xrm.Page.getControl("sample_countryname").setDisabled(false);
        }

    }
Question.How to set option set value by default.

Ans. For example we have the employee filed as option set and in that we the values as
1)Contract
2)Temporary

so by default we need to fill the field as Contract so for this we have couple of ways by using
javascript we can write the code as follows :

function countrycode()
    {
        var country = Xrm.Page.data.entity.attributes.get("sample_countryname");
        country.setValue("727000000");// here the 727000000 will be the option set value while we creating the option set we will have this.

    }

Refer this for further:
How to update the CRM with the data of Excel sheet  by using oob features of CRM (Import, Workflows etc.)?


  • You can use the AdvancedFiend feature to select records of interest.
  • Query the expression and run the results.
  • Export them via the Export feature to Excel (enabling the option "Make this data available for re-importing by including required column headings").
  • Update cells in the Excel sheet.
  • Import that sheet once again with the Import feature of Dynamics CRM.