Information on Microsoft Dynamics CRM 2011 (CRM 5.0)


Hi,

Check out this wonderful post

http://www.crmdynamics.net/microsoft-crm-product-information-pricing-faq/

Bye..

Good resources for understanding GridView


Check out these wonderful articles on GridView

http://www.codersource.net/AspNet/ASPNet20/GridviewcontrolinASPNet20.aspx http://www.codersource.net/AspNet/ASPNet20/Aspnet20GridViewcontrolindepth.aspx

http://msdn.microsoft.com/en-us/library/bb288031.aspx

And the best one,  a cook book on GridView

http://highoncoding.com/Categories/7_GridView_Control.aspx

Bye.

Using CRM_URL Report Parameter


Hi,

Just posting a very simple example on how to use the CRM_URL report parameter for drill down.

Create a new report, create a new dataset pointing to ORG_MSCRM database and add the following query string

select opportunityid,name from filteredopportunity.

Add a hidden report parameter named CRM_URL to the report.

Add table to report layout.

g1

Right click the Opportunity ID text field, select Properties, Go to Navigation tab, select Jump to URL

g2

Put the following value over there

= Parameters!CRM_URL.Value
& "?ID={"&Fields!Opportunityid.Value.ToString()&"}&OTC=3"

i.e.

= Parameters!CRM_URL.Value & "?ID={"& GUID &"}&OTC=otc"
or
better use LogicalName parameter instead of OTC as OTC code might we change when we import it to
some other organization.

=Parameters!CRM_URL.Value & "?ID={"&Fields!guidFieldName.Value.ToString()&"}&LogicalName=entitySchemaName"

Upload the report in CRM and run it.

The value for CRM_URL would be filled by CRM.

CRM_URL would have the following value passed to it from CRM

http://servername:%5BPort%5D/orgname/CRMReports/viewer/drillopen.aspx

Clicking on Opportunity ID value would take us to the actual record within CRM.

g3

Bye…

