some commonly used JavaScript functions and methods in Dynamics 365 (Microsoft CRM) using the updated formContext object:

 

  1. Get the form context:
javascript
var formContext = executionContext.getFormContext();
  1. Get the attribute object:
javascript
var attribute = formContext.getAttribute("fieldName");
  1. Get the attribute value:
javascript
var value = attribute.getValue();
  1. Set the attribute value:
javascript
attribute.setValue(newValue);
  1. Enable or disable the attribute:
javascript
attribute.setDisabled(true); // Disable attribute.setDisabled(false); // Enable
  1. Make the attribute required or not required:
javascript
attribute.setRequiredLevel("required"); // Required attribute.setRequiredLevel("none"); // Not Required
  1. Show or hide a section:
javascript
formContext.getControl("sectionName").setVisible(true); // Show formContext.getControl("sectionName").setVisible(false); // Hide
  1. Show or hide a tab:
javascript
formContext.ui.tabs.get("tabName").setVisible(true); // Show formContext.ui.tabs.get("tabName").setVisible(false); // Hide
  1. Show or hide a field on the form:
javascript
formContext.getControl("fieldName").setVisible(true); // Show formContext.getControl("fieldName").setVisible(false); // Hide
  1. Refresh the form:
javascript
formContext.data.refresh();

Comments

Popular posts from this blog

Power Automate - Update Child record when parent record is updated by using power automate in MS Dynamics CRM

Create Folder On Share Point by using Power Automate In Dynamics CRM

Duplicate Detection Plugin code for Microsoft dynamics CRM