Posts

Dynamics 365 Sample Code to set null value for all data types using c#

Recently we had a requirement to set null value for all data types field from C# as part of our integration. I tried searching on internet but couldn't find proper documentation or sample code for all data types field. So i decided to try using console utility and also wanted to share with CRM communities. Sample Code Snipped                 Entity objLead = new Entity("lead");                 objLead.Id = Guid.Parse("Record GUID");                 //Currency                 //objLead["ims_loanamount"] = null;                 //Decimal                 //objLead["ims_loanrate"] = null;                 //Datetime                 //objLead["ims_birt...

Dynamics CRM 365 Error 'The Given Key is not present in dictionary'

As a Dynamics CRM developer we always come across the error saying that 'The Given Key is not present in dictionary'. The reason we receive this error message because of below issues:- When we try to get the attribute value from Entity object without checking the attribute. String AccountNumber=objAccount["accountnumber"];   The above line will throw error if ObjAccount doesn't contains this attributes.  TO fix this we should always check attributes in Entity object then get the value. Resolution: if(objAccount.attributes.contains("accountnumber")) String AccountNumber=objAccount["accountnumber"];            We can also use below code which will return null if attribute is not present in Entity object. string AccountNumber=objAccount.GetAtrributeValue<String>("accountnumber"); Happy CRMing!

CRM dynamics Hiding Add Existing Subgrid (+) Button

We had the requirement to Hide Add existing button for one of the grid on the form. We have achieved above requirement using DOM explorer. Due to multiple Enable/Display rule associated to this button it was hard to hide this button. //Hiding Add Existing Activity Contacts Subgrid (+) Button document.getElementById("subGrid_ActivityContacts_addImageButton").disabled = true; document.getElementById("subGrid_ActivityContacts_addImageButton").style.visibility = "hidden"; document.getElementById("subGrid_ActivityContacts_addImageButton").style.display = "none"; If you need to Hide Add Existing button for any SubGrid, please replace Subgrid Button ID with your SubGrid ID. You Can get this ID from Developer tool of any browser. Hope this Helps! Happy CRMing!

CRM Dynamics 2013 Set Header Field Value

Often we need to set value of Header field in CRM 2013. XRM.Page object model doesn't support setting up value to header form. We tried putting the field on main form and Header as well. Using XRM.Page setValue() to Main form field doesn't auto populate field value on Header form. To overcome this problem we have used below code to set the value on Header field. if (document.getElementById("header_new_membership_d") { document.getElementById("header_new_membership_d").innerText = membershipText; } Please note that above code is unsupported and not recommended by Microsoft. This code will not work if Microsoft makes changes to DOM for newer release. Hope it helps! Happy CRMing!

Software Engineering Interview Question and Answer

Software Engineering - Post Test With respect to "Software Crisis", identify the CORRECT statement from the following. options                                                                 a)  Increase in program size and complexity led to cost reduction b) Increase in program size and complexity led to ease of maintenance c) Increase in program size and complexity led to early release                   d) Increase in program size and complexity led to failure at customers site        ...

Core Java Interview Question and Answer PowerPoint

Java Interview Question and Answer SET 2

Image
1.       If you access an uninitialized local variable will result? Syntax Error Compile Time Error Run Time Error No Error 2.       Which is right way to declare Array? int[] myArray; int myArray[]; int []myArray; A and B Both 3.       Overloaded methods are differentiated by Number of arguments Data type of arguments Number and the Data type of the arguments None of the above 4.       A constructor that is automatically generated in the absence of explicit constructors called? Default Constructor Nullary Constructor Empty Constructor All the above 5.       Which package does define String and String Buffer classes? 6.       Which of these is supported by method overriding in Java? a) Abstraction b) Encapsulation c) Polymorphism d) None of the m...