Posts

Showing posts from December, 2015

How to Call Custom Web service through JavaScript in Asp.Net.

In this post I am going to Show How we can create a web Service and consume it through javascript i.e Calling a web service in Javascript using Asp.Net/ Calling a WebService in Javascript in Microsoft Dynamics CRM. 1. First of all create a web service by going to Visual Studio-> Select New Website-> WebService -> Service.cs 2. Create a new WebMethod or update your HelloWorld WebMethod as below, I have create a sample Web service which accepts 2 parameters and based on that returns a string value: string[,] stocks = { { "Infy", "Infosys", "122.35" }, { "DSS", "Direction", "98.22" } }; [WebMethod] public string getName(string symbol, string Name) { for (int i = 0; i < stocks.GetLength(0); i++) { if (String.Compare(symbol, stocks[i, 0], true) == 0 || String.Compare(Name, stocks[i + 1, 0], true) == 0) { return ("Stock Value of &quo…

How to Get the records when Lead is Qualified in Microsoft Dynamics CRM using Plugin C#

Image
In this blog I am going to explain and show an example when a lead is Qualified then how we can get the new records or we can update records in newly created record when Lead status is Qualified.

1. Register your created plugin in "QualifyLead" message and On Post-Operation to get the records when lead is Qualified. ::



2. Here in this example I am setting up a Lookup field value in newly created Opportunity when lead is Qualified. Just type the code as below and register as said in Step 1.

      IOrganizationService serviceDefaultUser = null;
            IPluginExecutionContext contextPlugin = GetContext(serviceProvider);
            serviceDefaultUser = GetServiceObject(serviceProvider, contextPlugin);

            // Get the qualified lead.
            EntityReference leadid = (EntityReference)context.InputParameters["LeadId"];
            Entity lead = orgSrvService.Retrieve("lead", leadid.Id, new ColumnSet(true));

            EntityReference erLookUpF…

How to Merge two excel sheets into one in c#.

Image
In this blog I am going to explain how we could merge two different excel sheets into one using C# programing. For this demo I have taken a console application, check the below steps and use the code as it is.



1. First of all create two different Excel files and put some data into those sheets, remember to RENAME the worksheet name because same name will create Error while processing Merging process. eg., Plz check the encircled area in below images::


2. Add References. At minimum, you will need below referances.

static void Main(string[] args)
{
  MergeExcelNew();
}    

private static void MergeExcelNew()
{
    Application app = new Microsoft.Office.Interop.Excel.Application();
    Workbook bookDest = null;
    Worksheet sheetDest = null;
    Workbook bookSource = null;
    Worksheet sheetSource = null;
    string sTempPath = @"D:\Temp\Sheet1_Folder\Sheet1.xlsx";
    string sFinalPath = @"D:\Temp\Sheet2_Folder\Sheet2.xlsx";

    try
    {
        //OpenBook
     …
go to top image