Posts

Showing posts with the label CRM Technical Information

Dynamics 365 Check User has Send As Privilege programatically

Business Requirement :- Many a times in our project we get the requirement to check if logged user has Send As privilege allowed in his personal setting programatically. We can use below code snippet to check the logged in user personal settings from plugin code. public bool CheckUserSendAsPrivilege(IOrganizationService service, Guid userGuid)         {             try             {                 if (userGuid != Guid.Empty)                 {                     QueryExpression queryUserSettings = new QueryExpression(UserSettings.EntityLogicalName);                     queryUserSettings.NoLock = true;                     queryUserSettings.Criteria.AddCondition(UserSettings.systemus...

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!

Microsoft Dynamics CRM Publish Entities Customization using C# code PublishXmlRequest

This post is to demonstrate that you can publish entity customization with the help of C# code. In one of the project which I was working on faced the issue of publishing entity customization from web client. I was getting generic SQL error "SQL timeout error". It was very hard to publish the changes from web client and deliverable were also impacted. I searched over the internet and found that we can publish the changes using C# code without facing any issue. Sample code _serviceProxy.Execute(new PublishXmlRequest             {                 ParameterXml = @"                     <importexportxml>                         <entities>                             <entity>systemuser</entity>  ...

Microsoft CRM Dynamics Technical And Functional Interview Question and Answer

You cannot export the Default Solution as a Managed Solution, and you cannot deploy a complete Default Solution from Microsoft Dynamics CRM on-premises to Microsoft Dynamics CRM Online or the other way around. You can deploy a custom Solution between two Microsoft Dynamics CRM 2013 systems that use either platform. Hitachi Interview Question 1.        Explain OOPS concept OOP Features Object Oriented Programming (OOP) is a programming model where programs are organized around objects and data rather than action and logic.   OOP allows decomposition of a problem into a number of entities called objects and then builds data and functions around these objects. The software is divided into a number of small units called objects. The data and functions are built around these objects. The data of the objects can be accessed only by the functions associated with that object. The functions of one object can acce...