Common JavaScript Functions Used In Ms CRM

 

  • To get the form context from the execution context, use this function:
function getFormContext(executionContext) {
  return executionContext.getFormContext();
}
  • To get the value of a field, use this function:
function getFieldValue(formContext, fieldName) {
  return formContext.getAttribute(fieldName).getValue();
}
  • To set the value of a field, use this function:
function setFieldValue(formContext, fieldName, fieldValue) {
  formContext.getAttribute(fieldName).setValue(fieldValue);
}
  • To show or hide a field, use this function:
function showHideField(formContext, fieldName, visible) {
  formContext.getControl(fieldName).setVisible(visible);
}
  • To add an event handler for a field change event, use this function:
function addOnChange(formContext, fieldName, handler) {
  formContext.getAttribute(fieldName).addOnChange(handler);
}
  • To remove an event handler for a field change event, use this function:
function removeOnChange(formContext, fieldName, handler) {
  formContext.getAttribute(fieldName).removeOnChange(handler);
}

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