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
Post a Comment