My Photo

Microsoft Dynamics 365

Official Blog for Microsoft Dynamics Functional and Technical Solutions....
Browsing Category " ms crm 2011 "

How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013 dynamics365

How to Create Dynamic OptionSet in MS Dynamics CRM 2011 & 2013


This code will help you..................

function dynamicoptionset() {

//get value in no in variable
    var totaldivision = Xrm.Page.getAttribute("fieldname" ).getValue();
    if (totaldivision == null || totaldivision == "" )
        return;
    else {

Activate / Deactivate a record using c# in MS CRM 2011 , MS CRM 2013 , MS CRM 2015 ( using SetStateRequest )


hey , as we offensively get requirement to activate and reactivate a record then we start using update event , but there is a very simple method to do so , by using SetStateRequest : it require an assembly " microsoft.crm.sdk.proxy.dll " and using " using Microsoft.Crm.Sdk.Messages;" .
Code will be :
   SetStateRequest req = new SetStateRequest();
             //the entity you want to change the state of
   req.EntityMoniker = new EntityReference("new_abc", recordId);
            //what should the new state be
    req.State = new OptionSetValue(1);
           //Pick an option from the status reason picklist to specify reason for state change
    req.Status = new OptionSetValue(2);
    SetStateResponse resp = (SetStateResponse)service.Execute(req);

Fields that are not valid were specified for the entity - Importing Solution Error mscrm 2011 , mscrm 2013 , mscrm 2015

Hey , I was importing a solution today from an other Organization and got a Error new to me :  Fields that are not valid were specified for the entity , as there was no description i was little confused , but after few R&D came up with perfect resolution of the error .

Reason 

  • Organization "A" conatined attribute 'new_mscrm' that was of type "single line" ,Later  We changed that the field  to be an currency Type.
  • But in Organization "B" was containg same field 'new_mscrm' of type "Single line".
  • When we tried to import back the new solution to test environment we got this Import failure

Set Field Read Only Using JavaScript In MSCRM ( Lock Field in MS CRM )



Hey Below is the Code To Set a Attribute / field on form Read only (Lock) using JavaScript in MS CRM .


// Get Control of entity
Xrm.Page.ui.controls.get("new_companyreference");
// Now set the property to lock the field
ToBeReadOnlyControl.setDisabled(true);


Note : Xrm.Page.ui.controls.get("new_companyreference"); by this we get full UI controls of the attribute / field by which we can set or get any ui property of that field .


SOURCE : JUST2CODE.IN Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012

Get field Name Using JavaScript in ms crm 2011 , ms crm 2013 , ms crm 2015 ( get dynamically field Label using JavaScript)



Hi all below you will find how to get field label name using JavaScript .

 var fieldname = executionContext.getEventSource().getName();
NOTE: Remember to pass context as perimeter while submitting function Name.



SOURCE : JUST2CODE.IN Subscribe to our YouTube channel : https://www.youtube.com/user/TheRussell2012