Showing posts from July, 2015

Object-Oriented Programming Fundamentals in C#

Object-Oriented Programming (OOP) Terms Basics Object-Oriented Programming (OOP) : An approach to designing and building applications that are flexible, natural, well-crafted, and testable by focusing on objects that interact cleanly with one another. Class : The code describing a particular entity in the application, such as Customer, Order, or Address. The class contains the code defining the properties and methods (see below). Property : The code defining the data managed by the class, such as CustomerName, OrderNumber, or EmailAddress. Method : The code defining the actions or behaviors of the class, such as Validate or CalculateTotal. Methods are defined in the code with C# functions. Members : Refers to the properties and methods for a class. Object : An instance of a class that is created at runtime. In C#, an instance is created with the  new  keyword. Object Variable : The variable used when creating an object. For example,  var myCustomer = new Customer()

Setting null value using MS CRM

I had an odd error where I was trying to null a lookup field in Javascript in CRM 2013.When the user changed a lookup field, I wanted to blank out a few fields to make them select those fields again.  The fields being nulled were dependant on selection of the first lookup field and the options and values they could pick changed. if (Xrm.Page.getAttribute("field1").getValue() != null) {     Xrm.Page.getAttribute("field1").setValue(null); } if (Xrm.Page.getAttribute("field2").getValue() != null) {     Xrm.Page.getAttribute("field2").setValue(null); } field1 was correctly set to null but field2 refused to be set to null I changed my code to set the required level to none, set field2 to null and then reset the required level to required. //I had to set required level to none because assign null wasn't working, might be fixed in future roll ups     if (Xrm.Page.getAttribute("field1").getValue() != null) {          

The Under Operator in MS CRM 2015

Advanced Find now includes two new operators which work in conjunction with the new hierarchies feature in Dynamics CRM 2015. These operators are called “Under” and “Not Under” and can be used when querying lookup fields in Advanced Find. I have currently set up the Users in our Dynamics CRM system such that the Managerfor each user has been specified. This builds a user hierarchy in the system so we can easily see who reports to who. Let’s assume we have an organisational structure where there are multiple managers at different levels. It would be a tricky in previous versions of Dynamics CRM if I wanted to build a query to show everyone who sat below Bob Jones. In CRM 2015, I can simply use the “Under” operator to find these people. Running this query gives me everyone who sits below Bob Jones, whether they are a direct relationship with that record or not.  

Business Process Flow 2013/2015

CRM 2013 BPF Business process Flows are a new enhancement to dynamics CRM 2013, and they bring the power of guided business rules to the application. Unlike workflow processes, BPFs are designed to work with users and guide them through a variety of business processes. Key Benefits CRM 2013 BPF 1.        BPF allow organization to define the specific steps that need to be taken for something to happen. BPF allow org. to track where in the process the record is. 2.        BPF allow for “stage-gating”, which requires data to be entered before proceedings to the next step. BPF are visually represented on the record. 3.        BPF can be controlled through portable business logic and workflow. An example of this is when a field is hidden via a PBL or a value is populated via a workflow, the BPF incorporates this changes as well. 4.        BPF allow for multiple entities in the BPF(up to five) 5.        There can be 10 active BPF per entity 6.        Users with approp

Set Date Time Field to Now in Plugin Dynamics CRM 2011

In Dynamics CRM 2011 when you are creating or updating records through a plugin, you will sometimes be required to set a date field to the current date and time of the plugins execution. There are two ways of doing this with a plugin. One method is using DateTime.Now, which will give you the local time of the CRM Server. The other method (the recommended method) is using DateTime.UtcNow. This will give you the CRM Server time, but it will be converted into UTC time.   Dynamics CRM 2011 stores all Date/Time fields in UTC time, so by using the ‘DateTime.UtcNow’ approach our dates will be converted into UTC time before hitting the database. When our users read the date through CRM it will be converted back into their local time zone, and will read correctly for them. If we check the database, we can see how the date from the image above is actually stored in the database using UTC time:   If you were to set a date using ‘DateTime.Now’, the exact server time would be saved in