Understanding Constructors (C#)


What is constructor?

Constructor is a special type of function member of a class. It is used to initialize the instance variables of the object.

Person myPerson=new Person();

Here the new operator is used to allocate the memory needed to store the data of the object.

Now suppose this is how we have defined our Person class.

  public class Person
        {
            public string FirstName { get; set; }
            public string LastName { get; set; }
        }  
   

( here we have used Automatic Properties feature of C# 3.0 to declare our properties FirstName and LastName)

Here in our class we haven’t defined a constructor but we are still able to create instance variables of the Person Object using following line of code

Person p = new Person();
 

The reason it is possible is because we don’t have to explicitly declare constructor for a class, C# automatically provides a default parameterless constructor for that class. The default constructor will initialize any fields of the class to their zero-equivalent values.

We can also write our own constructors, the things to remember are

  • They don’t have a return type.
  • Their name should be same as the name of the class.
  • Should contain a parameter list, which could be left empty.

Now the question is why would we be writing our own constructors?

Well the reason is because constructors can be used to pass initial values for an object’s fields at the time when an object is being instantiated.

For our above Person class

instead of the following code 

    Person p = new Person();
    p.FirstName = "Nishant";
    p.LastName = "Rana";

 

we can do the same in single line of code

Person p = new Person("Nishant", "Rana");
 

The constructor would be defined in the following manner

 public Person(string fname, string lname)
          {
              FirstName = fname;
              LastName = lname;
          }

One thing we have to remember is that if we are defining our own Parameterized constructor the default constructor would be eliminated.

We won’t be able to create person class object using default constructor.

i.e. Person p=new Person(); // it won’t compile.

In this case then we need to explicitly write a default constructor.

public Person()
        { 

        }

bye..

Understanding permissions in Microsoft Dynamics CRM


Hi,

Found this wonderful article on how to set the permissions within Microsoft Dynamics CRM

http://www.orbitone.com/en/blog/archive/2009/10/06/minimum-dynamics-crm-permissions.aspx

Bye..

Sample code for Inserting a lead record from a .NET application : Oracle CRM On Demand


First download the wsdl file for the lead record from Oracle CRM On Demand web application.

Add web references to it within a .NET windows application.

Use the following code for inserting the lead record.

We need to specify value for all the required field for the record to get inserted.

        String loginUrlString = "https://secure-ausomxapa.crmondemand.com/Services/Integration?command=login";
        String logoffUrlString ="https://secure-ausomxapa.crmondemand.com/Services/Integration?command=logoff";
        String siebelUserName = "username/password";
        String siebelPassword ="password";
        String opportunityUrl = "https://secure-ausomxapa.crmondemand.com/Services/Integration;jsessionid=";
        String sessionID = "";
      
        Private void Form1_Load(Object sender, EventArgs e)
        {            
            // Get the session from the helper Class ManageSession
             sessionID = ManageSession.Login(loginUrlString, siebelUserName, siebelPassword);

            //Create the New lead record instandce And Set its url With proper session id
             Lead myLead = New Lead();
             myLead.Url = "https://secure-ausomxapa.crmondemand.com/Services/Integration;jsessionid=" + sessionID;

            // create arrary Of lead record To be inserted
             LeadData[] myLeadData = New LeadData[1];
             myLeadData[0] = New LeadData();
             myLeadData[0].LeadFirstName = "Nishant";
             myLeadData[0].LeadLastName = "Rana";
             myLeadData[0].Source = "Email";
             myLeadData[0].dLead_Generation_Date = Convert.ToDateTime("7/30/2010");
             myLeadData[0].LeadOwner = "Nishant Rana";
             myLeadData[0].dLead_Generation_dateSpecified = True;             

            // add lead data array To listofLeadData Class
             ListOfLeadData myLstLeadData = New ListOfLeadData();
             myLstLeadData.Lead = myLeadData;

            // create an instance Of leadinsert_input Class
            LeadInsert_Input myLeadRecordInput = New LeadInsert_Input();
            myLeadRecordInput.ListOfLead = myLstLeadData;
            LeadInsert_Output myLeadRecordOutput = myLead.LeadInsert(myLeadRecordInput);    
        }

 

 

The sample code for the ManageSession.cs class

 class ManageSession
    {
        public static string SessionID = "";
        public static String Login(String loginUrlString, String userName, String password)
        {
            try
            {
                // create a http request and set the headers for authentication
                HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(loginUrlString);
                HttpWebResponse myResponse;
                myRequest.Method = "POST";
                // passing username and password in the http header 
                // username format if it includes slash should be the forward slash /
                myRequest.Headers["UserName"] = userName;
                myRequest.Headers["Password"] = password;
                myResponse = (HttpWebResponse)myRequest.GetResponse();
                Stream sr = myResponse.GetResponseStream();
                // retrieve session id
                char[] sep = { ‘;’ };
                String[] headers = myResponse.Headers["Set-Cookie"].Split(sep);
                for (int i = 0; i <= headers.Length – 1; i++)
                {
                    if (headers[i].StartsWith("JSESSIONID"))
                    {
                        sep[0] = ‘=’;
                        SessionID = headers[i].Split(sep)[1];
                        break;
                    }
                }
                sr.Close();
                myResponse.Close();
            }
            catch (WebException webException)
            {
                return webException.Message;
            }
            catch (Exception ex)
            {
                return ex.Message;
            }
            // send back the session id that should be passed to subsequent calls 
            // to webservices 
            return SessionID;
        }

        public static String Logoff(String logoffUrlString, string SessionID)
        {
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(logoffUrlString);          
            // set the session id in header
            req.Headers["JSESSIONID"] = SessionID;
            // make the HTTP call
            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            return resp.StatusCode.ToString();

        }
    }

 

Hope it helps !

Bye..