Hi,
Got this error while working with WCF services in CRM 2011 from within a windows application.
Resolved it by installing Windows Identity Foundation
Bye..
Hi,
Got this error while working with WCF services in CRM 2011 from within a windows application.
Resolved it by installing Windows Identity Foundation
Bye..
Hi,
I got the following comment on my blog.
“I wrote a plugin that creates a folder in SharePoint. It works just fine. However, I need to be able to use the quotenumber as the folder name. I am having problems figuring out how to retrieve that value. I am able to retrieve values of other fields, but the quote number is assigned when the record is saved. I am guessing that the quote number is not getting assigned until after the plugin is being called. I am not sure what to do. Any ideas?”
So i thought of trying it out. I created a Post Create plugin (synchronous) against quote entity. Than wrote code to retrieve the value for quotenumber from the inputparameters property bag. As it was create event i thought the value must be there for it. However i saw that the quotenumber property is not being passed as a part of inputparameters.
So than I used ForceSubmit method to get its value. However this time i was getting blank value. Than tried by registering the post entity image, but was still getting the blank value.
Finally i tried by registering the plugin in child pipeline, and to my surprise the value was there for the quotenumber attribute.
So to get the quotenumber we need to register our plugin in post create and childpipeline. ( no need of ForceSubmit method or PostEntityImage)
I hope it helps !
Bye.
Hi,
Check out these wonderful posts !
http://weblogs.asp.net/scottgu/archive/2009/08/25/vs-2010-and-net-4-series.aspx
Bye..
Suppose this is our class Person, having an string property name FullName.
}
private void button1_Click(object sender, RoutedEventArgs e)
{
UnderstandingPassbyValandRef();
}
private void UnderstandingPassbyValandRef()
{
Person myPOriginal = new Person();
myPOriginal.FullName = "Nishant Rana";
PassByValue(myPOriginal);
MessageBox.Show(myPOriginal.FullName);
// Output : “Nishant Rana PassByVal”
PassByRef(ref myPOriginal);
MessageBox.Show(myPOriginal.FullName);
// Output : “Srihari Radhakrishnan”
this.Close();
}
Bye..
Suppose this is our entity’s schema name “new_test”
and it contains following fields
new_name
new_lastname
Using CrmSvcUtil we have created the Entities classes and Data Context class.
https://nishantrana.wordpress.com/2010/08/11/using-crmsvcutil/
Now this is how we could use LINQ to query data using query expression as well as method based query.
To loop through all the test records
To select a specific record
var singleRecord1 = myXrm.new_tests
.Single(t => t.new_lastname == “Rana”);
var allRecords1 = myXrm.new_tests.
Where(t => t.new_lastname == “Rana”);
To order the records
var allRecOrder1 = myXrm.new_tests
.OrderBy(t => t.new_name)
.Where(t => t.new_lastname == “Rana”);
To select specific field instead of the entire record
var singleField1 = myXrm.new_tests
.Select(t => t.new_name);
To return specific fields
var specificFields = from myTest in myXrm.new_tests
select new { myTest.createdby, myTest.createdon };
var specificFields1 = myXrm.new_tests
.Select(t => new { t.createdby, t.createdon });
Use of Take and Skip function
Take returns the given number of elements and ignores the rest
Skip skips the given number of elements and yielding the rest
var takeField = (from myTest in myXrm.new_tests
select myTest.new_name).Take(2);
var takeField1 = myXrm.new_tests
.Take(2)
.Select(t => t.new_name);
var skipField = (from myTest in myXrm.new_tests
select myTest.new_name).Skip(2);
var skipField1 = myXrm.new_tests
.Skip(2)
.Select(t => t.new_name);
Join – similar to inner join
The ‘select’ and ‘orderBy’ calls may only reference
var joinRecords1=myXrm.new_tests
.Join(myXrm.systemusers,
t=>t.ownerid.Value,
s=>s.systemuserid ,
(t,s)=>new {t.new_name});
Where conditions with Contains,StartsWith, EndsWith and
var test11 = myXrm.new_tests
.Where(t => t.new_name.Contains(“R”));
var test22 = myXrm.new_tests
.Where(t => t.new_name.StartsWith(“R”));
var test32 = myXrm.new_tests
.Where(t => t.new_name.EndsWith(“D”));
Download the project :-
http://www.box.net/shared/xbg0xd5p7m
Bye..
Use CrmSvcUtil to generate the strongly types entity and datacontext classes
crmsvcutil
/connectionString:"Authentication Type=Integrated; Server=http://servername/orgname"
/out:"Xrm.cs" /namespace:"Xrm.solution"
/dataContextClassName:"xrm"
conntectionString–> specifies the connection string.
out –> determines the name of the .cs or .xml output file and whether there is one file or one per entity.To generate one file per entity omit .cs or .xml from the file name.
namespace –> to specify the namespace
dataContextClassName –> to specify the name of the dataContext class.
Add references to the following dlls in the project
Add the generated Xrm.cs file to the project.
Add the connection string information in the config file of the application
<add name="CRMOnPremise" connectionString="Authentication Type=Integrated; Server=http://servername/orgname" />
Add following using Statements
using Xrm;
using Xrm.solution;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
And the code for creating a new custom entity record.
or could also be written as
// create the instace of DataContext class named xrm
var myXrm = new xrm("CRMOnPremise");
// use concept of Implicitly type local variable
// and object intializer
var testEntity = new new_test()
{
new_name = "Nishant",
new_lastname = "Rana"
};
myXrm.AddTonew_tests(testEntity);
myXrm.SaveChanges();
Similarly to update a record and delete a record we need to use
UpdateObject() and DeleteObject() function followed by call to
SaveChanges() method.
Bye.