My Photo

Microsoft Dynamics 365

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

Set only contact entity or only Account entity customer field lookup in case / Opportunity for ms crm

Set potential customer look up field to only for contact entity record.

By default out of the box functionality gave a pop up with two entity type -contact & account for customer lookup field ,
if your requirement is to set only contact or only account as entity it can be done using javascript as given below ,

Both Contact and Account are viewed by Default 

Get Schema Names of the field ( Attribute ) using JavaScript in ms crm


To get the Schema Names of all the attributes or fields in given entity. 

function getSchemaNamesList(entityName) {
 var request = "<Request xsi:type='RetrieveEntityRequest'>" +
               "<MetadataId>00000000-0000-0000-0000-000000000000</MetadataId>" +
               "<EntityItems>IncludeAttributes</EntityItems>" +
               "<LogicalName>" + entityName + "</LogicalName>" +
               "<IsCustomizable>1</IsCustomizable>" +
               "<RetrieveAsIfPublished>true</RetrieveAsIfPublished>" +
               "</Request>";

New JavaScript function for ms crm 2011 , ms crm 2013 and ms crm 2015 , useful JavaScript method for Microsoft dynamics crm


        Below are the few useful properties, commands in ms crm 2011 ms crm 2013 and ms crm 2015 Javascript. You can work with them on form event say OnLoad.

Click on the item below to go through the description about that.
  • Get the string value of a Text field
  • Set the string value of a Text field
  • Retrieve Optionset Value/Text
  • Get the label name of the field
  • Get Lookup field name(value)
  • Get Lookup field ID
  • Get current entity name
  • Get Type Code of lookup
  • Get reference entity name of lookup
  • Set Lookup field
  • Get Event generated field value
  • Get Organization Name
  • Get Organization Language Code
  • Get Server URL
  • Check for Dirty
  • Get GUID of current record
  • Whether the field is disabled or not
  • Get form type
  • Get required fields in the form
  • Save the current record
  • Save the current record
  • Set focus on the field
  • Hide a field on the form
  • Disable(Read only) and Enable a field
  • Close opened window
  • Open Browser Window
  • Get Logged-in User ID
  • Attach Event to control
  • Set Description field in E-mail entity
  • Set IFrame URL
  • Get Schema Names of the Attributes
  • Get Teams of User
  • Filtered Lookup
  • Trigger the Workflow
  • Set field value using query string parameter
  • Change the Status and Status Reason of the record
  • Get the current form name
  • Refresh the form
  • Hide left navigation item
  • Set field requirement level in run time
  • Get Organization URL